Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlreadyAckedError ¶
type AlreadyAckedError struct { }
func (*AlreadyAckedError) Error ¶
func (e *AlreadyAckedError) Error() string
type SubTree ¶
type SubTree interface { // Send an acknowledgement to indicate the completion of a work on this SubTree. Ack should only be called // after all NewSubTree(s) are created Ack() // Send an negative acknowledgement to indicate that there is an error completing a work on this SubTree. // Nack error will be wrapping in a NackError and sent to the error function. Nack(err error) // Create a New SubTree for additional acknowledgements NewSubTree() (SubTree, error) // Whether or not this node is acked or nacked (not necessarily the whole tree) IsAcked() bool }
A SubTree is a subset of an ack Tree. Normally, users create SubTree when it expects to receive additional acknowledgements signaling the completions of the same work.
type TimeoutError ¶
type TimeoutError struct { }
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
type Tree ¶
type Tree interface { SubTree // Block until either the completion function or the error function is called Wait() // Whether or not the tree is completed IsDone() bool }
func NewAckTree ¶
Construct a new ack Tree. The constructor takes in a context, a completion function, and an error function as its parameters. Once constructed, the ack Tree will start collecting acknowledgements asynchronously. When it receives all acknowledgements, it will call the completion function. If it does not receive all the acknowledgements before the context timeout/cancellation, it will call the error function. Once the completion function or the error function is called, the ack Tree is considered done, and subsequent acknowledgements are ignored.