lifeflag

package
v0.0.0-...-1592773 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const ErrEntityNotFound = errors.ConstError("entity not found")

ErrEntityNotFound indicates that the requested entity no longer exists.

We avoid errors.NotFound, because errors.NotFound is non-specific, and it's our job to communicate *this specific condition*. There are many possible sources of errors.NotFound in the world, and it's not safe or sane for a client to treat a generic NotFound as specific to the entity in question.

We're still vulnerable to apiservers returning unjustified CodeNotFound but at least we're safe from accidental errors.NotFound injection in the api client mechanism.

Variables

View Source
var WithTracer = base.WithTracer

WithTracer returns an Option that configures the Client to use the supplied tracer.

Functions

This section is empty.

Types

type Client

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

Client makes calls to the LifeFlag facade.

func NewClient

func NewClient(caller base.APICaller, facadeName string, options ...Option) *Client

NewClient returns a new Facade using the supplied caller.

func (*Client) Life

func (c *Client) Life(ctx context.Context, entity names.Tag) (life.Value, error)

Life returns the entity's life value; or ErrEntityNotFound; or some other error.

func (*Client) Watch

func (c *Client) Watch(ctx context.Context, entity names.Tag) (watcher.NotifyWatcher, error)

Watch returns a NotifyWatcher that sends a value whenever the entity's life value may have changed; or ErrEntityNotFound; or some other error.

type NewWatcherFunc

NewWatcherFunc exists to let us test Watch properly.

type Option

type Option = base.Option

Option is a function that can be used to configure a Client.

Jump to

Keyboard shortcuts

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