observer

package
v21.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observable

type Observable interface {
	data.Identifiable

	AddObserver(o Observer) error     // register an Observer to be kept in touch
	NotifyObservers() error           // notify observers a change occurred on content (using Observer.SignalChange)
	RemoveObserver(name string) error // deregister an Observer that will not be notified further
}

Observable is the interface a struct must satisfy to signal internal change to observers

type Observer

type Observer interface {
	data.Identifiable

	SignalChange(id string)  // is called by Observable to signal an Observer a change occurred
	MarkAsFreed(id string)   // is called by Observable to signal an Observer the content will not be used any more (decreasing the counter of uses)
	MarkAsDeleted(id string) // used to mark the Observable as deleted (allowing to remove the entry from the Observer internals)
}

Observer is the interface a struct must satisfy to be observed by outside

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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