Documentation ¶
Overview ¶
Package natslock provides locking and leader election using NATS JetStream KV store
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBadParameter = errors.New("bad parameters in request")
ErrBadParameter is returned when bad parameters are passed to a request
Functions ¶
Types ¶
type Locker ¶
Locker is a distributed lock backed by a JetStream key-value store
func (*Locker) AcquireLead ¶
AcquireLead attempts to acquire the leader lock for the given id and returns true if successful. If the lock is already held by another id, it will return false.
func (*Locker) ReleaseLead ¶
ReleaseLead releases the leader lock if the given id belongs to the current leader
Click to show internal directories.
Click to hide internal directories.