Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package localtxmonitor implements the Ouroboros local-tx-monitor protocol
Index ¶
- Constants
 - Variables
 - func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
 - type CallbackContext
 - type Client
 - type Config
 - type GetMempoolFunc
 - type LocalTxMonitor
 - type LocalTxMonitorOptionFunc
 - type MsgAcquire
 - type MsgAcquired
 - type MsgDone
 - type MsgGetSizes
 - type MsgHasTx
 - type MsgNextTx
 - type MsgRelease
 - type MsgReplyGetSizes
 - type MsgReplyGetSizesResult
 - type MsgReplyHasTx
 - type MsgReplyNextTx
 - type MsgReplyNextTxTransaction
 - type Server
 - type TxAndEraId
 
Constants ¶
const ( ProtocolName = "local-tx-monitor" ProtocolId uint16 = 9 )
Protocol identifiers
const ( MessageTypeDone = 0 MessageTypeAcquire = 1 MessageTypeAcquired = 2 MessageTypeRelease = 3 MessageTypeNextTx = 5 MessageTypeReplyNextTx = 6 MessageTypeHasTx = 7 MessageTypeReplyHasTx = 8 MessageTypeGetSizes = 9 MessageTypeReplyGetSizes = 10 )
Message types
Variables ¶
var StateMap = protocol.StateMap{ // contains filtered or unexported fields }
LocalTxMonitor protocol state machine
Functions ¶
Types ¶
type CallbackContext ¶ added in v0.78.0
type CallbackContext struct {
	ConnectionId connection.ConnectionId
	Client       *Client
	Server       *Server
}
    Callback context
type Client ¶
Client implements the LocalTxMonitor client
func NewClient ¶
func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client
NewClient returns a new LocalTxMonitor client object
func (*Client) GetSizes ¶
GetSizes returns the capacity (in bytes), size (in bytes), and number of transactions in the mempool snapshot
func (*Client) HasTx ¶
HasTx returns whether or not the specified transaction ID exists in the mempool snapshot
type Config ¶
type Config struct {
	GetMempoolFunc GetMempoolFunc
	AcquireTimeout time.Duration
	QueryTimeout   time.Duration
}
    Config is used to configure the LocalTxMonitor protocol instance
func NewConfig ¶
func NewConfig(options ...LocalTxMonitorOptionFunc) Config
NewConfig returns a new LocalTxMonitor config object with the provided options
type GetMempoolFunc ¶ added in v0.60.0
type GetMempoolFunc func(CallbackContext) (uint64, uint32, []TxAndEraId, error)
Callback function types
type LocalTxMonitor ¶
LocalTxMonitor is a wrapper object that holds the client and server instances
func New ¶
func New(protoOptions protocol.ProtocolOptions, cfg *Config) *LocalTxMonitor
New returns a new LocalTxMonitor object
type LocalTxMonitorOptionFunc ¶
type LocalTxMonitorOptionFunc func(*Config)
LocalTxMonitorOptionFunc represents a function used to modify the LocalTxMonitor protocol config
func WithAcquireTimeout ¶
func WithAcquireTimeout(timeout time.Duration) LocalTxMonitorOptionFunc
WithAcquireTimeout specifies the timeout for acquire operations when acting as a client
func WithGetMempoolFunc ¶ added in v0.60.0
func WithGetMempoolFunc( getMempoolFunc GetMempoolFunc, ) LocalTxMonitorOptionFunc
WithGetMempoolFunc specifies the callback function for retrieving the mempool
func WithQueryTimeout ¶
func WithQueryTimeout(timeout time.Duration) LocalTxMonitorOptionFunc
WithQueryTimeout specifies the timeout for query operations when acting as a client
type MsgAcquire ¶
type MsgAcquire struct {
	protocol.MessageBase
}
    func NewMsgAcquire ¶
func NewMsgAcquire() *MsgAcquire
type MsgAcquired ¶
type MsgAcquired struct {
	protocol.MessageBase
	SlotNo uint64
}
    func NewMsgAcquired ¶
func NewMsgAcquired(slotNo uint64) *MsgAcquired
type MsgDone ¶
type MsgDone struct {
	protocol.MessageBase
}
    func NewMsgDone ¶
func NewMsgDone() *MsgDone
type MsgGetSizes ¶
type MsgGetSizes struct {
	protocol.MessageBase
}
    func NewMsgGetSizes ¶
func NewMsgGetSizes() *MsgGetSizes
type MsgNextTx ¶
type MsgNextTx struct {
	protocol.MessageBase
}
    func NewMsgNextTx ¶
func NewMsgNextTx() *MsgNextTx
type MsgRelease ¶
type MsgRelease struct {
	protocol.MessageBase
}
    func NewMsgRelease ¶
func NewMsgRelease() *MsgRelease
type MsgReplyGetSizes ¶
type MsgReplyGetSizes struct {
	protocol.MessageBase
	Result MsgReplyGetSizesResult
}
    func NewMsgReplyGetSizes ¶
func NewMsgReplyGetSizes( capacity uint32, size uint32, numberOfTxs uint32, ) *MsgReplyGetSizes
type MsgReplyGetSizesResult ¶
type MsgReplyHasTx ¶
type MsgReplyHasTx struct {
	protocol.MessageBase
	Result bool
}
    func NewMsgReplyHasTx ¶
func NewMsgReplyHasTx(result bool) *MsgReplyHasTx
type MsgReplyNextTx ¶
type MsgReplyNextTx struct {
	protocol.MessageBase
	Transaction MsgReplyNextTxTransaction
}
    func NewMsgReplyNextTx ¶
func NewMsgReplyNextTx(eraId uint8, tx []byte) *MsgReplyNextTx
func (*MsgReplyNextTx) MarshalCBOR ¶
func (m *MsgReplyNextTx) MarshalCBOR() ([]byte, error)
func (*MsgReplyNextTx) UnmarshalCBOR ¶
func (m *MsgReplyNextTx) UnmarshalCBOR(data []byte) error
type TxAndEraId ¶ added in v0.60.0
Helper types