This section is empty.


This section is empty.


This section is empty.


type API

type API struct {
	// contains filtered or unexported fields

API allows controller machines to claim responsibility for; or to wait for no other machine to have responsibility for; administration for some model.

func NewAPI

func NewAPI(
	apiCaller base.APICaller,
	claimant names.Tag,
	entity names.Tag,
) (*API, error)

NewAPI returns a new API client for the Singular facade. It exposes methods for claiming and observing administration responsibility for the entity with the supplied tag, on behalf of the authenticated agent.

func (*API) Claim

func (api *API) Claim(duration time.Duration) error

Claim attempts to claim responsibility for administration of the entity for the supplied duration. If the claim is denied, it will return lease.ErrClaimDenied.

func (*API) Wait

func (api *API) Wait() error

Wait blocks until nobody has responsibility for administration of the entity. It should probably be doing something watchy rather than blocky, but it's following the lease manager implementation underlying the original leadership approach and it doesn't seem worth rewriting all that.

Source Files