/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { LocalReferenceCollection } from "./localReference.js"; import type { MergeTree } from "./mergeTree.js"; import type { ISegment, MergeBlock } from "./mergeTreeNodes.js"; import type { IHasInsertionInfo, IHasRemovalInfo, IMergeNodeInfo } from "./segmentInfos.js"; /** * This is a special segment that is not bound or known by the merge tree itself, * but the segment itself pretends to be a removed segment at an endpoint of the * tree. It is removed so it appears as a undefined/0 length segment. This segment * adds the capability to hold local references that have been detached from the * real merge tree, and give the appearance that they exist at an endpoint of the * tree. * * This is useful today in 2 cases: detached references and interval stickiness. * * In general, local references only become detached when the tree becomes empty * and the EndOfTreeSegment allows us to gracefully handle that case by giving * those references a place to live. * * In the case of interval stickiness, it is desirable to be able to refer to * the position immediately after or before a segment, in order for the endpoint * of an interval to be exclusive. This means that in order to support intervals * that are exclusive and also include the first or last segment of the tree, it * must be possible in some way to refer to a position before or after the tree * respectively. The endpoint segments allow us to support such behavior. */ declare abstract class BaseEndpointSegment implements IMergeNodeInfo, IHasRemovalInfo, IHasInsertionInfo { protected readonly mergeTree: MergeTree; constructor(mergeTree: MergeTree); removes: { readonly type: "setRemove"; readonly seq: 0; readonly clientId: -1; }[]; attribution: undefined; propertyManager: undefined; properties: undefined; cachedLength: number; insert: { readonly type: "insert"; readonly seq: 0; readonly clientId: -1; }; isLeaf(): this is ISegment; protected abstract endpointSegmentProps(): { parent: MergeBlock; index: number; depth: number; }; get parent(): MergeBlock; get index(): number; abstract get ordinal(): string; localRefs?: LocalReferenceCollection; get segmentGroups(): never; get trackingCollection(): never; addProperties: () => never; clone: () => never; canAppend: () => never; append: () => never; splitAt: () => never; toJSONObject: () => never; ack: () => never; } /** * The position immediately prior to the start of the tree */ export declare class StartOfTreeSegment extends BaseEndpointSegment implements ISegment { type: string; readonly endpointType = "start"; /** * this segment pretends to be a sibling of the first real segment. * so compute the necessary properties to pretend to be that segment. */ protected endpointSegmentProps(): { parent: MergeBlock; index: number; depth: number; }; get ordinal(): string; } /** * The position immediately after the end of the tree */ export declare class EndOfTreeSegment extends BaseEndpointSegment implements ISegment { type: string; readonly endpointType = "end"; /** * this segment pretends to be a sibling of the last real segment. * so compute the necessary properties to pretend to be that segment. */ protected endpointSegmentProps(): { parent: MergeBlock; index: number; depth: number; }; get ordinal(): string; } export {}; //# sourceMappingURL=endOfTreeSegment.d.ts.map