Class Swarm<T>
Assembly: Libplanet.dll
Syntax
public class Swarm<T>
where T : IAction, new()
Type Parameters
Constructors
|
Improve this Doc
View Source
Swarm(BlockChain<T>, PrivateKey, Int32, Int32, Int32, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<IceServer>, EventHandler<DifferentProtocolVersionEventArgs>)
Declaration
public Swarm(BlockChain<T> blockChain, PrivateKey privateKey, int appProtocolVersion, int millisecondsDialTimeout = 15000, int millisecondsLinger = 1000, string host = null, int? listenPort = default(int? ), DateTimeOffset? createdAt = default(DateTimeOffset? ), IEnumerable<IceServer> iceServers = null, EventHandler<DifferentProtocolVersionEventArgs> differentVersionPeerEncountered = null)
Parameters
|
Improve this Doc
View Source
Swarm(BlockChain<T>, PrivateKey, Int32, TimeSpan, TimeSpan, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<IceServer>, EventHandler<DifferentProtocolVersionEventArgs>)
Declaration
public Swarm(BlockChain<T> blockChain, PrivateKey privateKey, int appProtocolVersion, TimeSpan dialTimeout, TimeSpan linger, string host = null, int? listenPort = default(int? ), DateTimeOffset? createdAt = default(DateTimeOffset? ), IEnumerable<IceServer> iceServers = null, EventHandler<DifferentProtocolVersionEventArgs> differentVersionPeerEncountered = null)
Parameters
Properties
|
Improve this Doc
View Source
Address
Declaration
public Address Address { get; }
Property Value
|
Improve this Doc
View Source
AsPeer
Declaration
public Peer AsPeer { get; }
Property Value
|
Improve this Doc
View Source
BlockReceived
Declaration
public AsyncAutoResetEvent BlockReceived { get; }
Property Value
Type |
Description |
Nito.AsyncEx.AsyncAutoResetEvent |
|
|
Improve this Doc
View Source
DeltaDistributed
Declaration
public AsyncAutoResetEvent DeltaDistributed { get; }
Property Value
Type |
Description |
Nito.AsyncEx.AsyncAutoResetEvent |
|
|
Improve this Doc
View Source
DeltaReceived
Declaration
public AsyncAutoResetEvent DeltaReceived { get; }
Property Value
Type |
Description |
Nito.AsyncEx.AsyncAutoResetEvent |
|
|
Improve this Doc
View Source
EndPoint
Declaration
public DnsEndPoint EndPoint { get; }
Property Value
|
Improve this Doc
View Source
LastDistributed
Declaration
public DateTimeOffset LastDistributed { get; }
Property Value
|
Improve this Doc
View Source
LastReceived
Declaration
public DateTimeOffset LastReceived { get; }
Property Value
|
Improve this Doc
View Source
LastSeenTimestamps
Declaration
public IDictionary<Peer, DateTimeOffset> LastSeenTimestamps { get; }
Property Value
|
Improve this Doc
View Source
Running
Whether this Swarm<T> instance is running.
Declaration
public bool Running { get; }
Property Value
|
Improve this Doc
View Source
TxReceived
Declaration
public AsyncAutoResetEvent TxReceived { get; }
Property Value
Type |
Description |
Nito.AsyncEx.AsyncAutoResetEvent |
|
Methods
|
Improve this Doc
View Source
AddPeersAsync(IEnumerable<Peer>, Nullable<DateTimeOffset>, CancellationToken)
Declaration
public Task<ISet<Peer>> AddPeersAsync(IEnumerable<Peer> peers, DateTimeOffset? timestamp = default(DateTimeOffset? ), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
BroadcastBlocks(IEnumerable<Block<T>>)
Declaration
public void BroadcastBlocks(IEnumerable<Block<T>> blocks)
Parameters
|
Improve this Doc
View Source
BroadcastTxs(IEnumerable<Transaction<T>>)
Declaration
public void BroadcastTxs(IEnumerable<Transaction<T>> txs)
Parameters
|
Improve this Doc
View Source
Finalize()
Declaration
protected void Finalize()
|
Improve this Doc
View Source
PreloadAsync(IProgress<BlockDownloadState>, CancellationToken)
Preemptively downloads blocks from registered Peers.
Declaration
public Task PreloadAsync(IProgress<BlockDownloadState> progress = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
IProgress<BlockDownloadState> |
progress |
An instance that receives progress updates for block downloads.
|
CancellationToken |
cancellationToken |
A cancellation token used to propagate notification that this
operation should be canceled.
|
Returns
Type |
Description |
Task |
A task without value.
You only can await until the method is completed.
|
|
Improve this Doc
View Source
StartAsync(Int32, Int32, CancellationToken)
Declaration
public Task StartAsync(int millisecondsDistributeInterval = 1500, int millisecondsBroadcastTxInterval = 5000, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
StartAsync(TimeSpan, TimeSpan, CancellationToken)
Declaration
public Task StartAsync(TimeSpan distributeInterval, TimeSpan broadcastTxInterval, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
StopAsync(CancellationToken)
Declaration
public Task StopAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
WaitForRunningAsync()
Waits until this Swarm<T> instance gets started to run.
Declaration
public Task WaitForRunningAsync()
Returns
Events
|
Improve this Doc
View Source
DifferentVersionPeerEncountered
Declaration
public event EventHandler<DifferentProtocolVersionEventArgs> DifferentVersionPeerEncountered
Event Type