Skip to main content
Version: v2

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​

ParameterDescription
T

Properties​

PropertyAlertsModifiersTypeDescription
channelNamesBetareadonlyIterable<string>
lengthBetareadonlynumberTotal length of all attribution keys in this collection.

Methods​

MethodAlertsReturn TypeDescription
append(other)Betavoid
clone()BetaIAttributionCollection<T>
getAll()BetaIAttributionCollectionSpec<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)BetaAttributionKey | undefinedRetrieves the attribution key associated with the provided offset.
getKeysInOffsetRange(startOffset, endOffset, channel)Beta{ offset: number; key: AttributionKey; }[] | undefinedRetrieves 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)BetaIAttributionCollection<T>
update(name, channel)BetavoidUpdates this collection with new attribution data.

Property Details​

channelNames​

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 channelNames: Iterable<string>;

Type: Iterable<string>

length​

Total length of all attribution keys in this collection.

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 length: number;

Type: number

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(other: IAttributionCollection<T>): void;

Parameters​

ParameterTypeDescription
otherIAttributionCollection<T>

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(): 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 for existing users, but is not recommended for new users.

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 for existing users, but is not recommended for new users.

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

Signature​

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

Parameters​

ParameterModifiersTypeDescription
offsetnumber
channeloptionalstringWhen 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 for existing users, but is not recommended for new users.

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

Signature​

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

Parameters​

ParameterModifiersTypeDescription
startOffsetnumber
endOffsetoptionalnumber
channeloptionalstringWhen 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 for existing users, but is not recommended for new users.

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

Signature​

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

Parameters​

ParameterTypeDescription
posnumber

Returns​

Return type: IAttributionCollection<T>

update​

Updates this collection with new attribution data.

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​

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

Parameters​

ParameterTypeDescription
namestring | undefinedName 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).
channelIAttributionCollection<T>Updated collection for that channel.