localstatequery

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL_NAME        = "local-state-query"
	PROTOCOL_ID   uint16 = 7
)
View Source
const (
	MESSAGE_TYPE_ACQUIRE            = 0
	MESSAGE_TYPE_ACQUIRED           = 1
	MESSAGE_TYPE_FAILURE            = 2
	MESSAGE_TYPE_QUERY              = 3
	MESSAGE_TYPE_RESULT             = 4
	MESSAGE_TYPE_RELEASE            = 5
	MESSAGE_TYPE_REACQUIRE          = 6
	MESSAGE_TYPE_DONE               = 7
	MESSAGE_TYPE_ACQUIRE_NO_POINT   = 8
	MESSAGE_TYPE_REACQUIRE_NO_POINT = 9

	ACQUIRE_FAILURE_POINT_TOO_OLD      = 0
	ACQUIRE_FAILURE_POINT_NOT_ON_CHAIN = 1
)

Variables

View Source
var (
	STATE_IDLE      = protocol.NewState(1, "Idle")
	STATE_ACQUIRING = protocol.NewState(2, "Acquiring")
	STATE_ACQUIRED  = protocol.NewState(3, "Acquired")
	STATE_QUERYING  = protocol.NewState(4, "Querying")
	STATE_DONE      = protocol.NewState(5, "Done")
)

Functions

func NewMsgFromCbor

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

Types

type AcquireFunc

type AcquireFunc func(interface{}) error

Callback function types TODO: update callbacks

type AcquiredFunc

type AcquiredFunc func() error

type CallbackConfig

type CallbackConfig struct {
	AcquireFunc   AcquireFunc
	AcquiredFunc  AcquiredFunc
	FailureFunc   FailureFunc
	QueryFunc     QueryFunc
	ResultFunc    ResultFunc
	ReleaseFunc   ReleaseFunc
	ReAcquireFunc ReAcquireFunc
	DoneFunc      DoneFunc
}

type DoneFunc

type DoneFunc func() error

type FailureFunc

type FailureFunc func(interface{}) error

type LocalStateQuery

type LocalStateQuery struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

func New

func New(options protocol.ProtocolOptions, callbackConfig *CallbackConfig) *LocalStateQuery

type MsgAcquire

type MsgAcquire struct {
	protocol.MessageBase
	Point Point
}

func NewMsgAcquire

func NewMsgAcquire(point Point) *MsgAcquire

type MsgAcquireNoPoint

type MsgAcquireNoPoint struct {
	protocol.MessageBase
}

func NewMsgAcquireNoPoint

func NewMsgAcquireNoPoint() *MsgAcquireNoPoint

type MsgAcquired

type MsgAcquired struct {
	protocol.MessageBase
}

func NewMsgAcquired

func NewMsgAcquired() *MsgAcquired

type MsgDone

type MsgDone struct {
	protocol.MessageBase
}

func NewMsgDone

func NewMsgDone() *MsgDone

type MsgFailure

type MsgFailure struct {
	protocol.MessageBase
	Failure uint8
}

func NewMsgFailure

func NewMsgFailure(failure uint8) *MsgFailure

type MsgQuery

type MsgQuery struct {
	protocol.MessageBase
	Query interface{}
}

func NewMsgQuery

func NewMsgQuery(query interface{}) *MsgQuery

type MsgReAcquire

type MsgReAcquire struct {
	protocol.MessageBase
	Point Point
}

func NewMsgReAcquire

func NewMsgReAcquire(point Point) *MsgReAcquire

type MsgReAcquireNoPoint

type MsgReAcquireNoPoint struct {
	protocol.MessageBase
}

func NewMsgReAcquireNoPoint

func NewMsgReAcquireNoPoint() *MsgReAcquireNoPoint

type MsgRelease

type MsgRelease struct {
	protocol.MessageBase
}

func NewMsgRelease

func NewMsgRelease() *MsgRelease

type MsgResult

type MsgResult struct {
	protocol.MessageBase
	Result interface{}
}

func NewMsgResult

func NewMsgResult(result interface{}) *MsgResult

type Point

type Point struct {
	Slot uint64
	Hash []byte
}

func (*Point) UnmarshalCBOR

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 QueryFunc

type QueryFunc func(interface{}) error

type ReAcquireFunc

type ReAcquireFunc func(interface{}) error

type ReleaseFunc

type ReleaseFunc func() error

type ResultFunc

type ResultFunc func(interface{}) error

Jump to

Keyboard shortcuts

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