Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SafeAcks ¶
type SafeAcks struct {
// contains filtered or unexported fields
}
SafeAcks is a thread safe structure which allows to handle acknowledgment exchanges with N senders and one receiver. The first sender succeeds, then an error is returned for the subsequent ones. This way, subsequent senders are not stuck sending an acknowledgment when nothing expects it anymore. The signaling design is inspired by point 2 in https://go101.org/article/channel-closing.html SafeAcks can be used to acknowledge that an action happened to the task such as task KILLED. At the moment we utilize SafeAcks to acknowledge that all the requested tasks were killed by mesos (task/manager.go).
func (*SafeAcks) ExpectsAck ¶
func (*SafeAcks) RegisterAck ¶
func (*SafeAcks) TryReceiveAck ¶
TryReceiveAck blocks until an acknowledgment is received and then returns true. It will return false if an acknowledgment for a given key is not expected.
func (*SafeAcks) TrySendAck ¶
TrySendAck checks if an acknowledgment is expected and if it is, it blocks until it is received. If an acknowledgment is not expected at the moment of the call (or already was received), nil is returned. If more than one goroutine attempts to send an acknowledgment before it is received, all but one goroutines will receive an error.