SharedSegmentSequence Class
Packages > fluid-framework > SharedSegmentSequence
Signature:
export declare abstract class SharedSegmentSequence<T extends ISegment> extends SharedObject<ISharedSegmentSequenceEvents> implements ISharedIntervalCollection<SequenceInterval>
Extends: ISharedSegmentSequenceEvents
Implements: ISharedIntervalCollectionSequenceInterval
Type parameters:
T –
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(dataStoreRuntime, id, attributes, segmentFromSpec) | Constructs a new instance of the SharedSegmentSequence class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
client | |||
id | |||
loaded | |||
loadedDeferred | |||
segmentFromSpec |
Methods
Method | Modifiers | Description |
---|---|---|
addLocalReference(lref) | ||
annotateRange(start, end, props, combiningOp) | Annotates the range with the provided properties | |
applyStashedOp(content) | ||
createLocalReferencePosition(segment, offset, refType, properties) | ||
createPositionReference(segment, offset, refType) | ||
didAttach() | ||
getContainingSegment(pos) | ||
getCurrentSeq() | ||
getIntervalCollection(label) | ||
getIntervalCollectionLabels() | ||
getLength() | Returns the length of the current sequence for the client | |
getPosition(segment) | Returns the current position of a segment, and -1 if the segment does not exist in this sequence | |
getPropertiesAtPosition(pos) | ||
getRangeExtentsOfPosition(pos) | ||
getStackContext(startPos, rangeLabels) | ||
groupOperation(groupOp) | ||
initializeLocalCore() | ||
insertAtReferencePosition(pos, segment) | ||
loadCore(storage) | ||
localReferencePositionToPosition(lref) | ||
localRefToPos(localRef) | ||
onConnect() | ||
onDisconnect() | ||
posFromRelativePos(relativePos) | Given a position specified relative to a marker id, lookup the marker and convert the position to a character position. | |
processCore(message, local, localOpMetadata) | ||
processGCDataCore(serializer) | Runs serializer over the GC data for this SharedMatrix. All the IFluidHandle's represent routes to other objects. | |
removeLocalReference(lref) | ||
removeLocalReferencePosition(lref) | ||
removeRange(start, end) | ||
replaceRange(start, end, segment) | 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) | 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) | ||
submitSequenceMessage(message) | ||
summarizeCore(serializer) | ||
waitIntervalCollection(label) | ||
walkSegments(handler, start, end, accum, splitRange) | 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. |
Constructors
SharedSegmentSequence.(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 | ||
id | ||
attributes | ||
segmentFromSpec |
Properties
client
Signature:
protected client: Client;
id
Signature:
id: string;
loaded
Signature:
get loaded(): Promise<void>;
loadedDeferred
Signature:
protected loadedDeferred: Deferred<void>;
segmentFromSpec
Signature:
readonly segmentFromSpec: (spec: IJSONSegment) => ISegment;
Methods
addLocalReference
Deprecated
- use createLocalReferencePosition
Signature:
addLocalReference(lref: LocalReference): void;
Parameters
Parameter | Type | Description |
---|---|---|
lref |
Returns:
annotateRange
Annotates the range with the provided properties
Signature:
annotateRange(start: number, end: number, props: PropertySet, combiningOp?: ICombiningOp): void;
Parameters
Parameter | Type | Description |
---|---|---|
start | The inclusive start position of the range to annotate | |
end | The exclusive end position of the range to annotate | |
props | The properties to annotate the range with | |
combiningOp | Optional. Specifies how to combine values for the property, such as "incr" for increment. |
Returns:
applyStashedOp
Signature:
protected applyStashedOp(content: any): unknown;
Parameters
Parameter | Type | Description |
---|---|---|
content |
Returns:
createLocalReferencePosition
Signature:
createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined): ReferencePosition;
Parameters
Parameter | Type | Description |
---|---|---|
segment | ||
offset | ||
refType | ||
properties |
Returns:
createPositionReference
Deprecated
- use createLocalReferencePosition
Signature:
createPositionReference(segment: T, offset: number, refType: ReferenceType): LocalReference;
Parameters
Parameter | Type | Description |
---|---|---|
segment | ||
offset | ||
refType |
Returns:
didAttach
Signature:
protected didAttach(): void;
Returns:
getContainingSegment
Signature:
getContainingSegment(pos: number): {
segment: T;
offset: number;
};
Parameters
Parameter | Type | Description |
---|---|---|
pos |
Returns:
getCurrentSeq
Signature:
getCurrentSeq(): number;
Returns:
getIntervalCollection
Signature:
getIntervalCollection(label: string): IntervalCollection<SequenceInterval>;
Parameters
Parameter | Type | Description |
---|---|---|
label |
Returns:
IntervalCollectionSequenceInterval
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); …
getLength
Returns the length of the current sequence for the client
Signature:
getLength(): number;
Returns:
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 | The segment to get the position of |
Returns:
getPropertiesAtPosition
Signature:
getPropertiesAtPosition(pos: number): PropertySet;
Parameters
Parameter | Type | Description |
---|---|---|
pos |
Returns:
getRangeExtentsOfPosition
Signature:
getRangeExtentsOfPosition(pos: number): {
posStart: number;
posAfterEnd: number;
};
Parameters
Parameter | Type | Description |
---|---|---|
pos |
Returns:
getStackContext
Signature:
getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap;
Parameters
Parameter | Type | Description |
---|---|---|
startPos | ||
rangeLabels |
Returns:
groupOperation
Signature:
groupOperation(groupOp: IMergeTreeGroupMsg): void;
Parameters
Parameter | Type | Description |
---|---|---|
groupOp |
Returns:
initializeLocalCore
Signature:
protected initializeLocalCore(): void;
Returns:
insertAtReferencePosition
Signature:
insertAtReferencePosition(pos: ReferencePosition, segment: T): void;
Parameters
Parameter | Type | Description |
---|---|---|
pos | ||
segment |
Returns:
loadCore
Signature:
protected loadCore(storage: IChannelStorageService): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
storage |
Returns:
localReferencePositionToPosition
Signature:
localReferencePositionToPosition(lref: ReferencePosition): number;
Parameters
Parameter | Type | Description |
---|---|---|
lref |
Returns:
localRefToPos
Deprecated
- use localReferencePositionToPosition
Signature:
localRefToPos(localRef: LocalReference): number;
Parameters
Parameter | Type | Description |
---|---|---|
localRef |
Returns:
onConnect
Signature:
protected onConnect(): void;
Returns:
onDisconnect
Signature:
protected onDisconnect(): void;
Returns:
posFromRelativePos
Given a position specified relative to a marker id, lookup the marker and convert the position to a character position.
Signature:
posFromRelativePos(relativePos: IRelativePosition): number;
Parameters
Parameter | Type | Description |
---|---|---|
relativePos | Id of marker (may be indirect) and whether position is before or after marker. |
Returns:
processCore
Signature:
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
message | ||
local | ||
localOpMetadata |
Returns:
processGCDataCore
Runs serializer over the GC data for this SharedMatrix. All the IFluidHandle’s represent routes to other objects.
Signature:
protected processGCDataCore(serializer: SummarySerializer): void;
Parameters
Parameter | Type | Description |
---|---|---|
serializer |
Returns:
removeLocalReference
Deprecated
- use removeLocalReferencePosition
Signature:
removeLocalReference(lref: LocalReference): ReferencePosition;
Parameters
Parameter | Type | Description |
---|---|---|
lref |
Returns:
removeLocalReferencePosition
Signature:
removeLocalReferencePosition(lref: ReferencePosition): ReferencePosition;
Parameters
Parameter | Type | Description |
---|---|---|
lref |
Returns:
removeRange
Signature:
removeRange(start: number, end: number): IMergeTreeRemoveMsg;
Parameters
Parameter | Type | Description |
---|---|---|
start | The inclusive start of the range to remove | |
end | The exclusive end of the range to remove |
Returns:
replaceRange
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
Signature:
protected replaceRange(start: number, end: number, segment: ISegment): void;
Parameters
Parameter | Type | Description |
---|---|---|
start | The start of the range to replace | |
end | The end of the range to replace | |
segment | The segment that will replace the range |
Returns:
resolveRemoteClientPosition
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
Signature:
resolveRemoteClientPosition(remoteClientPosition: number, remoteClientRefSeq: number, remoteClientId: string): number;
Parameters
Parameter | Type | Description |
---|---|---|
remoteClientPosition | The remote client's position to resolve | |
remoteClientRefSeq | The reference sequence number of the remote client | |
remoteClientId | The client id of the remote client |
Returns:
reSubmitCore
Signature:
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
content | ||
localOpMetadata |
Returns:
submitSequenceMessage
Signature:
submitSequenceMessage(message: IMergeTreeOp): void;
Parameters
Parameter | Type | Description |
---|---|---|
message |
Returns:
summarizeCore
Signature:
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
Parameters
Parameter | Type | Description |
---|---|---|
serializer |
Returns:
waitIntervalCollection
Deprecated
- IntervalCollections are created on a first-write wins basis, and concurrent creates are supported. Use
getIntervalCollection
instead.
Signature:
waitIntervalCollection(label: string): Promise<IntervalCollection<SequenceInterval>>;
Parameters
Parameter | Type | Description |
---|---|---|
label |
Returns:
IntervalCollectionSequenceInterval
walkSegments
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.
Signature:
walkSegments<TClientData>(handler: ISegmentAction<TClientData>, start?: number, end?: number, accum?: TClientData, splitRange?: boolean): void;
Parameters
Parameter | Type | Description |
---|---|---|
handler | The function to handle each segment | |
start | Optional. The start of range walk. | |
end | Optional. The end of range walk | |
accum | Optional. An object that will be passed to the handler for accumulation | |
splitRange | Optional. Splits boundary segments on the range boundaries |
Returns: