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. \
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
| Parameter | Default | Description |
|---|---|---|
| T | any |
Constructors
| Constructor | Alerts | Description |
|---|---|---|
| (constructor)(id, runtime, attributes, data) | Beta |
Constructs a new consensus collection. If the object is non-local an id and service interfaces will be provided |
Methods
| Method | Alerts | Modifiers | Return Type | Description |
|---|---|---|---|---|
| acquire(callback) | Beta |
Promise<boolean> | Remove a value from the consensus collection. If the collection is empty, returns false. Otherwise calls callback with the value | |
| add(value) | Beta |
Promise<void> | Add a value to the consensus collection. | |
| applyStashedOp() | Beta |
void | ||
| complete(acquireId) | Beta |
Promise<void> | ||
| completeCore(acquireId) | Beta |
void | ||
| isActive() | Beta |
boolean | ||
| loadCore(storage) | Beta |
Promise<void> | ||
| onDisconnect() | Beta |
void | ||
| processMessagesCore(messagesCollection) | Beta |
void | ||
| release(acquireId) | Beta |
void | ||
| releaseCore(acquireId) | Beta |
void | ||
| rollback(content, localOpMetadata) | Beta |
sealed |
void | |
| summarizeCore(serializer) | Beta |
ISummaryTreeWithStats | ||
| waitAndAcquire(callback) | Beta |
Promise<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
For more information about our API support guarantees, see here.
Signature
protected constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, data: IOrderedCollection<T>);
Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | |
| runtime | IFluidDataStoreRuntime | |
| attributes | IChannelAttributes | |
| data | IOrderedCollection<T> |
Method Details
acquire
Remove a value from the consensus collection. If the collection is empty, returns false. Otherwise calls callback with the value
For more information about our API support guarantees, see here.
Signature
acquire(callback: ConsensusCallback<T>): Promise<boolean>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| callback | ConsensusCallback<T> |
Returns
Return type: Promise<boolean>
add
Add a value to the consensus collection.
For more information about our API support guarantees, see here.
Signature
add(value: T): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| value | T |
Returns
Return type: Promise<void>
applyStashedOp
For more information about our API support guarantees, see here.
Signature
protected applyStashedOp(): void;
complete
For more information about our API support guarantees, see here.
Signature
protected complete(acquireId: string): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| acquireId | string |
Returns
Return type: Promise<void>
completeCore
For more information about our API support guarantees, see here.
Signature
protected completeCore(acquireId: string): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| acquireId | string |
isActive
For more information about our API support guarantees, see here.
Signature
protected isActive(): boolean;
Returns
Return type: boolean
loadCore
For more information about our API support guarantees, see here.
Signature
protected loadCore(storage: IChannelStorageService): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| storage | IChannelStorageService |
Returns
Return type: Promise<void>
onDisconnect
For more information about our API support guarantees, see here.
Signature
protected onDisconnect(): void;
processMessagesCore
For more information about our API support guarantees, see here.
Signature
protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| messagesCollection | IRuntimeMessageCollection |
release
For more information about our API support guarantees, see here.
Signature
protected release(acquireId: string): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| acquireId | string |
releaseCore
For more information about our API support guarantees, see here.
Signature
protected releaseCore(acquireId: string): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| acquireId | string |
rollback
For more information about our API support guarantees, see here.
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
| Parameter | Type | Description |
|---|---|---|
| content | unknown | |
| localOpMetadata | unknown |
summarizeCore
For more information about our API support guarantees, see here.
Signature
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
Parameters
| Parameter | Type | Description |
|---|---|---|
| serializer | IFluidSerializer |
Returns
Return type: ISummaryTreeWithStats
waitAndAcquire
Wait for a value to be available and acquire it from the consensus collection
For more information about our API support guarantees, see here.
Signature
waitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| callback | ConsensusCallback<T> |
Returns
Return type: Promise<void>