Documentation ¶
Index ¶
- Variables
- func GenerateMessageIdByNonce(nonce int64) *common.Hash
- type Broadcaster
- type Manager
- type MemorySequencer
- func (s *MemorySequencer) Close()
- func (s *MemorySequencer) PeekMsg() (Request, error)
- func (s *MemorySequencer) PendingMsgCount() (int, error)
- func (s *MemorySequencer) PopMsg() (Request, error)
- func (s *MemorySequencer) PushMsg(msg Request) error
- func (s *MemorySequencer) QueuedMsgCount() (int, error)
- type MemoryStorage
- func (s *MemoryStorage) AddMsg(req Request) error
- func (s *MemoryStorage) GetMsg(msgId common.Hash) (Message, error)
- func (s *MemoryStorage) GetNonce(msgId common.Hash) (nonce uint64, err error)
- func (s *MemoryStorage) HasMsg(msgId common.Hash) bool
- func (s *MemoryStorage) UpdateMsg(msg Message) error
- func (s *MemoryStorage) UpdateMsgStatus(msgId common.Hash, status MessageStatus) error
- func (s *MemoryStorage) UpdateReceipt(msgId common.Hash, receipt Receipt) error
- func (s *MemoryStorage) UpdateResponse(msgId common.Hash, resp Response) error
- type Message
- type MessageStatus
- type Receipt
- type Request
- type Response
- type ScheduleManager
- type Sequencer
- type SimpleBroadcaster
- type SimpleManager
- func (c *SimpleManager) CallAndSendMsg(ctx context.Context, msg Request) (resp Response)
- func (c *SimpleManager) CallMsg(ctx context.Context, msg Request, blockNumber *big.Int) (resp Response)
- func (c SimpleManager) MessageToTransactOpts(ctx context.Context, msg Request) (*bind.TransactOpts, error)
- func (c SimpleManager) NewTransaction(ctx context.Context, msg Request) (*types.Transaction, error)
- func (m SimpleManager) ReplaceMsgWithHigherGasPrice(ctx context.Context, msgId common.Hash) (resp Response)
- func (m SimpleManager) SendMsg(ctx context.Context, msg Request) (resp Response)
- func (c SimpleManager) WaitMsgReceipt(msgId common.Hash, confirmations uint64, timeout time.Duration) (*Receipt, bool)
- func (c SimpleManager) WaitMsgResponse(msgId common.Hash, timeout time.Duration) (*Response, bool)
- func (c SimpleManager) WaitTxReceipt(txHash common.Hash, confirmations uint64, timeout time.Duration) (*types.Receipt, bool)
- type Storage
- type StorageReader
- type StorageWriter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPendingChannelClosed = errors.New("pending channel was closed")
Functions ¶
Types ¶
type Broadcaster ¶ added in v0.1.0
type Manager ¶ added in v0.1.0
type Manager interface { Storage ScheduleManager }
type MemorySequencer ¶
type MemorySequencer struct {
// contains filtered or unexported fields
}
func NewMemorySequencer ¶
func NewMemorySequencer(client *ethclient.Client, msgStorage Storage, buffer int) *MemorySequencer
func (*MemorySequencer) Close ¶
func (s *MemorySequencer) Close()
func (*MemorySequencer) PeekMsg ¶
func (s *MemorySequencer) PeekMsg() (Request, error)
func (*MemorySequencer) PendingMsgCount ¶
func (s *MemorySequencer) PendingMsgCount() (int, error)
func (*MemorySequencer) PopMsg ¶
func (s *MemorySequencer) PopMsg() (Request, error)
func (*MemorySequencer) PushMsg ¶
func (s *MemorySequencer) PushMsg(msg Request) error
func (*MemorySequencer) QueuedMsgCount ¶
func (s *MemorySequencer) QueuedMsgCount() (int, error)
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
func NewMemoryStorage ¶
func NewMemoryStorage() (*MemoryStorage, error)
func (*MemoryStorage) AddMsg ¶
func (s *MemoryStorage) AddMsg(req Request) error
func (*MemoryStorage) GetNonce ¶ added in v0.1.0
func (s *MemoryStorage) GetNonce(msgId common.Hash) (nonce uint64, err error)
func (*MemoryStorage) UpdateMsg ¶
func (s *MemoryStorage) UpdateMsg(msg Message) error
func (*MemoryStorage) UpdateMsgStatus ¶
func (s *MemoryStorage) UpdateMsgStatus(msgId common.Hash, status MessageStatus) error
func (*MemoryStorage) UpdateReceipt ¶ added in v0.1.0
func (s *MemoryStorage) UpdateReceipt(msgId common.Hash, receipt Receipt) error
func (*MemoryStorage) UpdateResponse ¶
func (s *MemoryStorage) UpdateResponse(msgId common.Hash, resp Response) error
type Message ¶
type MessageStatus ¶
type MessageStatus uint8
const ( MessageStatusSubmitted MessageStatus = iota MessageStatusScheduled MessageStatusQueued MessageStatusNonceAssigned MessageStatusInflight // Broadcasted but not on chain MessageStatusOnChain MessageStatusFinalized // it was broadcasted but not included on-chain until timeout, so the nonce was released MessageStatusNonceReleased MessageStatusExpired )
type Request ¶
type Request struct { From common.Address // the sender of the 'transaction' To *common.Address // the destination contract (nil for contract creation) Value *big.Int // amount of wei sent along with the call Gas uint64 // if 0, the call executes with near-infinite gas GasOnEstimationFailed *uint64 // how much gas you wanna provide when the msg estimation failed. As much as possible, so you can debug on-chain GasPrice *big.Int // wei <-> gas exchange ratio Data []byte // input data, usually an ABI-encoded contract method invocation AccessList types.AccessList // EIP-2930 access list. SimulationOn bool // contains return data of msg call if true // ONLY available on function ScheduleMsg AfterMsg *common.Hash // message id or txHash. Used for making sure the msg was executed after it. StartTime int64 // the msg was executed after the time. It's useful for one-time task. ExpirationTime int64 // the msg will be not included on-chain if timeout. Interval time.Duration // the msg will be executed every interval. // contains filtered or unexported fields }
func AssignMessageId ¶
func (*Request) CopyWithoutId ¶ added in v0.1.0
func (*Request) SetIdWithNonce ¶
func (*Request) SetRandomId ¶ added in v0.1.0
type ScheduleManager ¶ added in v0.1.0
type ScheduleManager interface { CallAndSendMsg(ctx context.Context, msg Request) (resp Response) CallMsg(ctx context.Context, msg Request, blockNumber *big.Int) (resp Response) SendMsg(ctx context.Context, msg Request) (resp Response) ReplaceMsgWithHigherGasPrice(ctx context.Context, msgId common.Hash) (resp Response) NewTransaction(ctx context.Context, msg Request) (*types.Transaction, error) MessageToTransactOpts(ctx context.Context, msg Request) (*bind.TransactOpts, error) WaitTxReceipt(txHash common.Hash, confirmations uint64, timeout time.Duration) (*types.Receipt, bool) WaitMsgResponse(msgId common.Hash, timeout time.Duration) (*Response, bool) WaitMsgReceipt(msgId common.Hash, confirmations uint64, timeout time.Duration) (*Receipt, bool) }
type SimpleBroadcaster ¶ added in v0.1.0
type SimpleBroadcaster struct {
// contains filtered or unexported fields
}
SimpleBroadcaster makes sure that every message broadcasted could be consumed(on-chain) correctly.
func NewSimpleBroadcaster ¶ added in v0.1.0
func NewSimpleBroadcaster(msgManager Manager) *SimpleBroadcaster
func (SimpleBroadcaster) CallAndSendMsg ¶ added in v0.1.0
func (b SimpleBroadcaster) CallAndSendMsg(ctx context.Context, msg Request) (resp Response)
type SimpleManager ¶ added in v0.1.0
func NewSimpleManager ¶ added in v0.1.0
func (*SimpleManager) CallAndSendMsg ¶ added in v0.1.0
func (c *SimpleManager) CallAndSendMsg(ctx context.Context, msg Request) (resp Response)
func (SimpleManager) MessageToTransactOpts ¶ added in v0.1.0
func (c SimpleManager) MessageToTransactOpts(ctx context.Context, msg Request) (*bind.TransactOpts, error)
func (SimpleManager) NewTransaction ¶ added in v0.1.0
func (c SimpleManager) NewTransaction(ctx context.Context, msg Request) (*types.Transaction, error)
func (SimpleManager) ReplaceMsgWithHigherGasPrice ¶ added in v0.1.0
func (SimpleManager) SendMsg ¶ added in v0.1.0
func (m SimpleManager) SendMsg(ctx context.Context, msg Request) (resp Response)
func (SimpleManager) WaitMsgReceipt ¶ added in v0.1.0
func (SimpleManager) WaitMsgResponse ¶ added in v0.1.0
type Storage ¶
type Storage interface { StorageReader StorageWriter }
type StorageReader ¶ added in v0.1.0
Click to show internal directories.
Click to hide internal directories.