Skip to content

Commit b4cc6db

Browse files
authored
Merge d88f9f1 into d756f4e
2 parents d756f4e + d88f9f1 commit b4cc6db

17 files changed

+1351
-223
lines changed

packages/firestore/src/local/document_overlay_cache.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ export interface DocumentOverlayCache {
4343
key: DocumentKey
4444
): PersistencePromise<Overlay | null>;
4545

46+
/**
47+
* Gets the saved overlay mutation for the given document keys. Skips keys for
48+
* which there are no overlays.
49+
*/
50+
getOverlays(
51+
transaction: PersistenceTransaction,
52+
keys: DocumentKeySet
53+
): PersistencePromise<OverlayMap>;
54+
4655
/**
4756
* Saves the given document mutation map to persistence as overlays.
4857
* All overlays will have their largest batch id set to `largestBatchId`.

packages/firestore/src/local/indexeddb_document_overlay_cache.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ export class IndexedDbDocumentOverlayCache implements DocumentOverlayCache {
8181
});
8282
}
8383

84+
getOverlays(
85+
transaction: PersistenceTransaction,
86+
keys: DocumentKeySet
87+
): PersistencePromise<OverlayMap> {
88+
const result = newOverlayMap();
89+
const promises: Array<PersistencePromise<void>> = [];
90+
keys.forEach(key => {
91+
promises.push(
92+
this.getOverlay(transaction, key).next(overlay => {
93+
if (overlay !== null) {
94+
result.set(key, overlay);
95+
}
96+
})
97+
);
98+
});
99+
return PersistencePromise.waitFor(promises).next(() => result);
100+
}
101+
84102
saveOverlays(
85103
transaction: PersistenceTransaction,
86104
largestBatchId: number,

0 commit comments

Comments
 (0)