RangeTracker Class
Packages > @fluidframework/common-utils > RangeTracker
Helper class that keeps track of the relation between two ranges in a 1:N fashion. Primary is continuous and always maps to a single value in secondary above the base value. The range defines an increasing step function.
Used by deli to keep track of the branch map
Signature:
export declare class RangeTracker
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(primary) | Constructs a new instance of the RangeTracker class |
|
(constructor)(primary, secondary) | Constructs a new instance of the RangeTracker class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
base | number | ||
primaryHead | number | Getter for the last primary that was added | |
secondaryHead | number | undefined | Getter for the last secondary that was added |
Methods
Method | Modifiers | Description |
---|---|---|
add(primary, secondary) | Add a primary, secondary pair to the range | |
get(primary) | Get the closest range to the primary | |
serialize() | Returns a serialized form of the RangeTracker | |
updateBase(primary) | Update the range of primary |
Constructors
RangeTracker.(constructor)
Constructs a new instance of the RangeTracker
class
Signature:
constructor(primary: IRangeTrackerSnapshot);
Parameters
Parameter | Type | Description |
---|---|---|
primary | IRangeTrackerSnapshot |
RangeTracker.(constructor)
Constructs a new instance of the RangeTracker
class
Signature:
constructor(primary: number, secondary: number);
Parameters
Parameter | Type | Description |
---|---|---|
primary | number | |
secondary | number |
Properties
base
Signature:
get base(): number;
primaryHead
Getter for the last primary that was added
Signature:
get primaryHead(): number;
secondaryHead
Getter for the last secondary that was added
Signature:
get secondaryHead(): number | undefined;
Methods
add
Add a primary, secondary pair to the range
Signature:
add(primary: number, secondary: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
primary | number | the primary number in the range |
secondary | number | the secondary number in the range |
Returns:
void
get
Get the closest range to the primary
Signature:
get(primary: number): number;
Parameters
Parameter | Type | Description |
---|---|---|
primary | number | the primary value to look for |
Returns:
number
the closest range to the primary
serialize
Returns a serialized form of the RangeTracker
Signature:
serialize(): IRangeTrackerSnapshot;
Returns:
updateBase
Update the range of primary
Signature:
updateBase(primary: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
primary | number | the primary value to update |
Returns:
void