ConsensusRegisterCollection Class
Implementation of a consensus register collection
Signature
export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T>
Extends: SharedObject<IConsensusRegisterCollectionEvents
Implements: IConsensusRegisterCollection
Type Parameters
| Parameter | Description |
|---|---|
| T |
Constructors
| Constructor | Description |
|---|---|
| (constructor)(id, runtime, attributes) | Constructs a new consensus register collection. If the object is non-local an id and service interfaces will be provided |
Static Methods
| Method | Return Type | Description |
|---|---|---|
| create(runtime, id) | ConsensusRegisterCollection<T> | Create a new consensus register collection |
| getFactory() | ConsensusRegisterCollectionFactory | Get a factory for ConsensusRegisterCollection to register with the data store. |
Methods
| Method | Return Type | Description |
|---|---|---|
| applyStashedOp() | () => void | |
| keys() | string[] | |
| loadCore(storage) | Promise<void> | |
| onDisconnect() | void | |
| processCore(message, local, localOpMetadata) | void | |
| read(key, readPolicy) | T | undefined | Returns the most recent local value of a register. |
| readVersions(key) | T[] | undefined | |
| summarizeCore(serializer) | ISummaryTreeWithStats | |
| write(key, value) | Promise<boolean> | Creates a new register or writes a new value. Returns a promise that will resolve when the write is acked. |
Constructor Details
(constructor)
Constructs a new consensus register collection. If the object is non-local an id and service interfaces will be provided
Signature
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | |
| runtime | IFluidDataStoreRuntime | |
| attributes | IChannelAttributes |
Method Details
applyStashedOp
Signature
protected applyStashedOp(): () => void;
Returns
Return type: () => void
create
Create a new consensus register collection
Signature
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
Type Parameters
| Parameter | Description |
|---|---|
| T |
Parameters
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| runtime | IFluidDataStoreRuntime | data store runtime the new consensus register collection belongs to | |
| id | optional | string | optional name of the consensus register collection |
Returns
newly create consensus register collection (but not attached yet)
Return type: ConsensusRegisterCollection<T>
getFactory
Get a factory for ConsensusRegisterCollection to register with the data store.
Signature
static getFactory(): ConsensusRegisterCollectionFactory;
Returns
a factory that creates and load ConsensusRegisterCollection
Return type: ConsensusRegisterCollectionFactory
keys
Signature
keys(): string[];
Returns
Return type: string[]
loadCore
Signature
protected loadCore(storage: IChannelStorageService): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| storage | IChannelStorageService |
Returns
Return type: Promise<void>
onDisconnect
Signature
protected onDisconnect(): void;
processCore
Signature
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| message | ISequencedDocumentMessage | |
| local | boolean | |
| localOpMetadata | unknown |
read
Returns the most recent local value of a register.
Signature
read(key: string, readPolicy?: ReadPolicy): T | undefined;
Parameters
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| key | string | The key to read | |
| readPolicy | optional | ReadPolicy | The ReadPolicy to apply. Defaults to Atomic. |
Returns
Return type: T | undefined
readVersions
Signature
readVersions(key: string): T[] | undefined;
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string |
Returns
Return type: T[] | undefined
summarizeCore
Signature
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
Parameters
| Parameter | Type | Description |
|---|---|---|
| serializer | IFluidSerializer |
Returns
Return type: ISummaryTreeWithStats
write
Creates a new register or writes a new value. Returns a promise that will resolve when the write is acked.
Signature
write(key: string, value: T): Promise<boolean>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | |
| value | T |
Returns
Promise if write was non-concurrent
Return type: Promise<boolean>