Skip to main content
Version: v2

ISegment Interface

A segment representing a portion of the merge tree. Segments are leaf nodes of the merge tree and contain data.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here.

Signature​

export interface ISegment

Properties​

PropertyAlertsModifiersTypeDescription
attributionBetaoptionalIAttributionCollection<AttributionKey>

Stores attribution keys associated with offsets of this segment. This data is only persisted if MergeTree's attributions.track flag is set to true. Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have attribution === undefined until ack.

Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.

cachedLengthBetanumberThe length of the contents of the node.
propertiesBetaoptionalPropertySetProperties that have been added to this segment via annotation.
trackingCollectionBetareadonlyTrackingGroupCollection
typeBetareadonlystring

Methods​

MethodAlertsReturn TypeDescription
append(segment)Betavoid
canAppend(segment)Betaboolean
clone()BetaISegment
isLeaf()Betathis is ISegment
splitAt(pos)BetaISegment | undefined
toJSONObject()Betaany

Property Details​

attribution​

Stores attribution keys associated with offsets of this segment. This data is only persisted if MergeTree's attributions.track flag is set to true. Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have attribution === undefined until ack.

Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

attribution?: IAttributionCollection<AttributionKey>;

Type: IAttributionCollection<AttributionKey>

Remarks​

There are plans to make the shape of the data stored extensible in a couple ways:

  1. Injection of custom attribution information associated with the segment (ex: copy-paste of content but keeping the old attribution information).
  1. Storage of multiple "channels" of information (ex: track property changes separately from insertion, or only attribute certain property modifications, etc.)

cachedLength​

The length of the contents of the node.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

cachedLength: number;

Type: number

properties​

Properties that have been added to this segment via annotation.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

properties?: PropertySet;

Type: PropertySet

trackingCollection​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

readonly trackingCollection: TrackingGroupCollection;

Type: TrackingGroupCollection

type​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

readonly type: string;

Type: string

Method Details​

append​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

append(segment: ISegment): void;

Parameters​

ParameterTypeDescription
segmentISegment

canAppend​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

canAppend(segment: ISegment): boolean;

Parameters​

ParameterTypeDescription
segmentISegment

Returns​

Return type: boolean

clone​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

clone(): ISegment;

Returns​

Return type: ISegment

isLeaf​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

isLeaf(): this is ISegment;

Returns​

Return type: this is ISegment

splitAt​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

splitAt(pos: number): ISegment | undefined;

Parameters​

ParameterTypeDescription
posnumber

Returns​

Return type: ISegment | undefined

toJSONObject​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

toJSONObject(): any;

Returns​

Return type: any