event

package
v1.11.3-sam Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockable

type Blockable interface {
	// IDs that this object is blocking on
	Dependencies() set.Set[ids.ID]
	// Notify this object that an event has been fulfilled
	Fulfill(context.Context, ids.ID)
	// Notify this object that an event has been abandoned
	Abandon(context.Context, ids.ID)
	// Update the state of this object without changing the status of any events
	Update(context.Context)
}

Blockable defines what an object must implement to be able to block on dependent events being completed.

type Blocker

type Blocker map[ids.ID][]Blockable

Blocker tracks Blockable events. Blocker is used to track events that require their dependencies to be fulfilled before them. Once a Blockable event is registered, it will be notified once any of its dependencies are fulfilled or abandoned.

func (*Blocker) Abandon

func (b *Blocker) Abandon(ctx context.Context, id ids.ID)

Abandon notifies all objects blocking on the event whose ID is <id> that the event has been abandoned

func (*Blocker) Fulfill

func (b *Blocker) Fulfill(ctx context.Context, id ids.ID)

Fulfill notifies all objects blocking on the event whose ID is <id> that the event has happened

func (*Blocker) Len

func (b *Blocker) Len() int

Returns the number of items that have dependencies waiting on them to be fulfilled

func (*Blocker) PrefixedString

func (b *Blocker) PrefixedString(prefix string) string

PrefixedString returns the same value as the String function, with all the new lines prefixed by [prefix]

func (*Blocker) Register

func (b *Blocker) Register(ctx context.Context, pending Blockable)

Register a new Blockable and its dependencies

func (*Blocker) String

func (b *Blocker) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL