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 AwaitReplyFunc
- type ChainSync
- type Client
- type Config
- type DoneFunc
- type IntersectFoundFunc
- type IntersectNotFoundFunc
- type MsgAwaitReply
- type MsgDone
- type MsgFindIntersect
- type MsgIntersectFound
- type MsgIntersectNotFound
- type MsgRequestNext
- type MsgRollBackward
- type MsgRollForwardNtC
- type MsgRollForwardNtN
- type Point
- type RollBackwardFunc
- type RollForwardFunc
- type Server
- type Tip
- type WrappedBlock
- type WrappedHeader
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 Client ¶ added in v0.19.0
func NewClient ¶ added in v0.19.0
func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client
func (*Client) FindIntersect ¶ added in v0.19.0
func (*Client) RequestNext ¶ added in v0.19.0
type Config ¶ added in v0.18.0
type Config struct { AwaitReplyFunc AwaitReplyFunc RollBackwardFunc RollBackwardFunc RollForwardFunc RollForwardFunc IntersectFoundFunc IntersectFoundFunc IntersectNotFoundFunc IntersectNotFoundFunc DoneFunc DoneFunc }
type IntersectFoundFunc ¶ added in v0.18.0
type IntersectFoundFunc func(interface{}, interface{}) error
type IntersectNotFoundFunc ¶ added in v0.18.0
type IntersectNotFoundFunc func(interface{}) error
type MsgAwaitReply ¶ added in v0.10.0
type MsgAwaitReply struct {
protocol.MessageBase
}
func NewMsgAwaitReply ¶ added in v0.12.1
func NewMsgAwaitReply() *MsgAwaitReply
type MsgDone ¶ added in v0.10.0
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶ added in v0.12.1
func NewMsgDone() *MsgDone
type MsgFindIntersect ¶ added in v0.10.0
type MsgFindIntersect struct { protocol.MessageBase Points []Point }
func NewMsgFindIntersect ¶ added in v0.10.0
func NewMsgFindIntersect(points []Point) *MsgFindIntersect
type MsgIntersectFound ¶ added in v0.10.0
type MsgIntersectFound struct { protocol.MessageBase Point Point Tip Tip }
func NewMsgIntersectFound ¶ added in v0.12.1
func NewMsgIntersectFound(point Point, tip Tip) *MsgIntersectFound
type MsgIntersectNotFound ¶ added in v0.10.0
type MsgIntersectNotFound struct { protocol.MessageBase Tip Tip }
func NewMsgIntersectNotFound ¶ added in v0.12.1
func NewMsgIntersectNotFound(tip Tip) *MsgIntersectNotFound
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 }
func NewMsgRollBackward ¶ added in v0.12.1
func NewMsgRollBackward(point Point, tip Tip) *MsgRollBackward
type MsgRollForwardNtC ¶ added in v0.10.0
type MsgRollForwardNtC struct { protocol.MessageBase WrappedBlock cbor.Tag Tip Tip // contains filtered or unexported fields }
func NewMsgRollForwardNtC ¶ added in v0.12.1
func NewMsgRollForwardNtC(blockType uint, blockCbor []byte, tip Tip) *MsgRollForwardNtC
func (*MsgRollForwardNtC) BlockCbor ¶ added in v0.13.1
func (m *MsgRollForwardNtC) BlockCbor() []byte
func (*MsgRollForwardNtC) BlockType ¶ added in v0.13.1
func (m *MsgRollForwardNtC) BlockType() uint
type MsgRollForwardNtN ¶ added in v0.10.0
type MsgRollForwardNtN struct { protocol.MessageBase WrappedHeader WrappedHeader Tip Tip }
func NewMsgRollForwardNtN ¶ added in v0.12.1
func NewMsgRollForwardNtN(era uint, byronType uint, blockCbor []byte, tip Tip) *MsgRollForwardNtN
type Point ¶ added in v0.10.0
func (*Point) MarshalCBOR ¶ added in v0.13.1
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 RollBackwardFunc ¶ added in v0.18.0
type RollBackwardFunc func(interface{}, interface{}) error
type RollForwardFunc ¶ added in v0.18.0
type WrappedBlock ¶ added in v0.10.0
type WrappedBlock struct { BlockType uint BlockCbor cbor.RawMessage // contains filtered or unexported fields }
func NewWrappedBlock ¶ added in v0.13.1
func NewWrappedBlock(blockType uint, blockCbor []byte) *WrappedBlock
type WrappedHeader ¶ added in v0.10.0
type WrappedHeader struct { Era uint RawMessage cbor.RawMessage // contains filtered or unexported fields }
func NewWrappedHeader ¶ added in v0.13.1
func NewWrappedHeader(era uint, byronType uint, blockCbor []byte) *WrappedHeader
func (*WrappedHeader) ByronType ¶ added in v0.13.1
func (w *WrappedHeader) ByronType() uint
func (*WrappedHeader) HeaderCbor ¶ added in v0.13.1
func (w *WrappedHeader) HeaderCbor() []byte
func (*WrappedHeader) MarshalCBOR ¶ added in v0.13.1
func (w *WrappedHeader) MarshalCBOR() ([]byte, error)
func (*WrappedHeader) UnmarshalCBOR ¶ added in v0.13.1
func (w *WrappedHeader) UnmarshalCBOR(data []byte) error
Click to show internal directories.
Click to hide internal directories.