Skip to main content

IAttributionCollection Interface

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 IAttributionCollection<T>

Type Parameters

Parameter Description
T

Properties

Property Alerts Modifiers Type Description
channelNames Alpha readonly Iterable<string>
length Alpha readonly number Total length of all attribution keys in this collection.

Methods

Method Alerts Return Type Description
append(other) Alpha void
clone() Alpha IAttributionCollection<T>
getAll() Alpha IAttributionCollectionSpec<T> Retrieve all key/offset pairs stored on this segment. Entries should be ordered by offset, such that the ith result's attribution key applies to offsets in the open range between the ith offset and the i+1th offset. The last entry's key applies to the open interval from the last entry's offset to this collection's length.
getAtOffset(offset, channel) Alpha AttributionKey | undefined Retrieves the attribution key associated with the provided offset.
getKeysInOffsetRange(startOffset, endOffset, channel) Alpha { offset: number; key: AttributionKey; }[] | undefined Retrieves all the [Offset, Attribution key] pairs for the provided offset range. Note: The returned array is sorted by offset. The first offset in response could be lower than the startOffset as the Attribution Key for the startOffset could start at a lower offset than the startOffset in case where Attribution key offset boundaries don't align exactly with startOffset. Example: If the Attribution Offsets in the segment is [0, 10, 20, 30, 40] and request is for (startOffset: 5, endOffset: 25), then result would be [(offset: 0, key: key1), (offset:10, key: key2), (offset:20, key: key3)].
splitAt(pos) Alpha IAttributionCollection<T>
update(name, channel) Alpha void Updates this collection with new attribution data.

Property Details

channelNames

This API is provided as an alpha preview and may change without notice.

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

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

Signature

readonly channelNames: Iterable<string>;

Type: Iterable<string>

length

Total length of all attribution keys in this collection.

This API is provided as an alpha preview and may change without notice.

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

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

Signature

readonly length: number;

Type: number

Method Details

append

This API is provided as an alpha preview and may change without notice.

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

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

Signature

append(other: IAttributionCollection<T>): void;

Parameters

Parameter Type Description
other IAttributionCollection<T>

clone

This API is provided as an alpha preview and may change without notice.

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

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

Signature

clone(): IAttributionCollection<T>;

Returns

Return type: IAttributionCollection<T>

getAll

Retrieve all key/offset pairs stored on this segment. Entries should be ordered by offset, such that the ith result's attribution key applies to offsets in the open range between the ith offset and the i+1th offset. The last entry's key applies to the open interval from the last entry's offset to this collection's length.

This API is provided as an alpha preview and may change without notice.

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

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

Signature

getAll(): IAttributionCollectionSpec<T>;

Returns

Return type: IAttributionCollectionSpec<T>

getAtOffset

Retrieves the attribution key associated with the provided offset.

This API is provided as an alpha preview and may change without notice.

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

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

Signature

getAtOffset(offset: number, channel?: string): AttributionKey | undefined;

Parameters

Parameter Modifiers Type Description
offset number
channel optional string When specified, gets an attribution key associated with a particular channel.

Returns

Return type: AttributionKey | undefined

getKeysInOffsetRange

Retrieves all the [Offset, Attribution key] pairs for the provided offset range. Note: The returned array is sorted by offset. The first offset in response could be lower than the startOffset as the Attribution Key for the startOffset could start at a lower offset than the startOffset in case where Attribution key offset boundaries don't align exactly with startOffset. Example: If the Attribution Offsets in the segment is [0, 10, 20, 30, 40] and request is for (startOffset: 5, endOffset: 25), then result would be [(offset: 0, key: key1), (offset:10, key: key2), (offset:20, key: key3)].

This API is provided as an alpha preview and may change without notice.

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

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

Signature

getKeysInOffsetRange(startOffset: number, endOffset?: number, channel?: string): {
offset: number;
key: AttributionKey;
}[] | undefined;

Parameters

Parameter Modifiers Type Description
startOffset number
endOffset optional number
channel optional string When specified, gets attribution keys associated with a particular channel.

Returns

  • undefined if the provided channel is not found or list of attribution keys along with the corresponding offset start boundary.

Return type: { offset: number; key: AttributionKey; }[] | undefined

splitAt

This API is provided as an alpha preview and may change without notice.

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

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

Signature

splitAt(pos: number): IAttributionCollection<T>;

Parameters

Parameter Type Description
pos number

Returns

Return type: IAttributionCollection<T>

update

Updates this collection with new attribution data.

This API is provided as an alpha preview and may change without notice.

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

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

Signature

update(name: string | undefined, channel: IAttributionCollection<T>): void;

Parameters

Parameter Type Description
name string | undefined Name of the channel that requires an update. Undefined signifies the root channel. Updates apply only to the individual channel (i.e. if an attribution policy needs to update the root channel and 4 other channels, it should call .update 5 times).
channel IAttributionCollection<T> Updated collection for that channel.