Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbortContextMonitoring ¶
type AbortContextMonitoring func()
func NewAbortableMonitoredContext ¶
func NewAbortableMonitoredContext(ctx context.Context) (context.Context, AbortContextMonitoring)
returns a context that monitors the given context for cancellations additionally returns an abort monitoring function that causes the monitoring to stop from that point onwards
type ETCDOption ¶
type ETCDOption func(*etcdLeaseProvider)
func WithETCDConfig ¶ added in v0.1.8
func WithETCDConfig(config etcd.Config) ETCDOption
func WithLeaseTTL ¶
func WithLeaseTTL(t int) ETCDOption
in seconds how long should ETCD wait until declaring me dead - in case I crash
func WithUsernamePassword ¶ added in v0.1.8
func WithUsernamePassword(username, password string) ETCDOption
type ElectionMetaDataProvider ¶
type ElectionMetaDataProvider interface { // identifying the locking key during election - the lowest denominator of lock Constituency(shard string) string // value that is used during campaigning for leadership CampaignPromise() string // value that is used as a part of a heartbeat during leadership LeadershipReassurance(electedAt time.Time) string }
type LeaseProvider ¶
type LeaseProvider interface { // if context is cancelled, return an error; otherwise block forever until lease is acquired // returning before a lease is acquired and the context still active will be considered a bugs AcquireLease(context.Context) (Lease, error) }
A LeaseProvider implementation is backed by a remote endpoint used to implement a distributed lock. It facilitates the acquisition of a Lease that indicates liveness of the client as well as the server. The LeaseProvider should continuously renew it's lease before expiration via a heartbeat of some sort. From a client perspective if the remote endpoint is no longer available or for other reasons indicated by the server, an acquired lease should be expired. From a server perspective if a lease exprires, other lease holders can acquire locks previously held by the expiring lease holder.
func NewETCDLeaseProvider ¶
func NewETCDLeaseProvider(etcdEndPoints []string, options ...ETCDOption) LeaseProvider
etcd backed LeaseProvider