ISegment Interface
A segment representing a portion of the merge tree. Segments are leaf nodes of the merge tree and contain data.
To use, import via @fluidframework/merge-tree/legacy
.
For more information about our API support guarantees, see here.
Signature
export interface ISegment
Properties
Property | Alerts | Modifiers | Type | Description |
---|---|---|---|---|
attribution | Alpha |
optional |
IAttributionCollection<AttributionKey> |
Stores attribution keys associated with offsets of this segment. This data is only persisted if MergeTree's Keys can be used opaquely with an IAttributor or a container runtime that provides attribution. |
cachedLength | Alpha |
number | The length of the contents of the node. | |
properties | Alpha |
optional |
PropertySet | Properties that have been added to this segment via annotation. |
trackingCollection | Alpha |
readonly |
TrackingGroupCollection | |
type | Alpha |
readonly |
string |
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
append(segment) | Alpha |
void | |
canAppend(segment) | Alpha |
boolean | |
clone() | Alpha |
ISegment | |
isLeaf() | Alpha |
this is ISegment | |
splitAt(pos) | Alpha |
ISegment | undefined | |
toJSONObject() | Alpha |
any |
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.
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:
-
Injection of custom attribution information associated with the segment (ex: copy-paste of content but keeping the old attribution information).
-
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.
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.
For more information about our API support guarantees, see here.
Signature
properties?: PropertySet;
Type: PropertySet
trackingCollection
For more information about our API support guarantees, see here.
Signature
readonly trackingCollection: TrackingGroupCollection;
Type: TrackingGroupCollection
type
For more information about our API support guarantees, see here.
Signature
readonly type: string;
Type: string
Method Details
append
For more information about our API support guarantees, see here.
Signature
append(segment: ISegment): void;
Parameters
Parameter | Type | Description |
---|---|---|
segment | ISegment |
canAppend
For more information about our API support guarantees, see here.
Signature
canAppend(segment: ISegment): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
segment | ISegment |
Returns
Return type: boolean
clone
For more information about our API support guarantees, see here.
Signature
clone(): ISegment;
Returns
Return type: ISegment
isLeaf
For more information about our API support guarantees, see here.
Signature
isLeaf(): this is ISegment;
Returns
Return type: this is ISegment
splitAt
For more information about our API support guarantees, see here.
Signature
splitAt(pos: number): ISegment | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
pos | number |
Returns
Return type: ISegment | undefined
toJSONObject
For more information about our API support guarantees, see here.
Signature
toJSONObject(): any;
Returns
Return type: any