chainsync

package
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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")
)

Functions

func NewMsgFromCbor added in v0.10.0

func NewMsgFromCbor(protoMode protocol.ProtocolMode, msgType uint, data []byte) (protocol.Message, error)

func NewMsgFromCborNtC added in v0.10.0

func NewMsgFromCborNtC(msgType uint, data []byte) (protocol.Message, error)

func NewMsgFromCborNtN added in v0.10.0

func NewMsgFromCborNtN(msgType uint, data []byte) (protocol.Message, error)

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 (c *ChainSync) FindIntersect(points []interface{}) error

func (*ChainSync) RequestNext

func (c *ChainSync) RequestNext() error

type ChainSyncAwaitReplyFunc

type ChainSyncAwaitReplyFunc func() error

Callback function types

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 ChainSyncRollForwardFunc

type ChainSyncRollForwardFunc func(uint, 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

type Point struct {
	Slot uint64
	Hash []byte
}

func (*Point) UnmarshalCBOR added in v0.10.0

func (p *Point) UnmarshalCBOR(data []byte) error

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 Tip added in v0.10.0

type Tip struct {
	Point       Point
	BlockNumber uint64
	// contains filtered or unexported fields
}

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

type WrappedHeaderByron struct {
	Unknown struct {
		Type    uint
		Unknown uint64
		// contains filtered or unexported fields
	}
	RawHeader []byte
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL