Skip to content

Commit

Permalink
doc: add comments to SnapshotClient
Browse files Browse the repository at this point in the history
  • Loading branch information
shotonoff committed Jul 26, 2023
1 parent c663621 commit bb7dd48
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/p2p/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,37 @@ type (
}
// SnapshotClient defines the methods which must be implemented by snapshot client
SnapshotClient interface {
// GetSnapshots requests a list of available snapshots from a peer without handling the response.
// The snapshots will be sent by peer asynchronously and should be received by reading the channel separately.
// The method returns an error if the request is not possible to send to the peer.
GetSnapshots(ctx context.Context, peerID types.NodeID) error
// GetChunk requests a snapshot chunk from a peer and returns a promise.Promise which will be resolved
// as a response will be received or rejected by timeout, otherwise returns an error
GetChunk(
ctx context.Context,
peerID types.NodeID,
height uint64,
format uint32,
index uint32,
) (*promise.Promise[*statesync.ChunkResponse], error)
// GetParams requests a snapshot params from a peer.
// The method returns a promise.Promise which will be resolved.
GetParams(
ctx context.Context,
peerID types.NodeID,
height uint64,
) (*promise.Promise[*statesync.ParamsResponse], error)
// GetLightBlock requests a light block from a peer.
// The method returns a promise.Promise which will be resolved.
GetLightBlock(
ctx context.Context,
peerID types.NodeID,
height uint64,
) (*promise.Promise[*statesync.LightBlockResponse], error)
}
// TxSender is the interface that wraps SendTxs method
TxSender interface {
// SendTxs sends a transaction to a peer
SendTxs(ctx context.Context, peerID types.NodeID, tx types.Tx) error
}
// Client is a stateful implementation of a client, which means that the client stores a request ID
Expand Down

0 comments on commit bb7dd48

Please sign in to comment.