Help us shape the future of Go! Take the 2026 Go Developer Survey

observer

package
v22.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 0 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 {
	GetID() (string, error) // GetID Returns the ID of the instance

	AddObserver(o Observer) error        // register an Observer to be kept in touch
	NotifyObservers(ob Observable) 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 {
	GetID() (string, error) // GetID Returns the ID of the instance

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