events

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: BSD-3-Clause Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 events

type Blocker

type Blocker map[ids.ID][]Blockable

Blocker tracks objects that are blocked

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