Skip to main content
Version: v1

IQuorum Interface

An IQuorum is a key-value storage, in which setting a value requires all connected collaborators to observe and ack the set message. As a result, the value goes through two phases - "pending" state where the local client has seen the set, but not all connected clients have, and "accepted" where all connected clients have seen the set.

Signature

export interface IQuorum extends ISharedObject<IQuorumEvents>

Extends: ISharedObject<IQuorumEvents

Methods

Method Return Type Description
delete(key) void Deletes the key/value pair at the given key. After issuing the delete, the delete is in "pending" state until all connected clients have ack'd the delete. The accepted value remains unchanged until that time.
get(key) any Gets the accepted value for the given key.
getPending(key) any Gets the pending value for the given key.
has(key) boolean Checks if the quorum has an accepted value for the given key.
set(key, value) void Sets the value for the given key. After setting the value, it will be in "pending" state until all connected clients have ack'd the set. The accepted value remains unchanged until that time.

Method Details

delete

Deletes the key/value pair at the given key. After issuing the delete, the delete is in "pending" state until all connected clients have ack'd the delete. The accepted value remains unchanged until that time.

Signature

delete(key: string): void;

Parameters

Parameter Type Description
key string the key to delete

get

Gets the accepted value for the given key.

Signature

get(key: string): any;

Parameters

Parameter Type Description
key string The key to retrieve from

Returns

Return type: any

getPending

Gets the pending value for the given key.

Signature

getPending(key: string): any;

Parameters

Parameter Type Description
key string The key to retrieve from

Returns

Return type: any

has

Checks if the quorum has an accepted value for the given key.

Signature

has(key: string): boolean;

Parameters

Parameter Type Description
key string The key to check

Returns

Return type: boolean

set

Sets the value for the given key. After setting the value, it will be in "pending" state until all connected clients have ack'd the set. The accepted value remains unchanged until that time.

Signature

set(key: string, value: unknown): void;

Parameters

Parameter Type Description
key string The key to set
value unknown The value to store