From 2f674e79d42e7d36225fa9ac7ecefbc5bc62d325 Mon Sep 17 00:00:00 2001 From: vnugent Date: Thu, 13 Jul 2023 13:20:25 -0400 Subject: Checkpoint, kind of working clustering --- .../src/Clustering/CacheClientConfiguration.cs | 115 +++++++++++++++ .../Clustering/CacheDiscoveryFailureException.cs | 44 ++++++ .../src/Clustering/CacheNodeAdvertisment.cs | 96 +++++++++++++ .../src/Clustering/CacheNodeConfiguration.cs | 110 +++++++++++++++ .../src/Clustering/ICacheDiscoveryErrorHandler.cs | 41 ++++++ .../src/Clustering/INodeDiscoveryCollection.cs | 62 ++++++++ .../src/Clustering/INodeDiscoveryEnumerator.cs | 41 ++++++ .../src/Clustering/NodeDiscoveryCollection.cs | 156 +++++++++++++++++++++ 8 files changed, 665 insertions(+) create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheDiscoveryFailureException.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeAdvertisment.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeConfiguration.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/ICacheDiscoveryErrorHandler.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryCollection.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryEnumerator.cs create mode 100644 lib/VNLib.Data.Caching.Extensions/src/Clustering/NodeDiscoveryCollection.cs (limited to 'lib/VNLib.Data.Caching.Extensions/src/Clustering') diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs new file mode 100644 index 0000000..1c1997e --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: CacheClientConfiguration.cs +* +* CacheClientConfiguration.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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 System.Linq; +using System.Collections.Generic; + + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + + /// + /// A fluent api configuration object for configuring a + /// to connect to cache servers. + /// + public class CacheClientConfiguration + { + /// + /// Stores available cache servers to be used for discovery, and connections + /// + public INodeDiscoveryCollection NodeCollection { get; } = new NodeDiscoveryCollection(); + + /// + /// The authentication manager to use for signing and verifying messages to and from the cache servers + /// + public ICacheAuthManager AuthManager { get; private set; } + + /// + /// The error handler to use for handling errors that occur during the discovery process + /// + public ICacheDiscoveryErrorHandler? ErrorHandler { get; private set; } + + /// + /// Specifies if all connections should use TLS + /// + public bool UseTls { get; private set; } + + internal Uri[]? WellKnownNodes { get; set; } + + /// + /// Specifies the JWT authentication manager to use for signing and verifying JWTs + /// + /// The authentication manager + /// Chainable fluent object + public CacheClientConfiguration WithAuthenticator(ICacheAuthManager manager) + { + AuthManager = manager; + return this; + } + + /// + /// Specifies if all connections should be using TLS + /// + /// A value that indicates if connections should use TLS + public CacheClientConfiguration WithTls(bool useTls) + { + UseTls = useTls; + return this; + } + + /// + /// Specifies the initial cache peers to connect to + /// + /// The collection of servers to discover peers from and connect to + /// Chainable fluent object + public CacheClientConfiguration WithInitialPeers(IEnumerable peers) + { + //Check null + _ = peers ?? throw new ArgumentNullException(nameof(peers)); + + //Store peer array + WellKnownNodes = peers.ToArray(); + + if (WellKnownNodes.Any(p => !p.IsAbsoluteUri)) + { + WellKnownNodes = null; + throw new ArgumentException("All discoverable node uris must be in absolute form"); + } + + return this; + } + + /// + /// Specifies the error handler to use for handling errors that occur during the discovery process + /// + /// The error handler to use during a discovery + /// Chainable fluent object + public CacheClientConfiguration WithErrorHandler(ICacheDiscoveryErrorHandler handler) + { + ErrorHandler = handler; + return this; + } + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheDiscoveryFailureException.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheDiscoveryFailureException.cs new file mode 100644 index 0000000..84d611e --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheDiscoveryFailureException.cs @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: CacheDiscoveryFailureException.cs +* +* CacheDiscoveryFailureException.cs is part of VNLib.Data.Caching.Extensions which is +* part of the larger VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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; + + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + /// + /// Raised when an error occurs during cache discovery + /// + public class CacheDiscoveryFailureException : Exception + { + public CacheDiscoveryFailureException(string message) : base(message) + { } + + public CacheDiscoveryFailureException(string message, Exception innerException) : base(message, innerException) + { } + + public CacheDiscoveryFailureException() + { } + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeAdvertisment.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeAdvertisment.cs new file mode 100644 index 0000000..e81d506 --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeAdvertisment.cs @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: CacheNodeAdvertisment.cs +* +* CacheNodeAdvertisment.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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 System.Text.Json.Serialization; + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + /// + /// Represents a node that can be advertised to clients + /// + public class CacheNodeAdvertisment : IEquatable + { + /// + /// The endpoint for clients to connect to to access the cache + /// + [JsonIgnore] + public Uri? ConnectEndpoint { get; set; } + + /// + /// Gets the address for clients to connect to to discover other discovertable nodes + /// + [JsonIgnore] + public Uri? DiscoveryEndpoint { get; set; } + + /// + /// Gets the unique identifier for this node + /// + [JsonPropertyName("iss")] + public string NodeId { get; set; } + + [JsonPropertyName("url")] + public string? url + { + get => ConnectEndpoint?.ToString(); + set => ConnectEndpoint = value == null ? null : new Uri(value); + } + + [JsonPropertyName("dis")] + public string? dis + { + get => DiscoveryEndpoint?.ToString(); + set => DiscoveryEndpoint = value == null ? null : new Uri(value); + } + + /// + /// Determines if the given node is equal to this node, by comparing the node ids + /// + /// The other node advertisment to compare + /// True if the nodes are equal, false otherwise + public override bool Equals(object? obj) => obj is CacheNodeAdvertisment ad && Equals(ad); + + /// + /// Gets the hash code for this node, based on the node id + /// + /// The instance hash-code + public override int GetHashCode() => string.GetHashCode(NodeId, StringComparison.OrdinalIgnoreCase); + + /// + /// Determines if the given node is equal to this node, by comparing the node ids + /// + /// The other node advertisment to compare + /// True if the nodes are equal, false otherwise + public bool Equals(CacheNodeAdvertisment? other) => string.Equals(NodeId, other?.NodeId, StringComparison.OrdinalIgnoreCase); + + /// + /// Formats a string representation of this node + /// + /// The formatted information string + public override string ToString() + { + return $"NodeId: {NodeId} Connect: {url}, Discover?: {dis}"; + } + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeConfiguration.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeConfiguration.cs new file mode 100644 index 0000000..6b7ab48 --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheNodeConfiguration.cs @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: CacheNodeConfiguration.cs +* +* CacheNodeConfiguration.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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; + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + + /// + /// A cache configuration for cache servers (nodes) + /// + public class CacheNodeConfiguration : CacheClientConfiguration + { + /// + /// The address for clients to connect to + /// + public Uri? ConnectEndpoint { get; private set; } + + /// + /// Whether or not to advertise ourself to peer nodes + /// + public bool BroadcastAdverisment { get; private set; } + + /// + /// Define the endpoint for clients to connect to to discover + /// other discovertable nodes + /// + public Uri? DiscoveryEndpoint { get; private set; } + + /// + /// Gets the configuration for this node as an advertisment + /// + public CacheNodeAdvertisment Advertisment + { + get + { + return new CacheNodeAdvertisment() + { + DiscoveryEndpoint = DiscoveryEndpoint, + ConnectEndpoint = ConnectEndpoint, + NodeId = NodeId + }; + } + } + + /// + /// Sets the full address of our cache endpoint for clients to connect to + /// + /// The uri clients will attempt to connect to + public CacheNodeConfiguration WithCacheEndpoint(Uri connectUri) + { + ConnectEndpoint = connectUri; + return this; + } + + /// + /// Enables or disables the advertisement of this node to other nodes + /// + /// The absolute endpoint clients will use to connect to + public CacheNodeConfiguration EnableAdvertisment(Uri? discoveryEndpoint) + { + BroadcastAdverisment = discoveryEndpoint != null; + DiscoveryEndpoint = discoveryEndpoint; + return this; + } + + /// + public string NodeId { get; private set; } = null!; + + /// + /// Specifies the current server's cluster node id. If this + /// is a server connection attempting to listen for changes on the + /// remote server, this id must be set and unique + /// + /// The cluster node id of the current server + /// Chainable fluent object + /// + public CacheNodeConfiguration WithNodeId(string nodeId) + { + NodeId = nodeId ?? throw new ArgumentNullException(nameof(nodeId)); + + //Update the node id in the node collection + (NodeCollection as NodeDiscoveryCollection)!.SetSelfId(nodeId); + + return this; + } + + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/ICacheDiscoveryErrorHandler.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/ICacheDiscoveryErrorHandler.cs new file mode 100644 index 0000000..984ce3d --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/ICacheDiscoveryErrorHandler.cs @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: ClientCacheConfiguration.cs +* +* ClientCacheConfiguration.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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; + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + /// + /// Represents an type that will handle errors that occur during the discovery process + /// + public interface ICacheDiscoveryErrorHandler + { + /// + /// Invoked when an error occurs during the discovery process + /// + /// The node that the error occured on + /// The exception that caused the invocation + void OnDiscoveryError(CacheNodeAdvertisment errorNode, Exception ex); + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryCollection.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryCollection.cs new file mode 100644 index 0000000..1f4d154 --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryCollection.cs @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: INodeDiscoveryCollection.cs +* +* INodeDiscoveryCollection.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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.Collections.Generic; + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + /// + /// Represents a collection of discovered nodes + /// +#pragma warning disable CA1711 // Identifiers should not have incorrect suffix + public interface INodeDiscoveryCollection +#pragma warning restore CA1711 // Identifiers should not have incorrect suffix + { + /// + /// Begins a new discovery and gets an enumerator for the discovery process + /// + /// An enumerator that simplifies discovery of unique nodes + INodeDiscoveryEnumerator BeginDiscovery(); + + /// + /// Begins a new discovery and gets an enumerator for the discovery process + /// + /// An initial collection of peers to add to the enumeration + /// An enumerator that simplifies discovery of unique nodes + INodeDiscoveryEnumerator BeginDiscovery(IEnumerable initialPeers); + + /// + /// Gets a snapshot of all discovered nodes in the current collection. + /// + /// The current collection of notes + CacheNodeAdvertisment[] GetAllNodes(); + + /// + /// Completes a discovery process and updates the collection with the results + /// + /// The enumerator used to collect discovered nodes + void CompleteDiscovery(INodeDiscoveryEnumerator enumerator); + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryEnumerator.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryEnumerator.cs new file mode 100644 index 0000000..677088a --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/INodeDiscoveryEnumerator.cs @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: INodeDiscoveryEnumerator.cs +* +* INodeDiscoveryEnumerator.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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.Collections.Generic; + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + /// + /// A custom enumerator for the node discovery process + /// + public interface INodeDiscoveryEnumerator : IEnumerator + { + /// + /// Adds the specified peer to the collection of discovered peers + /// + /// The peer collection + void OnPeerDiscoveryComplete(IEnumerable discoveredPeers); + } +} diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/NodeDiscoveryCollection.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/NodeDiscoveryCollection.cs new file mode 100644 index 0000000..b0e53e1 --- /dev/null +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/NodeDiscoveryCollection.cs @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2023 Vaughn Nugent +* +* Library: VNLib +* Package: VNLib.Data.Caching.Extensions +* File: NodeDiscoveryCollection.cs +* +* NodeDiscoveryCollection.cs is part of VNLib.Data.Caching.Extensions which is part of the larger +* VNLib collection of libraries and utilities. +* +* VNLib.Data.Caching.Extensions 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.Data.Caching.Extensions 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 System.Linq; +using System.Collections; +using System.Collections.Generic; + +namespace VNLib.Data.Caching.Extensions.Clustering +{ + /// + /// Represents a collection of available cache nodes from a discovery process + /// + public sealed class NodeDiscoveryCollection : INodeDiscoveryCollection + { + private string? _selfId; + private LinkedList _peers; + + /// + /// Initializes a new empty + /// + public NodeDiscoveryCollection() + { + _peers = new(); + } + + /// + /// Manually adds nodes to the collection that were not discovered through the discovery process + /// + /// The nodes to add + public void AddManualNodes(IEnumerable nodes) + { + //Get only the nodes that are not already in the collection + IEnumerable newPeers = nodes.Except(_peers); + + //Add them to the end of the collection + foreach (CacheNodeAdvertisment peer in newPeers) + { + _peers.AddLast(peer); + } + } + + /// + /// Sets the id of the current node, so it can be excluded from discovery + /// + /// The id of the current node to exclude + public void SetSelfId(string? selfId) => _selfId = selfId; + + /// + public INodeDiscoveryEnumerator BeginDiscovery() + { + return new NodeEnumerator(new(), _selfId); + } + + /// + public INodeDiscoveryEnumerator BeginDiscovery(IEnumerable initialPeers) + { + //Init new enumerator with the initial peers + return new NodeEnumerator(new(initialPeers), _selfId); + } + + /// + public void CompleteDiscovery(INodeDiscoveryEnumerator enumerator) + { + _ = enumerator ?? throw new ArgumentNullException(nameof(enumerator)); + + //Capture all nodes from the enumerator and store them as our current peers + _peers = (enumerator as NodeEnumerator)!.Peers; + } + + /// + public CacheNodeAdvertisment[] GetAllNodes() + { + //Capture all current peers + return _peers.ToArray(); + } + + private sealed record class NodeEnumerator(LinkedList Peers, string? SelfNodeId) : INodeDiscoveryEnumerator + { + private bool isInit; + + //Keep track of the current node in the collection so we can move down the list + private LinkedListNode? _currentNode; + + public CacheNodeAdvertisment Current => _currentNode?.Value; + object IEnumerator.Current => _currentNode?.Value; + + + /// + public bool MoveNext() + { + if (!isInit) + { + _currentNode = Peers.First; + isInit = true; + } + else + { + //Move to the next peer in the collection + _currentNode = _currentNode?.Next; + } + + return _currentNode?.Value != null; + } + + /// + public void OnPeerDiscoveryComplete(IEnumerable discoveredPeers) + { + //Get only the peers from the discovery that are not already in the collection, or ourselves + IEnumerable newPeers = discoveredPeers.Except(Peers); + + if (!string.IsNullOrWhiteSpace(SelfNodeId)) + { + //remove ourselves from the list + newPeers = newPeers.Where(p => !SelfNodeId.Equals(p.NodeId, StringComparison.OrdinalIgnoreCase)); + } + + //Add them to the end of the collection + foreach (CacheNodeAdvertisment ad in newPeers) + { + Peers.AddLast(ad); + } + } + + public void Reset() + { + //Go to the first node + _currentNode = Peers.First; + } + + public void Dispose() + { } + } + } +} -- cgit