Documentation ¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type CallbackConfig
- type DoneFunc
- type HelloFunc
- type MsgDone
- type MsgHello
- type MsgReplyTxIds
- type MsgReplyTxs
- type MsgRequestTxIds
- type MsgRequestTxs
- type ReplyTxIdsFunc
- type ReplyTxsFunc
- type RequestTxIdsFunc
- type RequestTxsFunc
- type TxBody
- type TxId
- type TxIdAndSize
- type TxSubmission
Constants ¶
View Source
const ( MESSAGE_TYPE_REQUEST_TX_IDS = 0 MESSAGE_TYPE_REPLY_TX_IDS = 1 MESSAGE_TYPE_REQUEST_TXS = 2 MESSAGE_TYPE_REPLY_TXS = 3 MESSAGE_TYPE_DONE = 4 MESSAGE_TYPE_HELLO = 6 )
View Source
const ( PROTOCOL_NAME = "tx-submission" PROTOCOL_ID uint16 = 4 )
Variables ¶
View Source
var ( STATE_HELLO = protocol.NewState(1, "Hello") STATE_IDLE = protocol.NewState(2, "Idle") STATE_TX_IDS_BLOCKING = protocol.NewState(3, "TxIdsBlocking") STATE_TX_IDS_NONBLOCKING = protocol.NewState(4, "TxIdsNonBlocking") STATE_TXS = protocol.NewState(5, "Txs") STATE_DONE = protocol.NewState(6, "Done") )
View Source
var StateMap = protocol.StateMap{ STATE_HELLO: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_HELLO, NewState: STATE_IDLE, }, }, }, STATE_IDLE: protocol.StateMapEntry{ Agency: protocol.AGENCY_SERVER, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REQUEST_TX_IDS, NewState: STATE_TX_IDS_BLOCKING, MatchFunc: func(msg protocol.Message) bool { msgRequestTxIds := msg.(*MsgRequestTxIds) return msgRequestTxIds.Blocking }, }, { MsgType: MESSAGE_TYPE_REQUEST_TX_IDS, NewState: STATE_TX_IDS_NONBLOCKING, MatchFunc: func(msg protocol.Message) bool { msgRequestTxIds := msg.(*MsgRequestTxIds) return !msgRequestTxIds.Blocking }, }, { MsgType: MESSAGE_TYPE_REQUEST_TXS, NewState: STATE_TXS, }, }, }, STATE_TX_IDS_BLOCKING: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REPLY_TX_IDS, NewState: STATE_IDLE, }, }, }, STATE_TX_IDS_NONBLOCKING: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REPLY_TX_IDS, NewState: STATE_IDLE, }, }, }, STATE_TXS: protocol.StateMapEntry{ Agency: protocol.AGENCY_CLIENT, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REPLY_TXS, NewState: STATE_IDLE, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AGENCY_NONE, }, }
Functions ¶
Types ¶
type CallbackConfig ¶
type CallbackConfig struct { RequestTxIdsFunc RequestTxIdsFunc ReplyTxIdsFunc ReplyTxIdsFunc RequestTxsFunc RequestTxsFunc ReplyTxsFunc ReplyTxsFunc DoneFunc DoneFunc HelloFunc HelloFunc }
type MsgDone ¶
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶
func NewMsgDone() *MsgDone
type MsgHello ¶
type MsgHello struct {
protocol.MessageBase
}
func NewMsgHello ¶
func NewMsgHello() *MsgHello
type MsgReplyTxIds ¶
type MsgReplyTxIds struct { protocol.MessageBase TxIds []TxIdAndSize }
func NewMsgReplyTxIds ¶
func NewMsgReplyTxIds(txIds []TxIdAndSize) *MsgReplyTxIds
type MsgReplyTxs ¶
type MsgReplyTxs struct { protocol.MessageBase Txs []TxBody }
func NewMsgReplyTxs ¶
func NewMsgReplyTxs(txs []TxBody) *MsgReplyTxs
type MsgRequestTxIds ¶
type MsgRequestTxIds struct { protocol.MessageBase Blocking bool Ack uint16 Req uint16 }
func NewMsgRequestTxIds ¶
func NewMsgRequestTxIds(blocking bool, ack uint16, req uint16) *MsgRequestTxIds
type MsgRequestTxs ¶
type MsgRequestTxs struct { protocol.MessageBase TxIds []TxId }
func NewMsgRequestTxs ¶
func NewMsgRequestTxs(txIds []TxId) *MsgRequestTxs
type ReplyTxIdsFunc ¶
type ReplyTxIdsFunc func(interface{}) error
type ReplyTxsFunc ¶
type ReplyTxsFunc func(interface{}) error
type RequestTxIdsFunc ¶
Callback function types
type RequestTxsFunc ¶
type RequestTxsFunc func(interface{}) error
type TxIdAndSize ¶ added in v0.12.1
type TxSubmission ¶
func New ¶
func New(options protocol.ProtocolOptions, callbackConfig *CallbackConfig) *TxSubmission
Click to show internal directories.
Click to hide internal directories.