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 | 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 | |
processCore(message, local, localOpMetadata) | Beta |
void | |
release(acquireId) | Beta |
void | |
releaseCore(acquireId) | Beta |
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;
processCore
For more information about our API support guarantees, see here.
Signature
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
message | ISequencedDocumentMessage | |
local | boolean | |
localOpMetadata | unknown |
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 |
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>