Documentation
¶
Overview ¶
Package grpcsync implements additional synchronization primitives built upon the sync package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackSerializer ¶ added in v1.55.0
type CallbackSerializer struct {
// contains filtered or unexported fields
}
CallbackSerializer provides a mechanism to schedule callbacks in a synchronized manner. It provides a FIFO guarantee on the order of execution of scheduled callbacks. New callbacks can be scheduled by invoking the Schedule() method.
This type is safe for concurrent access.
func NewCallbackSerializer ¶ added in v1.55.0
func NewCallbackSerializer(ctx context.Context) *CallbackSerializer
NewCallbackSerializer returns a new CallbackSerializer instance. The provided context will be passed to the scheduled callbacks. Users should cancel the provided context to shutdown the CallbackSerializer. It is guaranteed that no callbacks will be executed once this context is canceled.
func (*CallbackSerializer) Schedule ¶ added in v1.55.0
func (t *CallbackSerializer) Schedule(f func(ctx context.Context))
Schedule adds a callback to be scheduled after existing callbacks are run.
Callbacks are expected to honor the context when performing any blocking operations, and should return early when the context is canceled.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event represents a one-time event that may occur in the future.
func (*Event) Done ¶
func (e *Event) Done() <-chan struct{}
Done returns a channel that will be closed when Fire is called.