Documentation ¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type BlockFetch
- type BlockFetchBatchDoneFunc
- type BlockFetchBlockFunc
- type BlockFetchCallbackConfig
- type BlockFetchNoBlocksFunc
- type BlockFetchStartBatchFunc
- type MsgBatchDone
- type MsgBlock
- type MsgClientDone
- type MsgNoBlocks
- type MsgRequestRange
- type MsgStartBatch
- 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.AGENCY_CLIENT, 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.AGENCY_SERVER, 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.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_BLOCK, NewState: STATE_STREAMING, }, { MsgType: MESSAGE_TYPE_BATCH_DONE, NewState: STATE_IDLE, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AGENCY_NONE, }, }
Functions ¶
Types ¶
type BlockFetch ¶
func New ¶
func New(options protocol.ProtocolOptions, callbackConfig *BlockFetchCallbackConfig) *BlockFetch
func (*BlockFetch) ClientDone ¶
func (b *BlockFetch) ClientDone() error
func (*BlockFetch) RequestRange ¶
func (b *BlockFetch) RequestRange(start []interface{}, end []interface{}) error
type BlockFetchBatchDoneFunc ¶
type BlockFetchBatchDoneFunc func() error
type BlockFetchBlockFunc ¶
type BlockFetchCallbackConfig ¶
type BlockFetchCallbackConfig struct { StartBatchFunc BlockFetchStartBatchFunc NoBlocksFunc BlockFetchNoBlocksFunc BlockFunc BlockFetchBlockFunc BatchDoneFunc BlockFetchBatchDoneFunc }
type BlockFetchNoBlocksFunc ¶
type BlockFetchNoBlocksFunc func() error
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 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.