juju: github.com/juju/juju/api/lifeflag Index | Files

package lifeflag

import "github.com/juju/juju/api/lifeflag"


Package Files



var ErrNotFound = errors.New("entity not found")

ErrNotFound 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.

type Facade Uses

type Facade struct {
    // contains filtered or unexported fields

Facade makes calls to the LifeFlag facade.

func NewFacade Uses

func NewFacade(caller base.APICaller, newWatcher NewWatcherFunc) *Facade

NewFacade returns a new Facade using the supplied caller.

func (*Facade) Life Uses

func (facade *Facade) Life(entity names.Tag) (life.Value, error)

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

func (*Facade) Watch Uses

func (facade *Facade) Watch(entity names.Tag) (watcher.NotifyWatcher, error)

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

type NewWatcherFunc Uses

type NewWatcherFunc func(base.APICaller, params.NotifyWatchResult) watcher.NotifyWatcher

NewWatcherFunc exists to let us test Watch properly.

Package lifeflag imports 6 packages (graph) and is imported by 28 packages. Updated 2020-05-11. Refresh now. Tools for package owners.