Documentation
¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type BatchDoneFunc
- type BlockFetch
- type BlockFetchOptionFunc
- func WithBatchDoneFunc(BatchDoneFunc BatchDoneFunc) BlockFetchOptionFunc
- func WithBatchStartTimeout(timeout time.Duration) BlockFetchOptionFunc
- func WithBlockFunc(blockFunc BlockFunc) BlockFetchOptionFunc
- func WithBlockTimeout(timeout time.Duration) BlockFetchOptionFunc
- func WithNoBlocksFunc(noBlocksFunc NoBlocksFunc) BlockFetchOptionFunc
- func WithStartBatchFunc(startBatchFunc StartBatchFunc) BlockFetchOptionFunc
- type BlockFunc
- type Client
- type Config
- type MsgBatchDone
- type MsgBlock
- type MsgClientDone
- type MsgNoBlocks
- type MsgRequestRange
- type MsgStartBatch
- type NoBlocksFunc
- type Server
- type StartBatchFunc
- type WrappedBlock
Constants ¶
View Source
const ( PROTOCOL_NAME = "block-fetch" PROTOCOL_ID uint16 = 3 )
View Source
const ( MESSAGE_TYPE_REQUEST_RANGE = 0 MESSAGE_TYPE_CLIENT_DONE = 1 MESSAGE_TYPE_START_BATCH = 2 MESSAGE_TYPE_NO_BLOCKS = 3 MESSAGE_TYPE_BLOCK = 4 MESSAGE_TYPE_BATCH_DONE = 5 )
Variables ¶
View Source
var ( STATE_IDLE = protocol.NewState(1, "Idle") STATE_BUSY = protocol.NewState(2, "Busy") STATE_STREAMING = protocol.NewState(3, "Streaming") STATE_DONE = protocol.NewState(4, "Done") )
View Source
var StateMap = protocol.StateMap{ STATE_IDLE: protocol.StateMapEntry{ Agency: protocol.AgencyClient, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REQUEST_RANGE, NewState: STATE_BUSY, }, { MsgType: MESSAGE_TYPE_CLIENT_DONE, NewState: STATE_DONE, }, }, }, STATE_BUSY: protocol.StateMapEntry{ Agency: protocol.AgencyServer, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_START_BATCH, NewState: STATE_STREAMING, }, { MsgType: MESSAGE_TYPE_NO_BLOCKS, NewState: STATE_IDLE, }, }, }, STATE_STREAMING: protocol.StateMapEntry{ Agency: protocol.AgencyServer, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_BLOCK, NewState: STATE_STREAMING, }, { MsgType: MESSAGE_TYPE_BATCH_DONE, NewState: STATE_IDLE, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AgencyNone, }, }
Functions ¶
Types ¶
type BatchDoneFunc ¶ added in v0.18.0
type BatchDoneFunc func() error
type BlockFetch ¶
func New ¶
func New(protoOptions protocol.ProtocolOptions, cfg *Config) *BlockFetch
type BlockFetchOptionFunc ¶ added in v0.25.0
type BlockFetchOptionFunc func(*Config)
func WithBatchDoneFunc ¶ added in v0.25.0
func WithBatchDoneFunc(BatchDoneFunc BatchDoneFunc) BlockFetchOptionFunc
func WithBatchStartTimeout ¶ added in v0.25.0
func WithBatchStartTimeout(timeout time.Duration) BlockFetchOptionFunc
func WithBlockFunc ¶ added in v0.25.0
func WithBlockFunc(blockFunc BlockFunc) BlockFetchOptionFunc
func WithBlockTimeout ¶ added in v0.25.0
func WithBlockTimeout(timeout time.Duration) BlockFetchOptionFunc
func WithNoBlocksFunc ¶ added in v0.25.0
func WithNoBlocksFunc(noBlocksFunc NoBlocksFunc) BlockFetchOptionFunc
func WithStartBatchFunc ¶ added in v0.25.0
func WithStartBatchFunc(startBatchFunc StartBatchFunc) BlockFetchOptionFunc
type Client ¶ added in v0.19.0
func NewClient ¶ added in v0.19.0
func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client
func (*Client) ClientDone ¶ added in v0.19.0
func (*Client) RequestRange ¶ added in v0.19.0
type Config ¶ added in v0.18.0
type Config struct { StartBatchFunc StartBatchFunc NoBlocksFunc NoBlocksFunc BlockFunc BlockFunc BatchDoneFunc BatchDoneFunc BatchStartTimeout time.Duration BlockTimeout time.Duration }
func NewConfig ¶ added in v0.25.0
func NewConfig(options ...BlockFetchOptionFunc) Config
type MsgBatchDone ¶ added in v0.10.0
type MsgBatchDone struct {
protocol.MessageBase
}
func NewMsgBatchDone ¶ added in v0.12.1
func NewMsgBatchDone() *MsgBatchDone
type MsgBlock ¶ added in v0.10.0
type MsgBlock struct { protocol.MessageBase WrappedBlock []byte }
func NewMsgBlock ¶ added in v0.12.1
type MsgClientDone ¶ added in v0.10.0
type MsgClientDone struct {
protocol.MessageBase
}
func NewMsgClientDone ¶ added in v0.10.0
func NewMsgClientDone() *MsgClientDone
type MsgNoBlocks ¶ added in v0.10.0
type MsgNoBlocks struct {
protocol.MessageBase
}
func NewMsgNoBlocks ¶ added in v0.12.1
func NewMsgNoBlocks() *MsgNoBlocks
type MsgRequestRange ¶ added in v0.10.0
type MsgRequestRange struct { protocol.MessageBase Start interface{} //point End interface{} //point }
func NewMsgRequestRange ¶ added in v0.10.0
func NewMsgRequestRange(start interface{}, end interface{}) *MsgRequestRange
type MsgStartBatch ¶ added in v0.10.0
type MsgStartBatch struct {
protocol.MessageBase
}
func NewMsgStartBatch ¶ added in v0.12.1
func NewMsgStartBatch() *MsgStartBatch
type NoBlocksFunc ¶ added in v0.18.0
type NoBlocksFunc func() error
type WrappedBlock ¶ added in v0.10.0
type WrappedBlock struct { Type uint RawBlock cbor.RawMessage // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.