package watch
Import Path
github.com/tmc/go-iroh/watch (on go.dev)
Dependency Relation
imports 3 packages, and imported by 2 packages
Involved Source Files
Package watch provides an observable value: a [Value] that can be updated and
one or more [Observer] handles that observe its changes.
It is the Go analog of iroh's n0_watcher (Watchable + Watcher). An [Observer]
exposes the current value, a one-shot wait for the next change, and an
iterator stream of values. The root package uses Observer for APIs such as
Endpoint.WatchAddr.
The Go API is not stable before v1 and may change in any v0 release.
Package-Level Type Names (total 2)
Type Parameters:
T: any
Observer observes a [Value]. Multiple observers may observe the same value
independently. It is the Go analog of iroh's n0_watcher::Watcher.
Current returns the current value.
Stream returns an iterator that yields each new value until ctx is done.
The current value is delivered first.
Updated blocks until the value changes after the watcher's last observed
version, returning the new value, or ctx.Err() if the context is done.
The first call returns the current value immediately.
func (*Value)[T].Watch() Observer[T]
func github.com/tmc/go-iroh/internal/socket.(*RelayActor).HomeRelayStatus() Observer[*socket.RelayStatus]
func github.com/tmc/go-iroh/internal/socket.(*RelayTransport).HomeRelayStatus() Observer[*socket.RelayStatus]
func github.com/tmc/go-iroh/iroh.(*Endpoint).HomeRelayStatus() Observer[*iroh.RelayStatus]
func github.com/tmc/go-iroh/iroh.(*Endpoint).WatchAddr() Observer[netaddr.EndpointAddr]
Type Parameters:
T: any
Value is an observable container holding a T. It is safe for concurrent use.
Updates are published to all [Observer] handles created from it.
The zero Value holds the zero T and is ready to use.
Current returns the current value.
Set updates the value and notifies all watchers if it changed.
Watch returns an [Observer] observing this value.
func NewValue[T](v T) *Value[T]
func NewValueFunc[T](v T, equal func(a, b T) bool) *Value[T]
![]() |
The pages are generated with Golds v0.8.4. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |