Documentation
¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(protoMode protocol.ProtocolMode, msgType uint, data []byte) (protocol.Message, error)
- func NewMsgFromCborNtC(msgType uint, data []byte) (protocol.Message, error)
- func NewMsgFromCborNtN(msgType uint, data []byte) (protocol.Message, error)
- type ChainSync
- type ChainSyncAwaitReplyFunc
- type ChainSyncCallbackConfig
- type ChainSyncDoneFunc
- type ChainSyncIntersectFoundFunc
- type ChainSyncIntersectNotFoundFunc
- type ChainSyncRollBackwardFunc
- type ChainSyncRollForwardFunc
- type MsgAwaitReply
- type MsgDone
- type MsgFindIntersect
- type MsgIntersectFound
- type MsgIntersectNotFound
- type MsgRequestNext
- type MsgRollBackward
- type MsgRollForwardNtC
- type MsgRollForwardNtN
- type Point
- type Tip
- type WrappedBlock
- type WrappedHeader
- type WrappedHeaderByron
Constants ¶
View Source
const ( PROTOCOL_NAME = "chain-sync" PROTOCOL_ID_NTN uint16 = 2 PROTOCOL_ID_NTC uint16 = 5 )
View Source
const ( MESSAGE_TYPE_REQUEST_NEXT = 0 MESSAGE_TYPE_AWAIT_REPLY = 1 MESSAGE_TYPE_ROLL_FORWARD = 2 MESSAGE_TYPE_ROLL_BACKWARD = 3 MESSAGE_TYPE_FIND_INTERSECT = 4 MESSAGE_TYPE_INTERSECT_FOUND = 5 MESSAGE_TYPE_INTERSECT_NOT_FOUND = 6 MESSAGE_TYPE_DONE = 7 )
Variables ¶
View Source
var ( STATE_IDLE = protocol.NewState(1, "Idle") STATE_CAN_AWAIT = protocol.NewState(2, "CanAwait") STATE_MUST_REPLY = protocol.NewState(3, "MustReply") STATE_INTERSECT = protocol.NewState(4, "Intersect") STATE_DONE = protocol.NewState(5, "Done") )
View Source
var StateMap = protocol.StateMap{ STATE_IDLE: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REQUEST_NEXT, NewState: STATE_CAN_AWAIT, }, { MsgType: MESSAGE_TYPE_FIND_INTERSECT, NewState: STATE_INTERSECT, }, { MsgType: MESSAGE_TYPE_DONE, NewState: STATE_DONE, }, }, }, STATE_CAN_AWAIT: protocol.StateMapEntry{ Agency: protocol.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_AWAIT_REPLY, NewState: STATE_MUST_REPLY, }, { MsgType: MESSAGE_TYPE_ROLL_FORWARD, NewState: STATE_IDLE, }, { MsgType: MESSAGE_TYPE_ROLL_BACKWARD, NewState: STATE_IDLE, }, }, }, STATE_INTERSECT: protocol.StateMapEntry{ Agency: protocol.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_INTERSECT_FOUND, NewState: STATE_IDLE, }, { MsgType: MESSAGE_TYPE_INTERSECT_NOT_FOUND, NewState: STATE_IDLE, }, }, }, STATE_MUST_REPLY: protocol.StateMapEntry{ Agency: protocol.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_ROLL_FORWARD, NewState: STATE_IDLE, }, { MsgType: MESSAGE_TYPE_ROLL_BACKWARD, NewState: STATE_IDLE, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AGENCY_NONE, }, }
Functions ¶
func NewMsgFromCbor ¶ added in v0.10.0
func NewMsgFromCborNtC ¶ added in v0.10.0
Types ¶
type ChainSync ¶
type ChainSync struct {
// contains filtered or unexported fields
}
func New ¶
func New(options protocol.ProtocolOptions, callbackConfig *ChainSyncCallbackConfig) *ChainSync
func (*ChainSync) FindIntersect ¶
func (*ChainSync) RequestNext ¶
type ChainSyncCallbackConfig ¶
type ChainSyncCallbackConfig struct { AwaitReplyFunc ChainSyncAwaitReplyFunc RollBackwardFunc ChainSyncRollBackwardFunc RollForwardFunc ChainSyncRollForwardFunc IntersectFoundFunc ChainSyncIntersectFoundFunc IntersectNotFoundFunc ChainSyncIntersectNotFoundFunc DoneFunc ChainSyncDoneFunc }
type ChainSyncDoneFunc ¶
type ChainSyncDoneFunc func() error
type ChainSyncIntersectFoundFunc ¶
type ChainSyncIntersectFoundFunc func(interface{}, interface{}) error
type ChainSyncIntersectNotFoundFunc ¶
type ChainSyncIntersectNotFoundFunc func(interface{}) error
type ChainSyncRollBackwardFunc ¶
type ChainSyncRollBackwardFunc func(interface{}, interface{}) error
type MsgAwaitReply ¶ added in v0.10.0
type MsgAwaitReply struct {
protocol.MessageBase
}
type MsgDone ¶ added in v0.10.0
type MsgDone struct {
protocol.MessageBase
}
type MsgFindIntersect ¶ added in v0.10.0
type MsgFindIntersect struct { protocol.MessageBase Points []interface{} }
func NewMsgFindIntersect ¶ added in v0.10.0
func NewMsgFindIntersect(points []interface{}) *MsgFindIntersect
type MsgIntersectFound ¶ added in v0.10.0
type MsgIntersectFound struct { protocol.MessageBase Point Point Tip Tip }
type MsgIntersectNotFound ¶ added in v0.10.0
type MsgIntersectNotFound struct { protocol.MessageBase Tip Tip }
type MsgRequestNext ¶ added in v0.10.0
type MsgRequestNext struct {
protocol.MessageBase
}
func NewMsgRequestNext ¶ added in v0.10.0
func NewMsgRequestNext() *MsgRequestNext
type MsgRollBackward ¶ added in v0.10.0
type MsgRollBackward struct { protocol.MessageBase Point Point Tip Tip }
type MsgRollForwardNtC ¶ added in v0.10.0
type MsgRollForwardNtC struct { protocol.MessageBase WrappedData []byte Tip Tip }
type MsgRollForwardNtN ¶ added in v0.10.0
type MsgRollForwardNtN struct { protocol.MessageBase WrappedHeader WrappedHeader Tip Tip }
type Point ¶ added in v0.10.0
func (*Point) UnmarshalCBOR ¶ added in v0.10.0
A "point" can sometimes be empty, but the CBOR library gets grumpy about this when doing automatic decoding from an array, so we have to handle this case specially
type WrappedBlock ¶ added in v0.10.0
type WrappedBlock struct { Type uint RawBlock cbor.RawMessage // contains filtered or unexported fields }
type WrappedHeader ¶ added in v0.10.0
type WrappedHeader struct { Type uint RawData cbor.RawMessage // contains filtered or unexported fields }
type WrappedHeaderByron ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.