Skip to main content
Version: v1

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

ParameterDescription
T

Constructors

ConstructorDescription
(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

MethodReturn TypeDescription
create(runtime, id)ConsensusRegisterCollection<T>Create a new consensus register collection
getFactory()ConsensusRegisterCollectionFactoryGet a factory for ConsensusRegisterCollection to register with the data store.

Methods

MethodReturn TypeDescription
applyStashedOp()() => void
keys()string[]
loadCore(storage)Promise<void>
onDisconnect()void
processCore(message, local, localOpMetadata)void
read(key, readPolicy)T | undefinedReturns 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

ParameterTypeDescription
idstring
runtimeIFluidDataStoreRuntime
attributesIChannelAttributes

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
ParameterDescription
T

Parameters

ParameterModifiersTypeDescription
runtimeIFluidDataStoreRuntimedata store runtime the new consensus register collection belongs to
idoptionalstringoptional 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

ParameterTypeDescription
storageIChannelStorageService

Returns

Return type: Promise<void>

onDisconnect

Signature

protected onDisconnect(): void;

processCore

Signature

protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;

Parameters

ParameterTypeDescription
messageISequencedDocumentMessage
localboolean
localOpMetadataunknown

read

Returns the most recent local value of a register.

Signature

read(key: string, readPolicy?: ReadPolicy): T | undefined;

Parameters

ParameterModifiersTypeDescription
keystringThe key to read
readPolicyoptionalReadPolicyThe ReadPolicy to apply. Defaults to Atomic.

Returns

Return type: T | undefined

readVersions

Signature

readVersions(key: string): T[] | undefined;

Parameters

ParameterTypeDescription
keystring

Returns

Return type: T[] | undefined

summarizeCore

Signature

protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;

Parameters

ParameterTypeDescription
serializerIFluidSerializer

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

ParameterTypeDescription
keystring
valueT

Returns

Promise if write was non-concurrent

Return type: Promise<boolean>