Module: caf_platform/plug_lease

A plug to an external service that maintains leases on CAs.

A lease protects a binding between a CA identifier and a location. This binding ensures that CAs are unique across the data center, and therefore, they will properly serialize state changes, and provide a consistent view to the external world.

If the node owning the lease crashes, the lease eventually expires. At that point a different, randomly picked, node can create a new lease and restart the CA safely.

Source:

Extends

Methods

getLeaseTimeout() → {number}

Gets the duration of a lease in seconds.

Source:
Returns:

The lease timeout in seconds.

Type
number

grabLease(id, cb0)

Grabs a lease that guarantees exclusive ownership of a CA by this node.

The type of remoteNodeType is {remoteNode:string}|null.

Parameters:
Name Type Description
id string

An identifier for the CA.

cb0 cbType

A callback with optional (error) argument containing the current owner in a remoteNode:string error field, if we failed to acquire the lease. Otherwise, the argument is null, and we got the lease.

Source:

renewLeases(ids, cb0)

Renews a list of leases currently owned by this node.

Parameters:
Name Type Description
ids Array.<string>

A list of identifiers for local CAs.

cb0 function

A callback of type function(Object, Array.<string>) with either an error (first) argument, or a (second) argument with a list of CA identifiers that we failed to renew.

Source: