events

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: BSD-3-Clause Imports: 3 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() ids.Set
	// Notify this object that an event has been fulfilled
	Fulfill(ids.ID)
	// Notify this object that an event has been abandoned
	Abandon(ids.ID)
	// Update the state of this object without changing the status of any events
	Update()
}

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(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(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(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