Documentation
¶
Index ¶
Constants ¶
View Source
const Type primitive.Type = "LeaderLatch"
Type is the leader latch type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // GetLatch gets the Latch instance of the given name GetLatch(ctx context.Context, name string, opts ...Option) (Latch, error) }
Client provides an API for creating Latches
type Event ¶
type Event struct { // Type is the type of the event Type EventType // Leadership is the term that occurs as a result of the latch event Leadership Leadership }
Event is an latch event
type EventType ¶
type EventType string
EventType is the type of an Latch event
const ( // EventChanged indicates the latch term changed EventChanged EventType = "changed" )
type Latch ¶
type Latch interface { primitive.Primitive // ID returns the ID of the instance of the latch ID() string // Get gets the current latch Get(ctx context.Context) (*Leadership, error) // Join joins the latch Join(ctx context.Context) (*Leadership, error) // Latch attempts to acquire the latch Latch(ctx context.Context) (*Leadership, error) // Watch watches the latch for changes Watch(ctx context.Context, c chan<- *Event) error }
Latch provides distributed leader latch
type Leadership ¶
type Leadership struct { // ID is a globally unique, monotonically increasing term number ID uint64 // Leader is the ID of the leader that was elected Leader string // Participants is a list of candidates currently participating in the latch Participants []string }
Leadership is a leadership term A term is guaranteed to have a monotonically increasing, globally unique ID.
Click to show internal directories.
Click to hide internal directories.