singular

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

Jump to

Keyboard shortcuts

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