-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Make interface for routing table (#2046) remove redudant comments on RoutingTable.cs (#2046) move changelog to 'To be released' section. (#2229) Co-authored-by: Seo Myunggyun (Jonathan) <tkiapril@users.noreply.github.com> Co-authored-by: Chanhyuck Ko <limeelbee@gmail.com>
- Loading branch information
1 parent
1ab3727
commit d05c843
Showing
3 changed files
with
56 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Libplanet.Net.Protocols | ||
{ | ||
public interface IRoutingTable | ||
{ | ||
/// <summary> | ||
/// The number of peers in the table. | ||
/// </summary> | ||
int Count { get; } | ||
|
||
/// <summary> | ||
/// An <see cref="IReadOnlyList{T}"/> of peers in the table. | ||
/// </summary> | ||
IReadOnlyList<BoundPeer> Peers { get; } | ||
|
||
/// <summary> | ||
/// Adds the <paramref name="peer"/> to the table. | ||
/// </summary> | ||
/// <param name="peer">The <see cref="BoundPeer"/> to add.</param> | ||
/// <exception cref="ArgumentException">Thrown when <paramref name="peer"/>'s | ||
/// <see cref="Address"/> is equal to the <see cref="Address"/> of self.</exception> | ||
void AddPeer(BoundPeer peer); | ||
|
||
/// <summary> | ||
/// Removes the <paramref name="peer"/> to the table. | ||
/// </summary> | ||
/// <param name="peer">The <see cref="BoundPeer"/> to remove.</param> | ||
/// <returns><see langword="true"/> if the <paramref name="peer"/> is successfully | ||
/// removed from <see cref="IRoutingTable"/>.</returns> | ||
/// <exception cref="ArgumentException">Thrown when <paramref name="peer"/>'s | ||
/// <see cref="Address"/> is equal to the <see cref="Address"/> of self.</exception> | ||
bool RemovePeer(BoundPeer peer); | ||
|
||
/// <summary> | ||
/// Determines whether the <see cref="IRoutingTable"/> contains the specified key. | ||
/// </summary> | ||
/// <param name="peer">Key to locate in the <see cref="IRoutingTable"/>.</param> | ||
/// <returns><see langword="true"/> if the <see cref="IRoutingTable" /> contains | ||
/// an element with the specified key; otherwise, <see langword="false"/>.</returns> | ||
bool Contains(BoundPeer peer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters