Interface IProtocol
An interface of protocol to discover peers from the distributed network.
Namespace: Libplanet.Net.Protocols
Assembly: Libplanet.Net.dll
Syntax
public interface IProtocol
Methods
| Improve this Doc View SourceAddPeersAsync(IEnumerable<BoundPeer>, Nullable<TimeSpan>, CancellationToken)
Tries to add given peers
to routing table
by sending PingMsg.
Declaration
Task AddPeersAsync(IEnumerable<BoundPeer> peers, TimeSpan? timeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<BoundPeer> | peers | The peers to add. |
Nullable<TimeSpan> | timeout | A timeout of waiting for the reply of PingMsg
message sent to |
CancellationToken | cancellationToken | A cancellation token used to propagate notification that this operation should be canceled. |
Returns
Type | Description |
---|---|
Task | An awaitable task without value. |
BootstrapAsync(IEnumerable<BoundPeer>, Nullable<TimeSpan>, Int32, CancellationToken)
Conducts peer discovery for given bootstrapPeers
.
Declaration
Task BootstrapAsync(IEnumerable<BoundPeer> bootstrapPeers, TimeSpan? dialTimeout, int depth, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<BoundPeer> | bootstrapPeers | A IEnumerable<T> of BoundPeers to bootstrap. |
Nullable<TimeSpan> | dialTimeout | The timeout used when waiting a reply for either PingMsg or FindNeighborsMsg. If null is given, the task never halts by itself even no any response was given from the the target seed. |
Int32 | depth | Recursive operation depth to search peers from network. |
CancellationToken | cancellationToken | A cancellation token used to propagate notification that this operation should be canceled. |
Returns
Type | Description |
---|---|
Task | An awaitable task without value. |
CheckReplacementCacheAsync(CancellationToken)
Checks the Libplanet.Net.Protocols.KBucket in the RoutingTable and if there is an empty Libplanet.Net.Protocols.KBucket, fill it with BoundPeers in the Libplanet.Net.Protocols.KBucket.ReplacementCache.
Declaration
Task CheckReplacementCacheAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token used to propagate notification that this operation should be canceled. |
Returns
Type | Description |
---|---|
Task | An awaitable task without value. |
RebuildConnectionAsync(Int32, CancellationToken)
Reconstructs network connection between peers on network.
Declaration
Task RebuildConnectionAsync(int depth, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Int32 | depth | Recursive operation depth to search peers from network. |
CancellationToken | cancellationToken | A cancellation token used to propagate notification that this operation should be canceled. |
Returns
Type | Description |
---|---|
Task | An awaitable task without value. |
RefreshTableAsync(TimeSpan, CancellationToken)
Checks whether BoundPeers in RoutingTable is online by sending PingMsg.
Declaration
Task RefreshTableAsync(TimeSpan maxAge, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | maxAge | Maximum age of peer to validate. |
CancellationToken | cancellationToken | A cancellation token used to propagate notification that this operation should be canceled. |
Returns
Type | Description |
---|---|
Task | An awaitable task without value. |