Documentation ¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type AcquireFunc
- type AcquiredFunc
- type CallbackConfig
- type DoneFunc
- type FailureFunc
- type LocalStateQuery
- type MsgAcquire
- type MsgAcquireNoPoint
- type MsgAcquired
- type MsgDone
- type MsgFailure
- type MsgQuery
- type MsgReAcquire
- type MsgReAcquireNoPoint
- type MsgRelease
- type MsgResult
- type Point
- type QueryFunc
- type ReAcquireFunc
- type ReleaseFunc
- type ResultFunc
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") )
View Source
var StateMap = protocol.StateMap{ STATE_IDLE: protocol.StateMapEntry{ Agency: protocol.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_ACQUIRE, NewState: STATE_ACQUIRING, }, { MsgType: MESSAGE_TYPE_ACQUIRE_NO_POINT, NewState: STATE_ACQUIRING, }, { MsgType: MESSAGE_TYPE_DONE, NewState: STATE_DONE, }, }, }, STATE_ACQUIRING: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_FAILURE, NewState: STATE_IDLE, }, { MsgType: MESSAGE_TYPE_ACQUIRED, NewState: STATE_ACQUIRED, }, }, }, STATE_ACQUIRED: protocol.StateMapEntry{ Agency: protocol.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_QUERY, NewState: STATE_QUERYING, }, { MsgType: MESSAGE_TYPE_REACQUIRE, NewState: STATE_ACQUIRING, }, { MsgType: MESSAGE_TYPE_REACQUIRE_NO_POINT, NewState: STATE_ACQUIRING, }, { MsgType: MESSAGE_TYPE_RELEASE, NewState: STATE_IDLE, }, }, }, STATE_QUERYING: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_RESULT, NewState: STATE_ACQUIRED, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AGENCY_NONE, }, }
Functions ¶
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 FailureFunc ¶
type FailureFunc func(interface{}) error
type LocalStateQuery ¶
func New ¶
func New(options protocol.ProtocolOptions) *LocalStateQuery
func (*LocalStateQuery) Start ¶ added in v0.14.0
func (l *LocalStateQuery) Start(callbackConfig *CallbackConfig)
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 ¶
func (*Point) UnmarshalCBOR ¶
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 ReAcquireFunc ¶
type ReAcquireFunc func(interface{}) error
type ReleaseFunc ¶
type ReleaseFunc func() error
type ResultFunc ¶
type ResultFunc func(interface{}) error
Click to show internal directories.
Click to hide internal directories.