diff options
author | vnugent <public@vaughnnugent.com> | 2023-08-19 23:44:53 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-08-19 23:44:53 -0400 |
commit | f541b853c738a076d2a85ef6b269c1b140353b85 (patch) | |
tree | ae52056036d22963613903181029c3ff9bed0f5a /lib/Plugins.Essentials/src/IVirtualEndpointTable.cs | |
parent | 3f5eb61fc7166674a5424d5f8e8c23a775c27614 (diff) |
Essentials middleware first addition, websocket feature and generics
Diffstat (limited to 'lib/Plugins.Essentials/src/IVirtualEndpointTable.cs')
-rw-r--r-- | lib/Plugins.Essentials/src/IVirtualEndpointTable.cs | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/Plugins.Essentials/src/IVirtualEndpointTable.cs b/lib/Plugins.Essentials/src/IVirtualEndpointTable.cs new file mode 100644 index 0000000..cfe9661 --- /dev/null +++ b/lib/Plugins.Essentials/src/IVirtualEndpointTable.cs @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Plugins.Essentials +* File: IVirtualEndpointTable.cs +* +* IVirtualEndpointTable.cs is part of VNLib.Plugins.Essentials which is part +* of the larger VNLib collection of libraries and utilities. +* +* VNLib.Plugins.Essentials 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. +* +* VNLib.Plugins.Essentials 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; + +#nullable enable + +namespace VNLib.Plugins.Essentials +{ + /// <summary> + /// Represents a table of virtual endpoints that can be used to process incoming connections + /// </summary> + public interface IVirtualEndpointTable + { + /// <summary> + /// Determines the endpoint type(s) and adds them to the endpoint store(s) as necessary + /// </summary> + /// <param name="endpoints">Params array of endpoints to add to the store</param> + /// <exception cref="ArgumentException"></exception> + /// <exception cref="ArgumentNullException"></exception> + void AddEndpoint(params IEndpoint[] endpoints); + + /// <summary> + /// Removes the specified endpoint from the virtual endpoint store + /// </summary> + /// <param name="eps">A collection of endpoints to remove from the table</param> + void RemoveEndpoint(params IEndpoint[] eps); + + /// <summary> + /// Stops listening for connections to the specified <see cref="IVirtualEndpoint{T}"/> identified by its path + /// </summary> + /// <param name="paths">An array of endpoint paths to remove from the table</param> + /// <exception cref="ArgumentException"></exception> + /// <exception cref="ArgumentNullException"></exception> + /// <exception cref="InvalidOperationException"></exception> + void RemoveEndpoint(params string[] paths); + + /// <summary> + /// A value that indicates whether the table is empty, allows for quick checks + /// without causing lookups + /// </summary> + bool IsEmpty { get; } + + /// <summary> + /// Attempts to get the endpoint associated with the specified path + /// </summary> + /// <param name="path">The connection path to recover the endpoint from</param> + /// <param name="endpoint"></param> + /// <returns></returns> + bool TryGetEndpoint(string path, out IVirtualEndpoint<HttpEntity>? endpoint); + } +}
\ No newline at end of file |