Documentation ¶
Overview ¶
Package sequence providers helpers to manage sequence numbers on behalf of orbit clients. See Manager for more details on the api.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoMoreRoom = errors.New("queue full") ErrBadSequence = errors.New("bad sequence") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct { MaxSize int // contains filtered or unexported fields }
Manager provides a system for tracking the transaction submission queue for a set of addresses. Requests to submit at a certain sequence number are registered using the Push() method, and as the system is updated with account sequence information (through the Update() method) requests are notified that they can safely submit to rover-core.
func (*Manager) Push ¶
Push registers an intent to submit a transaction for the provided address at the provided sequence. A channel is returned that will be written to when the requester should attempt the submission.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue manages the submission queue for a single source account. The transaction system uses Push to enqueue submissions for given sequence numbers.
Queue maintains a priority queue of pending submissions, and when updated (via the Update() method) with the current sequence number of the account being managed, queued submissions that can be acted upon will be unblocked.
func (*Queue) Push ¶
Push enqueues the intent to submit a transaction at the provided sequence number and returns a channel that will emit when it is safe for the client to do so.
Push does not perform any triggering (which occurs in Update(), even if the current sequence number for this queue is the same as the provided sequence, to keep internal complexity much lower. Given that, the recommended usage pattern is:
- Push the submission onto the queue
- Load the current sequence number for the source account from the DB
- Call Update() with the result from step 2 to trigger the submission if possible