Skip to main content
Version: v1

@fluidframework/ordered-collection Package

Interfaces

Interface Description
IConsensusOrderedCollection

Consensus Ordered Collection interface

An consensus ordered collection is a distributed data structure, which holds a collection of JSON-able or handles, and has a deterministic add/remove order.

IConsensusOrderedCollectionEvents Events notifying about addition, acquisition, release and completion of items
IConsensusOrderedCollectionFactory

Consensus Ordered Collection channel factory interface

Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection Use for the runtime to create and load distributed data structure by type name of each channel

IOrderedCollection

Ordered Collection interface

Collection of objects that has deterministic add and remove ordering. Object implementing this interface can be used as the data backing for the ConsensusOrderedCollection

ISnapshotable

Interface for object that can be snapshoted

TODO: move this to be use in other place TODO: currently input and output is not symmetrical, can they become symmetrical?

Classes

Class Description
ConsensusOrderedCollection

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.

ConsensusQueue

Implementation of a consensus stack

An derived type of ConsensusOrderedCollection with a queue as the backing data and order.

Enumerations

Enum Description
ConsensusResult

Types

TypeAlias Description
ConsensusCallback Callback provided to acquire() and waitAndAcquire() methods.

Functions

Function Return Type Description
acquireAndComplete(collection) Promise<T | undefined> Helper method to acquire and complete an item Should be used in test code only
waitAcquireAndComplete(collection) Promise<T> Helper method to acquire and complete an item Should be used in test code only

Function Details

acquireAndComplete

Helper method to acquire and complete an item Should be used in test code only

Signature

export declare function acquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T | undefined>;
Type Parameters
Parameter Description
T

Parameters

Parameter Type Description
collection IConsensusOrderedCollection<T>

Returns

Return type: Promise<T | undefined>

waitAcquireAndComplete

Helper method to acquire and complete an item Should be used in test code only

Signature

export declare function waitAcquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T>;
Type Parameters
Parameter Description
T

Parameters

Parameter Type Description
collection IConsensusOrderedCollection<T>

Returns

Return type: Promise<T>