Class: Lock

Clusterluck.Lock(type, id, timeout)

new Lock(type, id, timeout)

Lock class to hold the type, id, and timeout information for a lock. Additional metadata about the holder(s) of a lock, such as start time and initial TTL, are stored in the DLM server's underlying table.

Parameters:
Name Type Description
type String

Type of lock. Can either be 'read' be 'write'.

id String

ID of lock.

timeout Timeout | Map

Timeout object for the lock. If a read lock, this value will be a map from holders to timeout objects.

Source:

Methods

id(idopt) → {String}

Acts as a getter/setter for the ID of this lock.

Parameters:
Name Type Attributes Description
id String <optional>

ID to set on this lock.

Source:
Returns:

This lock's ID.

Type
String

timeout(timeoutopt) → {Timeout|Map}

Acts as a getter/setter for the timeout of this lock.

Parameters:
Name Type Attributes Description
timeout Timeout | Map <optional>

Timeout to set on this lock.

Source:
Returns:

This lock's timeout object(s).

Type
Timeout | Map

type(typeopt) → {String}

Acts as a getter/setter for the type of this lock.

Parameters:
Name Type Attributes Description
type String <optional>

Type to set on this lock.

Source:
Returns:

This lock's type.

Type
String