@firebase/firestore 3.4.4-canary.2dd99ae2d → 3.4.4-canary.3fe2c4a03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/firestore/src/core/target.d.ts +8 -4
- package/dist/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/firestore/src/local/indexeddb_persistence.d.ts +4 -4
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/firestore/src/local/indexeddb_schema.d.ts +149 -7
- package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/firestore/src/local/local_serializer.d.ts +7 -2
- package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/memory_persistence.d.ts +3 -2
- package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/firestore/src/local/persistence.d.ts +2 -2
- package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +2 -2
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/firestore/test/util/helpers.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm2017.js +3357 -3133
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3588 -3382
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +475 -212
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +475 -212
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3535 -3311
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +178 -14
- package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +4 -4
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +149 -7
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +7 -2
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/memory_persistence.d.ts +3 -2
- package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/lite/firestore/src/local/persistence.d.ts +2 -2
- package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +2 -2
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +1146 -1143
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +332 -331
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +36 -29
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +36 -29
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +301 -298
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +2 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +121 -121
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +4 -4
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +149 -7
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +7 -2
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +3 -2
- package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/lite/packages/firestore/src/local/persistence.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -2
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +177 -177
- package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
- package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +4 -4
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +149 -7
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +7 -2
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/memory_persistence.d.ts +3 -2
- package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
- package/dist/packages/firestore/src/local/persistence.d.ts +2 -2
- package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
- package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +2 -2
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
- package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
- package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
- package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/private.d.ts +178 -14
- package/package.json +9 -9
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { BatchId, TargetId } from '../core/types';
|
|
18
|
+
import { IndexKind } from '../model/field_index';
|
|
18
19
|
import { ResourcePath } from '../model/path';
|
|
19
20
|
import { BundledQuery } from '../protos/firestore_bundle_proto';
|
|
20
21
|
import { Document as ProtoDocument, DocumentsTarget as ProtoDocumentsTarget, QueryTarget as ProtoQueryTarget, Write as ProtoWrite } from '../protos/firestore_proto_api';
|
|
21
22
|
import { EncodedResourcePath } from './encoded_resource_path';
|
|
23
|
+
export declare const INDEXING_SCHEMA_VERSION = 12;
|
|
22
24
|
/**
|
|
23
25
|
* Schema Version for the Web client:
|
|
24
26
|
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
@@ -37,8 +39,9 @@ import { EncodedResourcePath } from './encoded_resource_path';
|
|
|
37
39
|
* an auto-incrementing ID. This is required for Index-Free queries.
|
|
38
40
|
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
39
41
|
* 11. Add bundles and named_queries for bundle support.
|
|
42
|
+
* 12. Add indexing support.
|
|
40
43
|
*/
|
|
41
|
-
export declare const SCHEMA_VERSION
|
|
44
|
+
export declare const SCHEMA_VERSION: number;
|
|
42
45
|
/**
|
|
43
46
|
* Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects.
|
|
44
47
|
*/
|
|
@@ -763,9 +766,7 @@ export declare class DbClientMetadata {
|
|
|
763
766
|
/** Object keys in the 'clientMetadata' store are clientId strings. */
|
|
764
767
|
export declare type DbClientMetadataKey = string;
|
|
765
768
|
export declare type DbBundlesKey = string;
|
|
766
|
-
/**
|
|
767
|
-
* A object representing a bundle loaded by the SDK.
|
|
768
|
-
*/
|
|
769
|
+
/** An object representing a bundle loaded by the SDK. */
|
|
769
770
|
export declare class DbBundle {
|
|
770
771
|
/** The ID of the loaded bundle. */
|
|
771
772
|
bundleId: string;
|
|
@@ -785,9 +786,7 @@ export declare class DbBundle {
|
|
|
785
786
|
version: number);
|
|
786
787
|
}
|
|
787
788
|
export declare type DbNamedQueriesKey = string;
|
|
788
|
-
/**
|
|
789
|
-
* A object representing a named query loaded by the SDK via a bundle.
|
|
790
|
-
*/
|
|
789
|
+
/** An object representing a named query loaded by the SDK via a bundle. */
|
|
791
790
|
export declare class DbNamedQuery {
|
|
792
791
|
/** The name of the query. */
|
|
793
792
|
name: string;
|
|
@@ -806,15 +805,158 @@ export declare class DbNamedQuery {
|
|
|
806
805
|
/** The query saved in the bundle. */
|
|
807
806
|
bundledQuery: BundledQuery);
|
|
808
807
|
}
|
|
808
|
+
/** The key for each index consisting of just the index id. */
|
|
809
|
+
export declare type DbIndexConfigurationKey = number;
|
|
810
|
+
/** An object representing the global configuration for a field index. */
|
|
811
|
+
export declare class DbIndexConfiguration {
|
|
812
|
+
/**
|
|
813
|
+
* The index id for this entry. Undefined for indexes that are not yet
|
|
814
|
+
* persisted.
|
|
815
|
+
*/
|
|
816
|
+
indexId: number | undefined;
|
|
817
|
+
/** The collection group this index belongs to. */
|
|
818
|
+
collectionGroup: string;
|
|
819
|
+
/** The fields to index for this index. */
|
|
820
|
+
fields: Array<[name: string, kind: IndexKind]>;
|
|
821
|
+
/** Name of the IndexedDb object store. */
|
|
822
|
+
static store: string;
|
|
823
|
+
static keyPath: string;
|
|
824
|
+
/**
|
|
825
|
+
* An index that provides access to the index configurations by collection
|
|
826
|
+
* group.
|
|
827
|
+
*
|
|
828
|
+
* PORTING NOTE: iOS and Android maintain this index in-memory, but this is
|
|
829
|
+
* not possible here as the Web client supports concurrent access to
|
|
830
|
+
* persistence via multi-tab.
|
|
831
|
+
*/
|
|
832
|
+
static collectionGroupIndex: string;
|
|
833
|
+
static collectionGroupIndexPath: string;
|
|
834
|
+
constructor(
|
|
835
|
+
/**
|
|
836
|
+
* The index id for this entry. Undefined for indexes that are not yet
|
|
837
|
+
* persisted.
|
|
838
|
+
*/
|
|
839
|
+
indexId: number | undefined,
|
|
840
|
+
/** The collection group this index belongs to. */
|
|
841
|
+
collectionGroup: string,
|
|
842
|
+
/** The fields to index for this index. */
|
|
843
|
+
fields: Array<[name: string, kind: IndexKind]>);
|
|
844
|
+
}
|
|
845
|
+
/** The key for each index state consisting of the index id and its user id. */
|
|
846
|
+
export declare type DbIndexStateKey = [number, string];
|
|
847
|
+
/**
|
|
848
|
+
* An object describing how up-to-date the index backfill is for each user and
|
|
849
|
+
* index.
|
|
850
|
+
*/
|
|
851
|
+
export declare class DbIndexState {
|
|
852
|
+
/** The index id for this entry. */
|
|
853
|
+
indexId: number;
|
|
854
|
+
/** The user id for this entry. */
|
|
855
|
+
uid: string;
|
|
856
|
+
/**
|
|
857
|
+
* A number that indicates when the index was last updated (relative to
|
|
858
|
+
* other indexes).
|
|
859
|
+
*/
|
|
860
|
+
sequenceNumber: number;
|
|
861
|
+
/**
|
|
862
|
+
* The latest read time that has been indexed by Firestore for this field
|
|
863
|
+
* index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed.
|
|
864
|
+
*/
|
|
865
|
+
readTime: DbTimestamp;
|
|
866
|
+
/**
|
|
867
|
+
* The last document that has been indexed for this field index. Empty if
|
|
868
|
+
* no documents have been indexed.
|
|
869
|
+
*/
|
|
870
|
+
documentKey: EncodedResourcePath;
|
|
871
|
+
/**
|
|
872
|
+
* The largest mutation batch id that has been processed for this index. -1
|
|
873
|
+
* if no mutations have been indexed.
|
|
874
|
+
*/
|
|
875
|
+
largestBatchId: number;
|
|
876
|
+
/** Name of the IndexedDb object store. */
|
|
877
|
+
static store: string;
|
|
878
|
+
static keyPath: string[];
|
|
879
|
+
/**
|
|
880
|
+
* An index that provides access to documents in a collection sorted by last
|
|
881
|
+
* update time. Used by the backfiller.
|
|
882
|
+
*
|
|
883
|
+
* PORTING NOTE: iOS and Android maintain this index in-memory, but this is
|
|
884
|
+
* not possible here as the Web client supports concurrent access to
|
|
885
|
+
* persistence via multi-tab.
|
|
886
|
+
*/
|
|
887
|
+
static sequenceNumberIndex: string;
|
|
888
|
+
static sequenceNumberIndexPath: string[];
|
|
889
|
+
constructor(
|
|
890
|
+
/** The index id for this entry. */
|
|
891
|
+
indexId: number,
|
|
892
|
+
/** The user id for this entry. */
|
|
893
|
+
uid: string,
|
|
894
|
+
/**
|
|
895
|
+
* A number that indicates when the index was last updated (relative to
|
|
896
|
+
* other indexes).
|
|
897
|
+
*/
|
|
898
|
+
sequenceNumber: number,
|
|
899
|
+
/**
|
|
900
|
+
* The latest read time that has been indexed by Firestore for this field
|
|
901
|
+
* index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed.
|
|
902
|
+
*/
|
|
903
|
+
readTime: DbTimestamp,
|
|
904
|
+
/**
|
|
905
|
+
* The last document that has been indexed for this field index. Empty if
|
|
906
|
+
* no documents have been indexed.
|
|
907
|
+
*/
|
|
908
|
+
documentKey: EncodedResourcePath,
|
|
909
|
+
/**
|
|
910
|
+
* The largest mutation batch id that has been processed for this index. -1
|
|
911
|
+
* if no mutations have been indexed.
|
|
912
|
+
*/
|
|
913
|
+
largestBatchId: number);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* The key for each index entry consists of the index id and its user id,
|
|
917
|
+
* the encoded array and directional value for the indexed fields as well as
|
|
918
|
+
* the encoded document path for the indexed document.
|
|
919
|
+
*/
|
|
920
|
+
export declare type DbIndexEntryKey = [number, string, Uint8Array, Uint8Array, string];
|
|
921
|
+
/** An object that stores the encoded entries for all documents and fields. */
|
|
922
|
+
export declare class DbIndexEntry {
|
|
923
|
+
/** The index id for this entry. */
|
|
924
|
+
indexId: number;
|
|
925
|
+
/** The user id for this entry. */
|
|
926
|
+
uid: string;
|
|
927
|
+
/** The encoded array index value for this entry. */
|
|
928
|
+
arrayValue: Uint8Array;
|
|
929
|
+
/** The encoded directional value for equality and inequality filters. */
|
|
930
|
+
directionalValue: Uint8Array;
|
|
931
|
+
/** The document key this entry points to. */
|
|
932
|
+
documentKey: EncodedResourcePath;
|
|
933
|
+
/** Name of the IndexedDb object store. */
|
|
934
|
+
static store: string;
|
|
935
|
+
static keyPath: string[];
|
|
936
|
+
constructor(
|
|
937
|
+
/** The index id for this entry. */
|
|
938
|
+
indexId: number,
|
|
939
|
+
/** The user id for this entry. */
|
|
940
|
+
uid: string,
|
|
941
|
+
/** The encoded array index value for this entry. */
|
|
942
|
+
arrayValue: Uint8Array,
|
|
943
|
+
/** The encoded directional value for equality and inequality filters. */
|
|
944
|
+
directionalValue: Uint8Array,
|
|
945
|
+
/** The document key this entry points to. */
|
|
946
|
+
documentKey: EncodedResourcePath);
|
|
947
|
+
}
|
|
809
948
|
export declare const V1_STORES: string[];
|
|
810
949
|
export declare const V3_STORES: string[];
|
|
811
950
|
export declare const V4_STORES: string[];
|
|
812
951
|
export declare const V6_STORES: string[];
|
|
813
952
|
export declare const V8_STORES: string[];
|
|
814
953
|
export declare const V11_STORES: string[];
|
|
954
|
+
export declare const V12_STORES: string[];
|
|
815
955
|
/**
|
|
816
956
|
* The list of all default IndexedDB stores used throughout the SDK. This is
|
|
817
957
|
* used when creating transactions so that access across all stores is done
|
|
818
958
|
* atomically.
|
|
819
959
|
*/
|
|
820
960
|
export declare const ALL_STORES: string[];
|
|
961
|
+
/** Returns the object stores for the provided schema. */
|
|
962
|
+
export declare function getObjectStores(schemaVersion: number): string[];
|
|
@@ -14,14 +14,16 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { User } from '../auth/user';
|
|
17
18
|
import { BundleMetadata, NamedQuery } from '../core/bundle';
|
|
18
19
|
import { Query } from '../core/query';
|
|
19
20
|
import { SnapshotVersion } from '../core/snapshot_version';
|
|
20
21
|
import { MutableDocument } from '../model/document';
|
|
22
|
+
import { FieldIndex, IndexOffset } from '../model/field_index';
|
|
21
23
|
import { MutationBatch } from '../model/mutation_batch';
|
|
22
|
-
import {
|
|
24
|
+
import { BundledQuery as ProtoBundledQuery, BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto';
|
|
23
25
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
24
|
-
import { DbBundle, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget, DbTimestampKey } from './indexeddb_schema';
|
|
26
|
+
import { DbBundle, DbIndexConfiguration, DbIndexState, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget, DbTimestampKey } from './indexeddb_schema';
|
|
25
27
|
import { TargetData } from './target_data';
|
|
26
28
|
/** Serializer for values stored in the LocalStore. */
|
|
27
29
|
export declare class LocalSerializer {
|
|
@@ -61,3 +63,6 @@ export declare function fromBundledQuery(bundledQuery: ProtoBundledQuery): Query
|
|
|
61
63
|
export declare function fromProtoNamedQuery(namedQuery: ProtoNamedQuery): NamedQuery;
|
|
62
64
|
/** Decodes a BundleMetadata proto into a BundleMetadata object. */
|
|
63
65
|
export declare function fromBundleMetadata(metadata: ProtoBundleMetadata): BundleMetadata;
|
|
66
|
+
export declare function toDbIndexConfiguration(index: FieldIndex): DbIndexConfiguration;
|
|
67
|
+
export declare function fromDbIndexConfiguration(index: DbIndexConfiguration, state: DbIndexState | null): FieldIndex;
|
|
68
|
+
export declare function toDbIndexState(indexId: number, user: User, sequenceNumber: number, offset: IndexOffset): DbIndexState;
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { Target } from '../core/target';
|
|
18
|
+
import { DocumentKeySet, DocumentMap } from '../model/collections';
|
|
19
|
+
import { FieldIndex, IndexOffset } from '../model/field_index';
|
|
17
20
|
import { ResourcePath } from '../model/path';
|
|
18
21
|
import { IndexManager } from './index_manager';
|
|
19
22
|
import { PersistencePromise } from './persistence_promise';
|
|
@@ -25,6 +28,14 @@ export declare class MemoryIndexManager implements IndexManager {
|
|
|
25
28
|
private collectionParentIndex;
|
|
26
29
|
addToCollectionParentIndex(transaction: PersistenceTransaction, collectionPath: ResourcePath): PersistencePromise<void>;
|
|
27
30
|
getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
|
|
31
|
+
addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
32
|
+
deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
|
|
33
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
|
|
34
|
+
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
35
|
+
getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
|
|
36
|
+
getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
|
|
37
|
+
updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
|
|
38
|
+
updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
|
|
28
39
|
}
|
|
29
40
|
/**
|
|
30
41
|
* Internal implementation of the collection-parent index exposed by MemoryIndexManager.
|
|
@@ -19,6 +19,7 @@ import { ListenSequenceNumber, TargetId } from '../core/types';
|
|
|
19
19
|
import { Document } from '../model/document';
|
|
20
20
|
import { DocumentKey } from '../model/document_key';
|
|
21
21
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
22
|
+
import { IndexManager } from './index_manager';
|
|
22
23
|
import { ActiveTargets, LruDelegate, LruGarbageCollector, LruParams } from './lru_garbage_collector';
|
|
23
24
|
import { MemoryBundleCache } from './memory_bundle_cache';
|
|
24
25
|
import { MemoryIndexManager } from './memory_index_manager';
|
|
@@ -62,8 +63,8 @@ export declare class MemoryPersistence implements Persistence {
|
|
|
62
63
|
get started(): boolean;
|
|
63
64
|
setDatabaseDeletedListener(): void;
|
|
64
65
|
setNetworkEnabled(): void;
|
|
65
|
-
getIndexManager(): MemoryIndexManager;
|
|
66
|
-
getMutationQueue(user: User): MutationQueue;
|
|
66
|
+
getIndexManager(user: User): MemoryIndexManager;
|
|
67
|
+
getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
|
|
67
68
|
getTargetCache(): MemoryTargetCache;
|
|
68
69
|
getRemoteDocumentCache(): MemoryRemoteDocumentCache;
|
|
69
70
|
getBundleCache(): MemoryBundleCache;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { Document } from '../model/document';
|
|
18
18
|
import { DocumentKey } from '../model/document_key';
|
|
19
|
-
import { IndexManager } from './index_manager';
|
|
20
19
|
import { PersistencePromise } from './persistence_promise';
|
|
21
20
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
22
21
|
import { RemoteDocumentCache } from './remote_document_cache';
|
|
@@ -27,9 +26,8 @@ export interface MemoryRemoteDocumentCache extends RemoteDocumentCache {
|
|
|
27
26
|
/**
|
|
28
27
|
* Creates a new memory-only RemoteDocumentCache.
|
|
29
28
|
*
|
|
30
|
-
* @param indexManager - A class that manages collection group indices.
|
|
31
29
|
* @param sizer - Used to assess the size of a document. For eager GC, this is
|
|
32
30
|
* expected to just return 0 to avoid unnecessarily doing the work of
|
|
33
31
|
* calculating the size.
|
|
34
32
|
*/
|
|
35
|
-
export declare function newMemoryRemoteDocumentCache(
|
|
33
|
+
export declare function newMemoryRemoteDocumentCache(sizer: DocumentSizer): MemoryRemoteDocumentCache;
|
|
@@ -140,7 +140,7 @@ export interface Persistence {
|
|
|
140
140
|
* extent possible (e.g. in the case of uid switching from
|
|
141
141
|
* sally=>jack=>sally, sally's mutation queue will be preserved).
|
|
142
142
|
*/
|
|
143
|
-
getMutationQueue(user: User): MutationQueue;
|
|
143
|
+
getMutationQueue(user: User, indexManager: IndexManager): MutationQueue;
|
|
144
144
|
/**
|
|
145
145
|
* Returns a TargetCache representing the persisted cache of targets.
|
|
146
146
|
*
|
|
@@ -173,7 +173,7 @@ export interface Persistence {
|
|
|
173
173
|
* this is called. In particular, the memory-backed implementation does this
|
|
174
174
|
* to emulate the persisted implementation to the extent possible.
|
|
175
175
|
*/
|
|
176
|
-
getIndexManager(): IndexManager;
|
|
176
|
+
getIndexManager(user: User): IndexManager;
|
|
177
177
|
/**
|
|
178
178
|
* Performs an operation inside a persistence transaction. Any reads or writes
|
|
179
179
|
* against persistence must be performed within a transaction. Writes will be
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { Query } from '../core/query';
|
|
18
17
|
import { SnapshotVersion } from '../core/snapshot_version';
|
|
19
18
|
import { DocumentKeySet, MutableDocumentMap } from '../model/collections';
|
|
20
19
|
import { MutableDocument } from '../model/document';
|
|
21
20
|
import { DocumentKey } from '../model/document_key';
|
|
21
|
+
import { ResourcePath } from '../model/path';
|
|
22
|
+
import { IndexManager } from './index_manager';
|
|
22
23
|
import { PersistencePromise } from './persistence_promise';
|
|
23
24
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
24
25
|
import { RemoteDocumentChangeBuffer } from './remote_document_change_buffer';
|
|
@@ -30,6 +31,8 @@ import { RemoteDocumentChangeBuffer } from './remote_document_change_buffer';
|
|
|
30
31
|
* documents that are known to not exist.
|
|
31
32
|
*/
|
|
32
33
|
export interface RemoteDocumentCache {
|
|
34
|
+
/** Sets the index manager to use for managing the collectionGroup index. */
|
|
35
|
+
setIndexManager(indexManager: IndexManager): void;
|
|
33
36
|
/**
|
|
34
37
|
* Looks up an entry in the cache.
|
|
35
38
|
*
|
|
@@ -47,19 +50,14 @@ export interface RemoteDocumentCache {
|
|
|
47
50
|
*/
|
|
48
51
|
getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
|
|
49
52
|
/**
|
|
50
|
-
*
|
|
53
|
+
* Returns the documents from the provided collection.
|
|
51
54
|
*
|
|
52
|
-
*
|
|
53
|
-
* should be re-filtered by the consumer before presenting them to the user.
|
|
54
|
-
*
|
|
55
|
-
* Cached NoDocument entries have no bearing on query results.
|
|
56
|
-
*
|
|
57
|
-
* @param query - The query to match documents against.
|
|
55
|
+
* @param collection - The collection to read.
|
|
58
56
|
* @param sinceReadTime - If not set to SnapshotVersion.min(), return only
|
|
59
57
|
* documents that have been read since this snapshot version (exclusive).
|
|
60
58
|
* @returns The set of matching documents.
|
|
61
59
|
*/
|
|
62
|
-
|
|
60
|
+
getAll(transaction: PersistenceTransaction, collection: ResourcePath, sinceReadTime: SnapshotVersion): PersistencePromise<MutableDocumentMap>;
|
|
63
61
|
/**
|
|
64
62
|
* Provides access to add or update the contents of the cache. The buffer
|
|
65
63
|
* handles proper size accounting for the change.
|
|
@@ -36,6 +36,7 @@ export declare class SimpleDbTransaction {
|
|
|
36
36
|
constructor(action: string, transaction: IDBTransaction);
|
|
37
37
|
get completionPromise(): Promise<void>;
|
|
38
38
|
abort(error?: Error): void;
|
|
39
|
+
maybeCommit(): void;
|
|
39
40
|
/**
|
|
40
41
|
* Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All
|
|
41
42
|
* operations performed on the SimpleDbStore happen within the context of this
|
|
@@ -43,7 +43,7 @@ export declare class FieldIndex {
|
|
|
43
43
|
/** The collection ID this index applies to. */
|
|
44
44
|
readonly collectionGroup: string;
|
|
45
45
|
/** The field segments for this index. */
|
|
46
|
-
readonly
|
|
46
|
+
readonly fields: IndexSegment[];
|
|
47
47
|
/** Shows how up-to-date the index is for the current user. */
|
|
48
48
|
readonly indexState: IndexState;
|
|
49
49
|
/** An ID for an index that has not yet been added to persistence. */
|
|
@@ -57,7 +57,7 @@ export declare class FieldIndex {
|
|
|
57
57
|
/** The collection ID this index applies to. */
|
|
58
58
|
collectionGroup: string,
|
|
59
59
|
/** The field segments for this index. */
|
|
60
|
-
|
|
60
|
+
fields: IndexSegment[],
|
|
61
61
|
/** Shows how up-to-date the index is for the current user. */
|
|
62
62
|
indexState: IndexState);
|
|
63
63
|
}
|
|
@@ -31,7 +31,7 @@ export declare class CountingQueryEngine extends QueryEngine {
|
|
|
31
31
|
* `getAllMutationBatchesAffectingQuery()` API (since the last call to
|
|
32
32
|
* `resetCounts()`)
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
mutationsReadByCollection: number;
|
|
35
35
|
/**
|
|
36
36
|
* The number of mutations returned by the MutationQueue's
|
|
37
37
|
* `getAllMutationBatchesAffectingDocumentKey()` and
|
|
@@ -41,9 +41,9 @@ export declare class CountingQueryEngine extends QueryEngine {
|
|
|
41
41
|
mutationsReadByKey: number;
|
|
42
42
|
/**
|
|
43
43
|
* The number of documents returned by the RemoteDocumentCache's
|
|
44
|
-
* `
|
|
44
|
+
* `getAll()` API (since the last call to `resetCounts()`)
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
documentsReadByCollection: number;
|
|
47
47
|
/**
|
|
48
48
|
* The number of documents returned by the RemoteDocumentCache's `getEntry()`
|
|
49
49
|
* and `getEntries()` APIs (since the last call to `resetCounts()`)
|
|
@@ -54,6 +54,7 @@ export declare function testIndexedDbPersistence(options?: {
|
|
|
54
54
|
dontPurgeData?: boolean;
|
|
55
55
|
synchronizeTabs?: boolean;
|
|
56
56
|
queue?: AsyncQueue;
|
|
57
|
+
schemaVersion?: number;
|
|
57
58
|
}, lruParams?: LruParams): Promise<IndexedDbPersistence>;
|
|
58
59
|
/** Creates and starts a MemoryPersistence instance for testing. */
|
|
59
60
|
export declare function testMemoryEagerPersistence(): Promise<MemoryPersistence>;
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { Target } from '../../../src/core/target';
|
|
17
18
|
import { IndexManager } from '../../../src/local/index_manager';
|
|
18
19
|
import { Persistence } from '../../../src/local/persistence';
|
|
20
|
+
import { DocumentKeySet, DocumentMap } from '../../../src/model/collections';
|
|
21
|
+
import { FieldIndex, IndexOffset } from '../../../src/model/field_index';
|
|
19
22
|
import { ResourcePath } from '../../../src/model/path';
|
|
20
23
|
/**
|
|
21
24
|
* A wrapper around IndexManager that automatically creates a
|
|
@@ -27,4 +30,12 @@ export declare class TestIndexManager {
|
|
|
27
30
|
constructor(persistence: Persistence, indexManager: IndexManager);
|
|
28
31
|
addToCollectionParentIndex(collectionPath: ResourcePath): Promise<void>;
|
|
29
32
|
getCollectionParents(collectionId: string): Promise<ResourcePath[]>;
|
|
33
|
+
addFieldIndex(index: FieldIndex): Promise<void>;
|
|
34
|
+
deleteFieldIndex(index: FieldIndex): Promise<void>;
|
|
35
|
+
getFieldIndexes(collectionGroup?: string): Promise<FieldIndex[]>;
|
|
36
|
+
getFieldIndex(target: Target): Promise<FieldIndex | null>;
|
|
37
|
+
getDocumentsMatchingTarget(fieldIndex: FieldIndex, target: Target): Promise<DocumentKeySet>;
|
|
38
|
+
getNextCollectionGroupToUpdate(): Promise<string | null>;
|
|
39
|
+
updateCollectionGroup(collectionGroup: string, offset: IndexOffset): Promise<void>;
|
|
40
|
+
updateIndexEntries(documents: DocumentMap): Promise<void>;
|
|
30
41
|
}
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { Query } from '../../../src/core/query';
|
|
18
17
|
import { SnapshotVersion } from '../../../src/core/snapshot_version';
|
|
18
|
+
import { IndexManager } from '../../../src/local/index_manager';
|
|
19
19
|
import { Persistence } from '../../../src/local/persistence';
|
|
20
20
|
import { RemoteDocumentChangeBuffer } from '../../../src/local/remote_document_change_buffer';
|
|
21
21
|
import { DocumentKeySet, MutableDocumentMap } from '../../../src/model/collections';
|
|
22
22
|
import { MutableDocument } from '../../../src/model/document';
|
|
23
23
|
import { DocumentKey } from '../../../src/model/document_key';
|
|
24
|
+
import { ResourcePath } from '../../../src/model/path';
|
|
24
25
|
/**
|
|
25
26
|
* A wrapper around a RemoteDocumentCache that automatically creates a
|
|
26
27
|
* transaction around every operation to reduce test boilerplate.
|
|
@@ -29,6 +30,7 @@ export declare class TestRemoteDocumentCache {
|
|
|
29
30
|
private readonly persistence;
|
|
30
31
|
private readonly cache;
|
|
31
32
|
constructor(persistence: Persistence);
|
|
33
|
+
setIndexManager(indexManager: IndexManager): void;
|
|
32
34
|
/**
|
|
33
35
|
* Reads all of the documents first so we can safely add them and keep the size calculation in
|
|
34
36
|
* sync.
|
|
@@ -42,7 +44,7 @@ export declare class TestRemoteDocumentCache {
|
|
|
42
44
|
removeEntry(documentKey: DocumentKey, version?: SnapshotVersion): Promise<void>;
|
|
43
45
|
getEntry(documentKey: DocumentKey): Promise<MutableDocument>;
|
|
44
46
|
getEntries(documentKeys: DocumentKeySet): Promise<MutableDocumentMap>;
|
|
45
|
-
|
|
47
|
+
getAll(collection: ResourcePath, sinceReadTime: SnapshotVersion): Promise<MutableDocumentMap>;
|
|
46
48
|
getNewDocumentChanges(sinceReadTime: SnapshotVersion): Promise<{
|
|
47
49
|
changedDocs: MutableDocumentMap;
|
|
48
50
|
readTime: SnapshotVersion;
|
|
@@ -28,7 +28,7 @@ export declare class TestRemoteDocumentChangeBuffer {
|
|
|
28
28
|
buffer: RemoteDocumentChangeBuffer;
|
|
29
29
|
constructor(persistence: Persistence, buffer: RemoteDocumentChangeBuffer);
|
|
30
30
|
addEntry(document: MutableDocument, readTime: SnapshotVersion): void;
|
|
31
|
-
removeEntry(key: DocumentKey): void;
|
|
31
|
+
removeEntry(key: DocumentKey, readTime: SnapshotVersion): void;
|
|
32
32
|
getEntry(documentKey: DocumentKey): Promise<MutableDocument>;
|
|
33
33
|
apply(): Promise<void>;
|
|
34
34
|
}
|
|
@@ -71,7 +71,7 @@ export declare function setMutation(keyStr: string, json: JsonObject<unknown>):
|
|
|
71
71
|
export declare function patchMutation(keyStr: string, json: JsonObject<unknown>, precondition?: Precondition): PatchMutation;
|
|
72
72
|
export declare function deleteMutation(keyStr: string): DeleteMutation;
|
|
73
73
|
export declare function mutationResult(testVersion: TestSnapshotVersion): MutationResult;
|
|
74
|
-
export declare function bound(values: unknown[],
|
|
74
|
+
export declare function bound(values: unknown[], inclusive: boolean): Bound;
|
|
75
75
|
export declare function query(resourcePath: string, ...constraints: Array<OrderBy | Filter>): Query;
|
|
76
76
|
export declare function targetData(targetId: TargetId, queryPurpose: TargetPurpose, path: string): TargetData;
|
|
77
77
|
export declare function noChangeEvent(targetId: number, snapshotVersion: number, resumeToken?: ByteString): RemoteEvent;
|