@@ -26,7 +26,7 @@ import { MutableDocument } from '../model/document';
2626import { DocumentKey } from '../model/document_key' ;
2727import { IndexOffset } from '../model/field_index' ;
2828import { ResourcePath } from '../model/path' ;
29- import { debugAssert , debugCast , hardAssert } from '../util/assert' ;
29+ import { debugAssert , hardAssert } from '../util/assert' ;
3030import { primitiveComparator } from '../util/misc' ;
3131import { ObjectMap } from '../util/obj_map' ;
3232import { SortedMap } from '../util/sorted_map' ;
@@ -41,14 +41,12 @@ import {
4141 DbRemoteDocumentGlobalKey ,
4242 DbRemoteDocumentGlobalStore ,
4343 DbRemoteDocumentKey ,
44- DbRemoteDocumentReadTimeIndex ,
4544 DbRemoteDocumentStore ,
4645 DbTimestampKey
4746} from './indexeddb_sentinels' ;
4847import { getStore } from './indexeddb_transaction' ;
4948import {
5049 fromDbRemoteDocument ,
51- fromDbTimestampKey ,
5250 LocalSerializer ,
5351 toDbRemoteDocument ,
5452 toDbTimestampKey
@@ -411,77 +409,6 @@ export function newIndexedDbRemoteDocumentCache(
411409 return new IndexedDbRemoteDocumentCacheImpl ( serializer ) ;
412410}
413411
414- /**
415- * Returns the set of documents that have changed since the specified read
416- * time.
417- */
418- // PORTING NOTE: This is only used for multi-tab synchronization.
419- export function remoteDocumentCacheGetNewDocumentChanges (
420- remoteDocumentCache : IndexedDbRemoteDocumentCache ,
421- transaction : PersistenceTransaction ,
422- sinceReadTime : SnapshotVersion
423- ) : PersistencePromise < {
424- changedDocs : MutableDocumentMap ;
425- readTime : SnapshotVersion ;
426- } > {
427- const remoteDocumentCacheImpl = debugCast (
428- remoteDocumentCache ,
429- IndexedDbRemoteDocumentCacheImpl // We only support IndexedDb in multi-tab mode.
430- ) ;
431- let changedDocs = mutableDocumentMap ( ) ;
432-
433- let lastReadTime = toDbTimestampKey ( sinceReadTime ) ;
434-
435- const documentsStore = remoteDocumentsStore ( transaction ) ;
436- const range = IDBKeyRange . lowerBound ( lastReadTime , true ) ;
437- return documentsStore
438- . iterate (
439- { index : DbRemoteDocumentReadTimeIndex , range } ,
440- ( _ , dbRemoteDoc ) => {
441- // Unlike `getEntry()` and others, `getNewDocumentChanges()` parses
442- // the documents directly since we want to keep sentinel deletes.
443- const doc = fromDbRemoteDocument (
444- remoteDocumentCacheImpl . serializer ,
445- dbRemoteDoc
446- ) ;
447- changedDocs = changedDocs . insert ( doc . key , doc ) ;
448- lastReadTime = dbRemoteDoc . readTime ! ;
449- }
450- )
451- . next ( ( ) => {
452- return {
453- changedDocs,
454- readTime : fromDbTimestampKey ( lastReadTime )
455- } ;
456- } ) ;
457- }
458-
459- /**
460- * Returns the read time of the most recently read document in the cache, or
461- * SnapshotVersion.min() if not available.
462- */
463- // PORTING NOTE: This is only used for multi-tab synchronization.
464- export function remoteDocumentCacheGetLastReadTime (
465- transaction : PersistenceTransaction
466- ) : PersistencePromise < SnapshotVersion > {
467- const documentsStore = remoteDocumentsStore ( transaction ) ;
468-
469- // If there are no existing entries, we return SnapshotVersion.min().
470- let readTime = SnapshotVersion . min ( ) ;
471-
472- return documentsStore
473- . iterate (
474- { index : DbRemoteDocumentReadTimeIndex , reverse : true } ,
475- ( key , dbRemoteDoc , control ) => {
476- if ( dbRemoteDoc . readTime ) {
477- readTime = fromDbTimestampKey ( dbRemoteDoc . readTime ) ;
478- }
479- control . done ( ) ;
480- }
481- )
482- . next ( ( ) => readTime ) ;
483- }
484-
485412/**
486413 * Handles the details of adding and updating documents in the IndexedDbRemoteDocumentCache.
487414 *
0 commit comments