SharedSegmentSequence Class
Signature
export declare abstract class SharedSegmentSequence<T extends ISegment> extends SharedObject<ISharedSegmentSequenceEvents> implements ISharedIntervalCollection<SequenceInterval>
Extends: SharedObject<ISharedSegmentSequenceEvents
Implements: ISharedIntervalCollection<SequenceInterval
Type Parameters
| Parameter | Constraint | Description |
|---|---|---|
| T | ISegment |
Constructors
| Constructor | Description |
|---|---|
| (constructor)(dataStoreRuntime, id, attributes, segmentFromSpec) | Constructs a new instance of the SharedSegmentSequence class |
Properties
| Property | Type | Description |
|---|---|---|
| client | Client | |
| id | string | |
| loaded | Promise<void> | |
| loadedDeferred | Deferred<void> | |
| segmentFromSpec | (spec: IJSONSegment) => ISegment |
Methods
| Method | Alerts | Return Type | Description |
|---|---|---|---|
| addLocalReference(lref) | Deprecated | void | |
| annotateRange(start, end, props, combiningOp) | void | Annotates the range with the provided properties | |
| applyStashedOp(content) | unknown | Apply changes from an op. Used when rehydrating an attached container with pending changes. This prepares the SharedObject for seeing an ACK for the op or resubmitting the op upon reconnection. | |
| createLocalReferencePosition(segment, offset, refType, properties) | LocalReferencePosition | ||
| createPositionReference(segment, offset, refType) | Deprecated | LocalReference | |
| didAttach() | void | ||
| getContainingSegment(pos) | { segment: T; offset: number; } | ||
| getCurrentSeq() | number | ||
| getIntervalCollection(label) | IntervalCollection<SequenceInterval> | ||
| getIntervalCollectionLabels() | IterableIterator<string> | ||
| getLength() | number | Returns the length of the current sequence for the client | |
| getPosition(segment) | number | Returns the current position of a segment, and -1 if the segment does not exist in this sequence | |
| getPropertiesAtPosition(pos) | PropertySet | ||
| getRangeExtentsOfPosition(pos) | { posStart: number; posAfterEnd: number; } | ||
| getStackContext(startPos, rangeLabels) | RangeStackMap | ||
| groupOperation(groupOp) | void | ||
| initializeLocalCore() | void | ||
| insertAtReferencePosition(pos, segment) | void | ||
| loadCore(storage) | Promise<void> | ||
| localReferencePositionToPosition(lref) | number | ||
| localRefToPos(localRef) | Deprecated | number | |
| onConnect() | void | ||
| onDisconnect() | void | ||
| posFromRelativePos(relativePos) | number | Given a position specified relative to a marker id, lookup the marker and convert the position to a character position. | |
| processCore(message, local, localOpMetadata) | void | ||
| processGCDataCore(serializer) | void | Runs serializer over the GC data for this SharedMatrix. All the IFluidHandle's represent routes to other objects. | |
| removeLocalReference(lref) | Deprecated | LocalReferencePosition | |
| removeLocalReferencePosition(lref) | LocalReferencePosition | ||
| removeRange(start, end) | IMergeTreeRemoveMsg | ||
| replaceRange(start, end, segment) | void | Replace the range specified from start to end with the provided segment This is done by inserting the segment at the end of the range, followed by removing the contents of the range For a zero or reverse range (start >= end), insert at end do not remove anything | |
| resolveRemoteClientPosition(remoteClientPosition, remoteClientRefSeq, remoteClientId) | number | Resolves a remote client's position against the local sequence and returns the remote client's position relative to the local sequence. The client ref seq must be above the minimum sequence number or the return value will be undefined. Generally this method is used in conjunction with signals which provide point in time values for the below parameters, and is useful for things like displaying user position. It should not be used with persisted values as persisted values will quickly become invalid as the remoteClientRefSeq moves below the minimum sequence number | |
| reSubmitCore(content, localOpMetadata) | void | ||
| submitSequenceMessage(message) | void | ||
| summarizeCore(serializer, telemetryContext) | ISummaryTreeWithStats | ||
| waitIntervalCollection(label) | Deprecated | Promise<IntervalCollection<SequenceInterval>> | |
| walkSegments(handler, start, end, accum, splitRange) | void | Walk the underlying segments of the sequence. The walked segments may extend beyond the range if the segments cross the ranges start or end boundaries. Set split range to true to ensure only segments within the range are walked. |
Constructor Details
(constructor)
Constructs a new instance of the SharedSegmentSequence class
Signature
constructor(dataStoreRuntime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, segmentFromSpec: (spec: IJSONSegment) => ISegment);
Parameters
| Parameter | Type | Description |
|---|---|---|
| dataStoreRuntime | IFluidDataStoreRuntime | |
| id | string | |
| attributes | IChannelAttributes | |
| segmentFromSpec | (spec: IJSONSegment) => ISegment |
Property Details
client
Signature
protected client: Client;
Type: Client
id
Signature
id: string;
Type: string
loaded
Signature
get loaded(): Promise<void>;
Type: Promise<void>
loadedDeferred
Signature
protected loadedDeferred: Deferred<void>;
Type: Deferred<void>
segmentFromSpec
Signature
readonly segmentFromSpec: (spec: IJSONSegment) => ISegment;
Type: (spec: IJSONSegment) => ISegment
Method Details
addLocalReference
- use createLocalReferencePosition
Signature
addLocalReference(lref: LocalReference): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| lref | LocalReference |
annotateRange
Annotates the range with the provided properties
Signature
annotateRange(start: number, end: number, props: PropertySet, combiningOp?: ICombiningOp): void;
Parameters
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| start | number | The inclusive start position of the range to annotate | |
| end | number | The exclusive end position of the range to annotate | |
| props | PropertySet | The properties to annotate the range with | |
| combiningOp | optional | ICombiningOp | Optional. Specifies how to combine values for the property, such as "incr" for increment. |
applyStashedOp
Apply changes from an op. Used when rehydrating an attached container with pending changes. This prepares the SharedObject for seeing an ACK for the op or resubmitting the op upon reconnection.
Signature
protected applyStashedOp(content: any): unknown;
Parameters
| Parameter | Type | Description |
|---|---|---|
| content | any | Contents of a stashed op. |
Returns
localMetadata of the op, to be passed to process() or resubmit() when the op is ACKed or resubmitted, respectively
Return type: unknown
createLocalReferencePosition
Signature
createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined): LocalReferencePosition;
Parameters
| Parameter | Type | Description |
|---|---|---|
| segment | T | |
| offset | number | |
| refType | ReferenceType | |
| properties | PropertySet | undefined |
Returns
Return type: LocalReferencePosition
createPositionReference
- use createLocalReferencePosition
Signature
createPositionReference(segment: T, offset: number, refType: ReferenceType): LocalReference;
Parameters
| Parameter | Type | Description |
|---|---|---|
| segment | T | |
| offset | number | |
| refType | ReferenceType |
Returns
Return type: LocalReference
didAttach
Signature
protected didAttach(): void;
getContainingSegment
Signature
getContainingSegment(pos: number): {
segment: T;
offset: number;
};
Parameters
| Parameter | Type | Description |
|---|---|---|
| pos | number |
Returns
Return type: { segment: T; offset: number; }
getCurrentSeq
Signature
getCurrentSeq(): number;
Returns
Return type: number
getIntervalCollection
Signature
getIntervalCollection(label: string): IntervalCollection<SequenceInterval>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| label | string |
Returns
Return type: IntervalCollection<SequenceInterval>
getIntervalCollectionLabels
Signature
getIntervalCollectionLabels(): IterableIterator<string>;
Returns
an iterable object that enumerates the IntervalCollection labels Usage: const iter = this.getIntervalCollectionKeys(); for (key of iter) const collection = this.getIntervalCollection(key); ...
Return type: IterableIterator<string>
getLength
Returns the length of the current sequence for the client
Signature
getLength(): number;
Returns
Return type: number
getPosition
Returns the current position of a segment, and -1 if the segment does not exist in this sequence
Signature
getPosition(segment: ISegment): number;
Parameters
| Parameter | Type | Description |
|---|---|---|
| segment | ISegment | The segment to get the position of |
Returns
Return type: number
getPropertiesAtPosition
Signature
getPropertiesAtPosition(pos: number): PropertySet;
Parameters
| Parameter | Type | Description |
|---|---|---|
| pos | number |
Returns
Return type: PropertySet
getRangeExtentsOfPosition
Signature
getRangeExtentsOfPosition(pos: number): {
posStart: number;
posAfterEnd: number;
};
Parameters
| Parameter | Type | Description |
|---|---|---|
| pos | number |
Returns
Return type: { posStart: number; posAfterEnd: number; }
getStackContext
Signature
getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap;
Parameters
| Parameter | Type | Description |
|---|---|---|
| startPos | number | |
| rangeLabels | string[] |
Returns
Return type: RangeStackMap
groupOperation
Signature
groupOperation(groupOp: IMergeTreeGroupMsg): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| groupOp | IMergeTreeGroupMsg |
initializeLocalCore
Signature
protected initializeLocalCore(): void;
insertAtReferencePosition
Signature
insertAtReferencePosition(pos: ReferencePosition, segment: T): void;