Documentation ¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type Client
- type Config
- type DoneFunc
- type InitFunc
- type MsgDone
- type MsgInit
- type MsgReplyTxIds
- type MsgReplyTxs
- type MsgRequestTxIds
- type MsgRequestTxs
- type ReplyTxIdsFunc
- type ReplyTxsFunc
- type RequestTxIdsFunc
- type RequestTxsFunc
- type Server
- type TxBody
- type TxId
- type TxIdAndSize
- type TxSubmission
- type TxSubmissionOptionFunc
- func WithDoneFunc(doneFunc DoneFunc) TxSubmissionOptionFunc
- func WithIdleTimeout(timeout time.Duration) TxSubmissionOptionFunc
- func WithInitFunc(initFunc InitFunc) TxSubmissionOptionFunc
- func WithReplyTxIdsFunc(replyTxIdsFunc ReplyTxIdsFunc) TxSubmissionOptionFunc
- func WithReplyTxsFunc(replyTxsFunc ReplyTxsFunc) TxSubmissionOptionFunc
- func WithRequestTxIdsFunc(requestTxIdsFunc RequestTxIdsFunc) TxSubmissionOptionFunc
- func WithRequestTxsFunc(requestTxsFunc RequestTxsFunc) TxSubmissionOptionFunc
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_INIT = 6 )
View Source
const ( PROTOCOL_NAME = "tx-submission" PROTOCOL_ID uint16 = 4 )
Variables ¶
View Source
var ( STATE_INIT = protocol.NewState(1, "Init") 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_INIT: protocol.StateMapEntry{ Agency: protocol.AgencyClient, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_INIT, NewState: STATE_IDLE, }, }, }, STATE_IDLE: protocol.StateMapEntry{ Agency: protocol.AgencyServer, 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.AgencyClient, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REPLY_TX_IDS, NewState: STATE_IDLE, }, { MsgType: MESSAGE_TYPE_DONE, NewState: STATE_DONE, }, }, }, STATE_TX_IDS_NONBLOCKING: protocol.StateMapEntry{ Agency: protocol.AgencyClient, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REPLY_TX_IDS, NewState: STATE_IDLE, }, }, }, STATE_TXS: protocol.StateMapEntry{ Agency: protocol.AgencyClient, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_REPLY_TXS, NewState: STATE_IDLE, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AgencyNone, }, }
Functions ¶
Types ¶
type Config ¶
type Config struct { RequestTxIdsFunc RequestTxIdsFunc ReplyTxIdsFunc ReplyTxIdsFunc RequestTxsFunc RequestTxsFunc ReplyTxsFunc ReplyTxsFunc DoneFunc DoneFunc InitFunc InitFunc IdleTimeout time.Duration }
func NewConfig ¶
func NewConfig(options ...TxSubmissionOptionFunc) Config
type MsgDone ¶
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶
func NewMsgDone() *MsgDone
type MsgInit ¶
type MsgInit struct {
protocol.MessageBase
}
func NewMsgInit ¶
func NewMsgInit() *MsgInit
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 ¶
type TxSubmission ¶
func New ¶
func New(protoOptions protocol.ProtocolOptions, cfg *Config) *TxSubmission
type TxSubmissionOptionFunc ¶
type TxSubmissionOptionFunc func(*Config)
func WithDoneFunc ¶
func WithDoneFunc(doneFunc DoneFunc) TxSubmissionOptionFunc
func WithIdleTimeout ¶
func WithIdleTimeout(timeout time.Duration) TxSubmissionOptionFunc
func WithInitFunc ¶
func WithInitFunc(initFunc InitFunc) TxSubmissionOptionFunc
func WithReplyTxIdsFunc ¶
func WithReplyTxIdsFunc(replyTxIdsFunc ReplyTxIdsFunc) TxSubmissionOptionFunc
func WithReplyTxsFunc ¶
func WithReplyTxsFunc(replyTxsFunc ReplyTxsFunc) TxSubmissionOptionFunc
func WithRequestTxIdsFunc ¶
func WithRequestTxIdsFunc(requestTxIdsFunc RequestTxIdsFunc) TxSubmissionOptionFunc
func WithRequestTxsFunc ¶
func WithRequestTxsFunc(requestTxsFunc RequestTxsFunc) TxSubmissionOptionFunc
Click to show internal directories.
Click to hide internal directories.