Skip to content

Commit ada9cb7

Browse files
Review
1 parent 993228f commit ada9cb7

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/firestore/src/model/field_index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const INITIAL_LARGEST_BATCH_ID = -1;
3333
* The initial sequence number for each index. Gets updated during index
3434
* backfill.
3535
*/
36-
const INITIAL_SEQUENCE_NUMBER = 0;
36+
export const INITIAL_SEQUENCE_NUMBER = 0;
3737

3838
/**
3939
* An index definition for field indexes in Firestore.
@@ -126,10 +126,15 @@ function indexSegmentComparator(
126126
return primitiveComparator(left.kind, right.kind);
127127
}
128128

129-
/** Stores the "high water mark" that indicates how updated the Index is for the current user. */
129+
/**
130+
* Stores the "high water mark" that indicates how updated the Index is for the
131+
* current user.
132+
*/
130133
export class IndexState {
131134
constructor(
132-
/** Indicates when the index was last updated (relative to other indexes). */
135+
/**
136+
* Indicates when the index was last updated (relative to other indexes).
137+
*/
133138
readonly sequenceNumber: number,
134139
/** The the latest indexed read time, document and batch id. */
135140
readonly offset: IndexOffset

packages/firestore/test/util/helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ import {
7777
IndexKind,
7878
IndexOffset,
7979
IndexSegment,
80-
IndexState
80+
IndexState,
81+
INITIAL_SEQUENCE_NUMBER
8182
} from '../../src/model/field_index';
8283
import { FieldMask } from '../../src/model/field_mask';
8384
import {
@@ -242,7 +243,7 @@ export function fieldIndex(
242243
(options.fields ?? []).map(
243244
entry => new IndexSegment(field(entry[0]), entry[1])
244245
),
245-
new IndexState(-1, options.offset ?? IndexOffset.min())
246+
new IndexState(INITIAL_SEQUENCE_NUMBER, options.offset ?? IndexOffset.min())
246247
);
247248
}
248249

0 commit comments

Comments
 (0)