Home Reference Source Repository
import Lock from 'wyst/es6/Services/Lock.js'
public class | source

Lock

our locking class

Static Member Summary

Static Public Members
public static get

gets the next closests expiry timestamp in MS

Static Method Summary

Static Public Methods
public static

creates a new Lock instance

Constructor Summary

Public Constructor
public

constructor(key: <type>, options: <type>)

constructor for a Lock class

Member Summary

Public Members
public
public

key: *

public
public

options: *

Method Summary

Public Methods
public

polls until the instance obtains a lock

public

returns attributes for a given Lock update

public

genId(): *

public

get(): Thinky:Query

base Query we inherit from

public

releases the lock on the current instance

public

replace(replacer: Function): *

replace Query for replacing a lock instance in REQL

public

obtains a lock and then runs an unary function that receives a done callback

public
public

logical validators

public

touches an acquired lock

public

tries to attain a Lock on the current instance

public

update(updater: Function): *

update Query for a lock update REQL operation

Static Public Members

public static get nextExpiry: * source

gets the next closests expiry timestamp in MS

Properties:

NameTypeAttributeDescription
nextExpiry Integer

Static Public Methods

public static create(): Promise source

creates a new Lock instance

Return:

Promise

Public Constructors

public constructor(key: <type>, options: <type>) source

constructor for a Lock class

Params:

NameTypeAttributeDescription
key <type>

The lock key

options <type>

options for the lock

Public Members

public instance_token: * source

public key: * source

public locked: boolean source

public options: * source

Public Methods

public acquire(): Promise source

polls until the instance obtains a lock

Return:

Promise

public attributes(): Object source

returns attributes for a given Lock update

Return:

Object

{ description_of_the_return_value }

public genId(): * source

Return:

*

public get(): Thinky:Query source

base Query we inherit from

Return:

Thinky:Query

public release(): Promise source

releases the lock on the current instance

Return:

Promise

public replace(replacer: Function): * source

replace Query for replacing a lock instance in REQL

Params:

NameTypeAttributeDescription
replacer Function

function that implements the REQL replace

Return:

*

public synchronize(fn: Function): Promise source

obtains a lock and then runs an unary function that receives a done callback

Params:

NameTypeAttributeDescription
fn Function

the function to run after a lock is obtained

Return:

Promise

public throwLockLost() source

public throwUnlessLocked() source

logical validators

public touch(): Promise source

touches an acquired lock

Return:

Promise

public tryLock(): Promise source

tries to attain a Lock on the current instance

Return:

Promise

public update(updater: Function): * source

update Query for a lock update REQL operation

Params:

NameTypeAttributeDescription
updater Function

function to use as a REQL update

Return:

*