Skip to main content

ConsensusOrderedCollection Class

Implementation of a consensus collection shared object

Implements the shared object's communication, and the semantics around the release/complete mechanism following acquire.

Generally not used directly. A derived type will pass in a backing data type IOrderedCollection that will define the deterministic add/acquire order and snapshot ability.

This API is deprecated and will be removed in a future release.

Use IConsensusOrderedCollection for typing and the appropriate factory to create instances. This implementation class will be removed in a future release.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/ordered-collection/legacy.

For more information about our API support guarantees, see here.

Signature​

export declare class ConsensusOrderedCollection<T = any> extends SharedObject<IConsensusOrderedCollectionEvents<T>> implements IConsensusOrderedCollection<T>

Extends: SharedObject<IConsensusOrderedCollectionEvents<T>>

Implements: IConsensusOrderedCollection<T>

Type Parameters​

ParameterDefaultDescription
Tany

Constructors​

ConstructorAlertsDescription
(constructor)(id, runtime, attributes, data)BetaConstructs a new consensus collection. If the object is non-local an id and service interfaces will be provided

Methods​

MethodAlertsModifiersReturn TypeDescription
acquire(callback)BetaPromise<boolean>Remove a value from the consensus collection. If the collection is empty, returns false. Otherwise calls callback with the value
add(value)BetaPromise<void>Add a value to the consensus collection.
applyStashedOp(content)Betavoid
complete(acquireId)BetaPromise<void>
completeCore(acquireId)Betavoid
isActive()Betaboolean
loadCore(storage)BetaPromise<void>
onDisconnect()Betavoid
processMessagesCore(messagesCollection)Betavoid
release(acquireId)Betavoid
releaseCore(acquireId)Betavoid
rollback(content, localOpMetadata)Betasealedvoid
summarizeCore(serializer)BetaISummaryTreeWithStats
waitAndAcquire(callback)BetaPromise<void>Wait for a value to be available and acquire it from the consensus collection

Constructor Details​

(constructor)​

Constructs a new consensus collection. If the object is non-local an id and service interfaces will be provided

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, data: IOrderedCollection<T>);

Parameters​

ParameterTypeDescription
idstring
runtimeIFluidDataStoreRuntime
attributesIChannelAttributes
dataIOrderedCollection<T>

Method Details​

acquire​

Remove a value from the consensus collection. If the collection is empty, returns false. Otherwise calls callback with the value

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

acquire(callback: ConsensusCallback<T>): Promise<boolean>;

Parameters​

ParameterTypeDescription
callbackConsensusCallback<T>

Returns​

Return type: Promise<boolean>

add​

Add a value to the consensus collection.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

add(value: T): Promise<void>;

Parameters​

ParameterTypeDescription
valueT

Returns​

Return type: Promise<void>

applyStashedOp​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected applyStashedOp(content: unknown): void;

Parameters​

ParameterTypeDescription
contentunknown

complete​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected complete(acquireId: string): Promise<void>;

Parameters​

ParameterTypeDescription
acquireIdstring

Returns​

Return type: Promise<void>

completeCore​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected completeCore(acquireId: string): void;

Parameters​

ParameterTypeDescription
acquireIdstring

isActive​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected isActive(): boolean;

Returns​

Return type: boolean

loadCore​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected loadCore(storage: IChannelStorageService): Promise<void>;

Parameters​

ParameterTypeDescription
storageIChannelStorageService

Returns​

Return type: Promise<void>

onDisconnect​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected onDisconnect(): void;

processMessagesCore​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;

Parameters​

ParameterTypeDescription
messagesCollectionIRuntimeMessageCollection

release​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected release(acquireId: string): void;

Parameters​

ParameterTypeDescription
acquireIdstring

releaseCore​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected releaseCore(acquireId: string): void;

Parameters​

ParameterTypeDescription
acquireIdstring

rollback​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature​

/** @sealed */
protected rollback(content: unknown, localOpMetadata: unknown): void;

Parameters​

ParameterTypeDescription
contentunknown
localOpMetadataunknown

summarizeCore​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;

Parameters​

ParameterTypeDescription
serializerIFluidSerializer

Returns​

Return type: ISummaryTreeWithStats

waitAndAcquire​

Wait for a value to be available and acquire it from the consensus collection

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

waitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;

Parameters​

ParameterTypeDescription
callbackConsensusCallback<T>

Returns​

Return type: Promise<void>