aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-07-28 18:11:14 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-07-28 18:11:14 -0400
commiteffb0538dbe26553992b883472df5bba4f46a4d3 (patch)
treebed440536286453a7fa49a5ef2185307859067e1
parente484f5478eee916c500a730cceb6cf448c959ce7 (diff)
Extensions, package, and api updates
-rw-r--r--libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionSerializer.cs6
-rw-r--r--plugins/SessionProvider/src/LocalizedLogProvider.cs77
-rw-r--r--plugins/SessionProvider/src/SessionProviderEntry.cs5
3 files changed, 6 insertions, 82 deletions
diff --git a/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionSerializer.cs b/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionSerializer.cs
index 479a958..32dcc34 100644
--- a/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionSerializer.cs
+++ b/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionSerializer.cs
@@ -99,7 +99,7 @@ namespace VNLib.Plugins.Sessions.Cache.Client
}
//Get waiter before leaving lock
- token = wait.GetWaiter();
+ wait.GetWaiter(out token);
}
return token.EnterWaitAsync(cancellation);
@@ -107,8 +107,7 @@ namespace VNLib.Plugins.Sessions.Cache.Client
///<inheritdoc/>
public override void Release(TSession moniker)
- {
-
+ {
WaitReleaseToken releaser;
lock (StoreLock)
@@ -133,6 +132,7 @@ namespace VNLib.Plugins.Sessions.Cache.Client
releaser = default;
}
}
+
//Release sem outside of lock
releaser.Release();
}
diff --git a/plugins/SessionProvider/src/LocalizedLogProvider.cs b/plugins/SessionProvider/src/LocalizedLogProvider.cs
deleted file mode 100644
index d0dce8d..0000000
--- a/plugins/SessionProvider/src/LocalizedLogProvider.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2022 Vaughn Nugent
-*
-* Library: VNLib
-* Package: SessionProvider
-* File: LocalizedLogProvider.cs
-*
-* LocalizedLogProvider.cs is part of SessionProvider which is part of the larger
-* VNLib collection of libraries and utilities.
-*
-* SessionProvider is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License as
-* published by the Free Software Foundation, either version 3 of the
-* License, or (at your option) any later version.
-*
-* SessionProvider is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see https://www.gnu.org/licenses/.
-*/
-
-using System;
-
-using VNLib.Utils.Logging;
-
-namespace VNLib.Plugins.Essentials.Sessions
-{
- internal sealed class LocalizedLogProvider : ILogProvider
- {
- private readonly ILogProvider Log;
- private readonly string LogPrefix;
-
- public LocalizedLogProvider(ILogProvider log, string prefix)
- {
- Log = log;
- LogPrefix = prefix;
- }
-
- public void Flush()
- {
- Log.Flush();
- }
-
- public object GetLogProvider()
- {
- return Log.GetLogProvider();
- }
-
- public bool IsEnabled(LogLevel level)
- {
- return Log.IsEnabled(level);
- }
-
- public void Write(LogLevel level, string value)
- {
- Log.Write(level, $"[{LogPrefix}]: {value}");
- }
-
- public void Write(LogLevel level, Exception exception, string value = "")
- {
- Log.Write(level, exception, $"[{LogPrefix}]: {value}");
- }
-
- public void Write(LogLevel level, string value, params object[] args)
- {
- Log.Write(level, $"[{LogPrefix}]: {value}", args);
- }
-
- public void Write(LogLevel level, string value, params ValueType[] args)
- {
- Log.Write(level, $"[{LogPrefix}]: {value}", args);
- }
- }
-}
diff --git a/plugins/SessionProvider/src/SessionProviderEntry.cs b/plugins/SessionProvider/src/SessionProviderEntry.cs
index acd8bcc..fc60eb4 100644
--- a/plugins/SessionProvider/src/SessionProviderEntry.cs
+++ b/plugins/SessionProvider/src/SessionProviderEntry.cs
@@ -89,12 +89,12 @@ namespace VNLib.Plugins.Essentials.Sessions
try
{
//Create localized log
- LocalizedLogProvider log = new(Log, $"{Path.GetFileName(asm)}");
+ ILogProvider scopded = Log.CreateScope(Path.GetFileName(asm));
RuntimeSessionProvider p = new(prov);
//Call load method
- p.Load(this, log);
+ p.Load(this, scopded);
//Add to list
providers.Add(p);
@@ -148,6 +148,7 @@ namespace VNLib.Plugins.Essentials.Sessions
private sealed class SessionProvider : VnDisposeable, ISessionProvider, IDisposable
{
+ //Default to an empty array for default support even if no runtime providers are loaded
private RuntimeSessionProvider[] ProviderArray = Array.Empty<RuntimeSessionProvider>();
public SessionProvider(RuntimeSessionProvider[] loaded)