instance

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is an in-memory Instancer backed by explicit Update calls. It is the recommended Instancer for unit tests and local development where no external service registry is available.

func NewCache

func NewCache() *Cache

func (*Cache) Deregister

func (c *Cache) Deregister(ch chan<- events.Event)

Deregister removes ch from the subscriber list.

func (*Cache) Register

func (c *Cache) Register(ch chan<- events.Event)

Register subscribes ch to future events. The current state is sent immediately so the subscriber starts with a consistent view.

func (*Cache) State

func (c *Cache) State() events.Event

State returns a copy of the most recently broadcast event.

func (*Cache) Stop

func (c *Cache) Stop()

预留

func (*Cache) Update

func (c *Cache) Update(event events.Event)

Update sets the current instance list (or error) and broadcasts the event to all registered subscribers. Duplicate events (same instances + error) are silently dropped.

Jump to

Keyboard shortcuts

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