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​

MethodReturn TypeDescription
delete(key)voidDeletes 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)anyGets the accepted value for the given key.
getPending(key)anyGets the pending value for the given key.
has(key)booleanChecks if the quorum has an accepted value for the given key.
set(key, value)voidSets 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​

ParameterTypeDescription
keystringthe key to delete

get​

Gets the accepted value for the given key.

Signature​

get(key: string): any;

Parameters​

ParameterTypeDescription
keystringThe key to retrieve from

Returns​

Return type: any

getPending​

Gets the pending value for the given key.

Signature​

getPending(key: string): any;

Parameters​

ParameterTypeDescription
keystringThe 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​

ParameterTypeDescription
keystringThe 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​

ParameterTypeDescription
keystringThe key to set
valueunknownThe value to store