diff options
author | vman <public@vaughnnugent.com> | 2022-12-28 14:19:32 -0500 |
---|---|---|
committer | vman <public@vaughnnugent.com> | 2022-12-28 14:19:32 -0500 |
commit | 9bb5ddd8f19c0ecabd7af4ee58d80c16826bc183 (patch) | |
tree | 7f8a3863d18f4673294ab11e427fe0b77fd70abf /Plugins/SessionCacheServer/Endpoints | |
parent | 1f2b3530ebeafa162fe4df41e691c33cb2ff0009 (diff) |
Cache provider abstractions, reduced deps
Diffstat (limited to 'Plugins/SessionCacheServer/Endpoints')
-rw-r--r-- | Plugins/SessionCacheServer/Endpoints/BrokerHeartBeat.cs | 6 | ||||
-rw-r--r-- | Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs | 14 |
2 files changed, 6 insertions, 14 deletions
diff --git a/Plugins/SessionCacheServer/Endpoints/BrokerHeartBeat.cs b/Plugins/SessionCacheServer/Endpoints/BrokerHeartBeat.cs index 2e380a3..bd1233e 100644 --- a/Plugins/SessionCacheServer/Endpoints/BrokerHeartBeat.cs +++ b/Plugins/SessionCacheServer/Endpoints/BrokerHeartBeat.cs @@ -37,7 +37,7 @@ using VNLib.Plugins.Extensions.Loading; namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints { - internal class BrokerHeartBeat : ResourceEndpointBase + internal sealed class BrokerHeartBeat : ResourceEndpointBase { public override string Path => "/heartbeat"; @@ -64,9 +64,7 @@ namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints private async Task<ReadOnlyJsonWebKey> GetBrokerPubAsync() { - using SecretResult brokerPubKey = await Pbase.TryGetSecretAsync("broker_public_key") ?? throw new KeyNotFoundException("Missing required secret : broker_public_key"); - - return brokerPubKey.GetJsonWebKey(); + return await Pbase.TryGetSecretAsync("broker_public_key").ToJsonWebKey() ?? throw new KeyNotFoundException("Missing required secret : broker_public_key"); } protected override async ValueTask<VfReturnType> GetAsync(HttpEntity entity) diff --git a/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs b/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs index 77acb13..2fe0994 100644 --- a/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs +++ b/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs @@ -47,7 +47,7 @@ using VNLib.Plugins.Essentials.Extensions; namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints { - class ConnectEndpoint : ResourceEndpointBase + internal sealed class ConnectEndpoint : ResourceEndpointBase { const int MAX_RECV_BUF_SIZE = 1000 * 1024; const int MIN_RECV_BUF_SIZE = 8 * 1024; @@ -194,21 +194,15 @@ namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints private async Task<ReadOnlyJsonWebKey> GetClientPubAsync() { - using SecretResult brokerPubKey = await Pbase.TryGetSecretAsync("client_public_key") ?? throw new KeyNotFoundException("Missing required secret : client_public_key"); - - return brokerPubKey.GetJsonWebKey(); + return await Pbase.TryGetSecretAsync("client_public_key").ToJsonWebKey() ?? throw new KeyNotFoundException("Missing required secret : client_public_key"); } private async Task<ReadOnlyJsonWebKey> GetCachePubAsync() { - using SecretResult cachPublic = await Pbase.TryGetSecretAsync("cache_public_key") ?? throw new KeyNotFoundException("Missing required secret : client_public_key"); - - return cachPublic.GetJsonWebKey(); + return await Pbase.TryGetSecretAsync("cache_public_key").ToJsonWebKey() ?? throw new KeyNotFoundException("Missing required secret : client_public_key"); } private async Task<ReadOnlyJsonWebKey> GetCachePrivateKeyAsync() { - using SecretResult cachePrivate = await Pbase.TryGetSecretAsync("cache_private_key") ?? throw new KeyNotFoundException("Missing required secret : client_public_key"); - - return cachePrivate.GetJsonWebKey(); + return await Pbase.TryGetSecretAsync("cache_private_key").ToJsonWebKey() ?? throw new KeyNotFoundException("Missing required secret : client_public_key"); } private async Task ChangeWorkerAsync(CancellationToken cancellation) |