@powersync/service-core 0.0.0-dev-20260225160713 → 0.0.0-dev-20260511080634
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/CHANGELOG.md +102 -5
- package/dist/api/RouteAPI.d.ts +17 -3
- package/dist/api/api-index.d.ts +1 -1
- package/dist/api/api-index.js +1 -1
- package/dist/api/api-index.js.map +1 -1
- package/dist/api/api-metrics.js.map +1 -1
- package/dist/api/diagnostics.d.ts +1 -1
- package/dist/api/diagnostics.js +32 -14
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/auth/CachedKeyCollector.js +1 -1
- package/dist/auth/CachedKeyCollector.js.map +1 -1
- package/dist/auth/CompoundKeyCollector.js.map +1 -1
- package/dist/auth/KeyStore.js.map +1 -1
- package/dist/auth/RemoteJWKSCollector.js.map +1 -1
- package/dist/auth/StaticKeyCollector.d.ts +1 -1
- package/dist/auth/StaticKeyCollector.js.map +1 -1
- package/dist/auth/StaticSupabaseKeyCollector.d.ts +1 -1
- package/dist/auth/StaticSupabaseKeyCollector.js.map +1 -1
- package/dist/auth/utils.d.ts +2 -1
- package/dist/auth/utils.js +1 -1
- package/dist/auth/utils.js.map +1 -1
- package/dist/entry/commands/compact-action.js +26 -5
- package/dist/entry/commands/compact-action.js.map +1 -1
- package/dist/entry/commands/teardown-action.js +2 -2
- package/dist/entry/commands/teardown-action.js.map +1 -1
- package/dist/entry/entry-index.d.ts +1 -1
- package/dist/entry/entry-index.js +1 -1
- package/dist/entry/entry-index.js.map +1 -1
- package/dist/events/EventsEngine.js +1 -1
- package/dist/events/EventsEngine.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics/MetricsEngine.d.ts +1 -1
- package/dist/metrics/RollingBucketMax.d.ts +28 -0
- package/dist/metrics/RollingBucketMax.js +80 -0
- package/dist/metrics/RollingBucketMax.js.map +1 -0
- package/dist/metrics/metrics-index.d.ts +3 -2
- package/dist/metrics/metrics-index.js +3 -2
- package/dist/metrics/metrics-index.js.map +1 -1
- package/dist/metrics/open-telemetry/util.js +1 -1
- package/dist/metrics/open-telemetry/util.js.map +1 -1
- package/dist/metrics/register-metrics.js +2 -2
- package/dist/metrics/register-metrics.js.map +1 -1
- package/dist/modules/AbstractModule.d.ts +2 -2
- package/dist/modules/AbstractModule.js.map +1 -1
- package/dist/modules/modules-index.d.ts +1 -1
- package/dist/modules/modules-index.js +1 -1
- package/dist/modules/modules-index.js.map +1 -1
- package/dist/replication/AbstractReplicationJob.d.ts +2 -2
- package/dist/replication/AbstractReplicationJob.js +1 -1
- package/dist/replication/AbstractReplicationJob.js.map +1 -1
- package/dist/replication/AbstractReplicator.d.ts +7 -7
- package/dist/replication/AbstractReplicator.js +31 -28
- package/dist/replication/AbstractReplicator.js.map +1 -1
- package/dist/replication/ReplicationLagTracker.d.ts +50 -0
- package/dist/replication/ReplicationLagTracker.js +78 -0
- package/dist/replication/ReplicationLagTracker.js.map +1 -0
- package/dist/replication/replication-index.d.ts +3 -2
- package/dist/replication/replication-index.js +3 -2
- package/dist/replication/replication-index.js.map +1 -1
- package/dist/replication/replication-metrics.js.map +1 -1
- package/dist/routes/configure-fastify.d.ts +59 -32
- package/dist/routes/endpoints/admin.d.ts +108 -54
- package/dist/routes/endpoints/admin.js +8 -3
- package/dist/routes/endpoints/admin.js.map +1 -1
- package/dist/routes/endpoints/checkpointing.js +1 -1
- package/dist/routes/endpoints/checkpointing.js.map +1 -1
- package/dist/routes/endpoints/socket-route.js +1 -1
- package/dist/routes/endpoints/socket-route.js.map +1 -1
- package/dist/routes/endpoints/sync-rules.js +10 -10
- package/dist/routes/endpoints/sync-rules.js.map +1 -1
- package/dist/routes/endpoints/sync-stream.d.ts +10 -10
- package/dist/routes/endpoints/sync-stream.js +8 -3
- package/dist/routes/endpoints/sync-stream.js.map +1 -1
- package/dist/routes/hooks.js +1 -1
- package/dist/routes/hooks.js.map +1 -1
- package/dist/routes/route-register.js.map +1 -1
- package/dist/runner/teardown.js +4 -4
- package/dist/runner/teardown.js.map +1 -1
- package/dist/storage/BucketStorage.d.ts +9 -9
- package/dist/storage/BucketStorage.js +9 -9
- package/dist/storage/BucketStorageBatch.d.ts +30 -9
- package/dist/storage/BucketStorageBatch.js.map +1 -1
- package/dist/storage/BucketStorageFactory.d.ts +32 -20
- package/dist/storage/BucketStorageFactory.js +19 -16
- package/dist/storage/BucketStorageFactory.js.map +1 -1
- package/dist/storage/ChecksumCache.d.ts +5 -2
- package/dist/storage/ChecksumCache.js +8 -4
- package/dist/storage/ChecksumCache.js.map +1 -1
- package/dist/storage/PersistedSyncRulesContent.d.ts +9 -3
- package/dist/storage/PersistedSyncRulesContent.js +25 -5
- package/dist/storage/PersistedSyncRulesContent.js.map +1 -1
- package/dist/storage/ReplicationEventPayload.d.ts +1 -1
- package/dist/storage/SourceTable.d.ts +10 -5
- package/dist/storage/SourceTable.js +3 -3
- package/dist/storage/SourceTable.js.map +1 -1
- package/dist/storage/StorageVersionConfig.d.ts +34 -1
- package/dist/storage/StorageVersionConfig.js +40 -7
- package/dist/storage/StorageVersionConfig.js.map +1 -1
- package/dist/storage/SyncRulesBucketStorage.d.ts +63 -11
- package/dist/storage/SyncRulesBucketStorage.js +14 -0
- package/dist/storage/SyncRulesBucketStorage.js.map +1 -1
- package/dist/storage/WriteCheckpointAPI.d.ts +6 -6
- package/dist/storage/WriteCheckpointAPI.js +1 -1
- package/dist/storage/bson.d.ts +0 -1
- package/dist/storage/bson.js +0 -4
- package/dist/storage/bson.js.map +1 -1
- package/dist/storage/storage-index.d.ts +8 -8
- package/dist/storage/storage-index.js +8 -8
- package/dist/storage/storage-index.js.map +1 -1
- package/dist/storage/storage-metrics.js.map +1 -1
- package/dist/streams/streams-index.d.ts +2 -2
- package/dist/streams/streams-index.js +2 -2
- package/dist/streams/streams-index.js.map +1 -1
- package/dist/sync/BucketChecksumState.d.ts +5 -8
- package/dist/sync/BucketChecksumState.js +118 -116
- package/dist/sync/BucketChecksumState.js.map +1 -1
- package/dist/sync/RequestTracker.js +1 -1
- package/dist/sync/RequestTracker.js.map +1 -1
- package/dist/sync/sync-index.d.ts +2 -2
- package/dist/sync/sync-index.js +2 -2
- package/dist/sync/sync-index.js.map +1 -1
- package/dist/sync/sync.js.map +1 -1
- package/dist/sync/util.d.ts +1 -0
- package/dist/sync/util.js +10 -0
- package/dist/sync/util.js.map +1 -1
- package/dist/system/ServiceContext.d.ts +1 -1
- package/dist/system/ServiceContext.js +1 -1
- package/dist/system/ServiceContext.js.map +1 -1
- package/dist/tracing/PerformanceTracer.d.ts +44 -0
- package/dist/tracing/PerformanceTracer.js +102 -0
- package/dist/tracing/PerformanceTracer.js.map +1 -0
- package/dist/tracing/TraceWriter.d.ts +22 -0
- package/dist/tracing/TraceWriter.js +63 -0
- package/dist/tracing/TraceWriter.js.map +1 -0
- package/dist/util/checkpointing.js +1 -1
- package/dist/util/config/collectors/impl/base64-config-collector.d.ts +1 -1
- package/dist/util/config/collectors/impl/base64-config-collector.js.map +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.d.ts +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.js +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.js.map +1 -1
- package/dist/util/config/compound-config-collector.d.ts +1 -1
- package/dist/util/config/compound-config-collector.js +2 -2
- package/dist/util/config/compound-config-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js.map +1 -1
- package/dist/util/config/sync-rules/sync-rules-provider.js.map +1 -1
- package/dist/util/config.js +1 -1
- package/dist/util/config.js.map +1 -1
- package/dist/util/env.js +1 -1
- package/dist/util/errors.d.ts +3 -0
- package/dist/util/errors.js +15 -0
- package/dist/util/errors.js.map +1 -0
- package/dist/util/protocol-types.d.ts +3 -3
- package/dist/util/protocol-types.js +1 -1
- package/dist/util/util-index.d.ts +1 -1
- package/dist/util/util-index.js +1 -1
- package/dist/util/util-index.js.map +1 -1
- package/dist/util/utils.d.ts +1 -1
- package/package.json +11 -11
- package/src/api/RouteAPI.ts +20 -3
- package/src/api/api-index.ts +1 -1
- package/src/api/api-metrics.ts +1 -1
- package/src/api/diagnostics.ts +42 -20
- package/src/auth/CachedKeyCollector.ts +2 -3
- package/src/auth/CompoundKeyCollector.ts +2 -3
- package/src/auth/KeyStore.ts +1 -1
- package/src/auth/RemoteJWKSCollector.ts +0 -1
- package/src/auth/StaticKeyCollector.ts +1 -1
- package/src/auth/StaticSupabaseKeyCollector.ts +1 -1
- package/src/auth/utils.ts +5 -2
- package/src/entry/commands/compact-action.ts +29 -5
- package/src/entry/commands/teardown-action.ts +2 -2
- package/src/entry/entry-index.ts +1 -1
- package/src/events/EventsEngine.ts +1 -1
- package/src/index.ts +2 -0
- package/src/metrics/MetricsEngine.ts +1 -1
- package/src/metrics/RollingBucketMax.ts +109 -0
- package/src/metrics/metrics-index.ts +3 -2
- package/src/metrics/open-telemetry/util.ts +1 -1
- package/src/metrics/register-metrics.ts +3 -3
- package/src/modules/AbstractModule.ts +2 -2
- package/src/modules/modules-index.ts +1 -1
- package/src/replication/AbstractReplicationJob.ts +3 -3
- package/src/replication/AbstractReplicator.ts +32 -30
- package/src/replication/ReplicationLagTracker.ts +86 -0
- package/src/replication/replication-index.ts +3 -2
- package/src/replication/replication-metrics.ts +1 -1
- package/src/routes/endpoints/admin.ts +8 -3
- package/src/routes/endpoints/checkpointing.ts +1 -1
- package/src/routes/endpoints/socket-route.ts +1 -1
- package/src/routes/endpoints/sync-rules.ts +10 -12
- package/src/routes/endpoints/sync-stream.ts +8 -3
- package/src/routes/hooks.ts +2 -2
- package/src/routes/route-register.ts +2 -10
- package/src/runner/teardown.ts +4 -4
- package/src/storage/BucketStorage.ts +9 -9
- package/src/storage/BucketStorageBatch.ts +34 -10
- package/src/storage/BucketStorageFactory.ts +51 -34
- package/src/storage/ChecksumCache.ts +14 -6
- package/src/storage/PersistedSyncRulesContent.ts +36 -7
- package/src/storage/ReplicationEventPayload.ts +1 -1
- package/src/storage/SourceTable.ts +10 -4
- package/src/storage/StorageVersionConfig.ts +55 -7
- package/src/storage/SyncRulesBucketStorage.ts +77 -11
- package/src/storage/WriteCheckpointAPI.ts +6 -6
- package/src/storage/bson.ts +0 -5
- package/src/storage/storage-index.ts +8 -8
- package/src/storage/storage-metrics.ts +2 -2
- package/src/streams/streams-index.ts +2 -2
- package/src/sync/BucketChecksumState.ts +142 -139
- package/src/sync/RequestTracker.ts +1 -1
- package/src/sync/sync-index.ts +2 -2
- package/src/sync/sync.ts +4 -4
- package/src/sync/util.ts +11 -1
- package/src/system/ServiceContext.ts +1 -1
- package/src/tracing/PerformanceTracer.ts +126 -0
- package/src/tracing/TraceWriter.ts +67 -0
- package/src/util/checkpointing.ts +1 -1
- package/src/util/config/collectors/impl/base64-config-collector.ts +1 -1
- package/src/util/config/collectors/impl/filesystem-config-collector.ts +2 -2
- package/src/util/config/compound-config-collector.ts +3 -3
- package/src/util/config/sync-rules/impl/filesystem-sync-rules-collector.ts +1 -1
- package/src/util/config/sync-rules/sync-rules-provider.ts +1 -1
- package/src/util/config.ts +1 -1
- package/src/util/env.ts +1 -1
- package/src/util/errors.ts +21 -0
- package/src/util/protocol-types.ts +1 -1
- package/src/util/util-index.ts +1 -1
- package/src/util/utils.ts +1 -1
- package/test/src/ReplicationLagTracker.test.ts +53 -0
- package/test/src/RollingBucketMax.test.ts +106 -0
- package/test/src/auth.test.ts +26 -7
- package/test/src/checksum_cache.test.ts +102 -57
- package/test/src/config.test.ts +1 -0
- package/test/src/diagnostics.test.ts +151 -0
- package/test/src/module-loader.test.ts +1 -1
- package/test/src/routes/mocks.ts +1 -1
- package/test/src/routes/stream.test.ts +1 -2
- package/test/src/sync/BucketChecksumState.test.ts +209 -80
- package/test/src/util/protocol_types.test.ts +1 -1
- package/test/src/utils.ts +9 -0
- package/test/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +1 -1
|
@@ -1,20 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Corresponds to the storage version initially used, before we started explicitly versioning storage.
|
|
3
|
+
*/
|
|
4
|
+
export const STORAGE_VERSION_1 = 1;
|
|
5
|
+
/**
|
|
6
|
+
* First new storage version.
|
|
7
|
+
*
|
|
8
|
+
* Uses versioned bucket names.
|
|
9
|
+
*
|
|
10
|
+
* On MongoDB storage, this always uses Long for checksums.
|
|
11
|
+
*/
|
|
12
|
+
export const STORAGE_VERSION_2 = 2;
|
|
13
|
+
/**
|
|
14
|
+
* This version is currently unstable, and not enabled by default yet.
|
|
15
|
+
*
|
|
16
|
+
* This is used to build towards incremental reprocessing.
|
|
17
|
+
*/
|
|
18
|
+
export const STORAGE_VERSION_3 = 3;
|
|
1
19
|
/**
|
|
2
20
|
* Oldest supported storage version.
|
|
3
21
|
*/
|
|
4
|
-
export const LEGACY_STORAGE_VERSION =
|
|
22
|
+
export const LEGACY_STORAGE_VERSION = STORAGE_VERSION_1;
|
|
23
|
+
/**
|
|
24
|
+
* Default storage version for newly persisted replication streams.
|
|
25
|
+
*/
|
|
26
|
+
export const CURRENT_STORAGE_VERSION = STORAGE_VERSION_2;
|
|
5
27
|
/**
|
|
6
|
-
*
|
|
28
|
+
* All versions that can be loaded.
|
|
29
|
+
*
|
|
30
|
+
* This includes unstable versions.
|
|
7
31
|
*/
|
|
8
|
-
export const
|
|
32
|
+
export const SUPPORTED_STORAGE_VERSIONS = [STORAGE_VERSION_1, STORAGE_VERSION_2, STORAGE_VERSION_3];
|
|
9
33
|
/**
|
|
10
34
|
* Shared storage-version behavior across storage implementations.
|
|
11
35
|
*/
|
|
12
36
|
export const STORAGE_VERSION_CONFIG = {
|
|
13
|
-
[
|
|
14
|
-
|
|
37
|
+
[STORAGE_VERSION_1]: {
|
|
38
|
+
version: STORAGE_VERSION_1,
|
|
39
|
+
versionedBuckets: false,
|
|
40
|
+
softDeleteCurrentData: false
|
|
41
|
+
},
|
|
42
|
+
[STORAGE_VERSION_2]: {
|
|
43
|
+
version: STORAGE_VERSION_2,
|
|
44
|
+
versionedBuckets: true,
|
|
45
|
+
softDeleteCurrentData: false
|
|
15
46
|
},
|
|
16
|
-
[
|
|
17
|
-
|
|
47
|
+
[STORAGE_VERSION_3]: {
|
|
48
|
+
version: STORAGE_VERSION_3,
|
|
49
|
+
versionedBuckets: true,
|
|
50
|
+
softDeleteCurrentData: true
|
|
18
51
|
}
|
|
19
52
|
};
|
|
20
53
|
//# sourceMappingURL=StorageVersionConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageVersionConfig.js","sourceRoot":"","sources":["../../src/storage/StorageVersionConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorageVersionConfig.js","sourceRoot":"","sources":["../../src/storage/StorageVersionConfig.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AAEpG;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqD;IACtF,CAAC,iBAAiB,CAAC,EAAE;QACnB,OAAO,EAAE,iBAAiB;QAC1B,gBAAgB,EAAE,KAAK;QACvB,qBAAqB,EAAE,KAAK;KAC7B;IACD,CAAC,iBAAiB,CAAC,EAAE;QACnB,OAAO,EAAE,iBAAiB;QAC1B,gBAAgB,EAAE,IAAI;QACtB,qBAAqB,EAAE,KAAK;KAC7B;IACD,CAAC,iBAAiB,CAAC,EAAE;QACnB,OAAO,EAAE,iBAAiB;QAC1B,gBAAgB,EAAE,IAAI;QACtB,qBAAqB,EAAE,IAAI;KAC5B;CACF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Logger, ObserverClient } from '@powersync/lib-services-framework';
|
|
2
|
-
import { HydratedSyncRules, ScopedParameterLookup, SqliteJsonRow } from '@powersync/service-sync-rules';
|
|
2
|
+
import { BucketDataSource, HydratedSyncRules, ScopedParameterLookup, SqliteJsonRow } from '@powersync/service-sync-rules';
|
|
3
|
+
import { PerformanceTracer } from '../tracing/PerformanceTracer.js';
|
|
3
4
|
import * as util from '../util/util-index.js';
|
|
4
5
|
import { BucketStorageBatch, FlushedResult, SaveUpdate } from './BucketStorageBatch.js';
|
|
5
6
|
import { BucketStorageFactory } from './BucketStorageFactory.js';
|
|
@@ -8,27 +9,34 @@ import { SourceEntityDescriptor } from './SourceEntity.js';
|
|
|
8
9
|
import { SourceTable } from './SourceTable.js';
|
|
9
10
|
import { SyncStorageWriteCheckpointAPI } from './WriteCheckpointAPI.js';
|
|
10
11
|
/**
|
|
11
|
-
* Storage for a specific
|
|
12
|
+
* Storage for a specific replication stream.
|
|
12
13
|
*/
|
|
13
14
|
export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketStorageListener>, SyncStorageWriteCheckpointAPI {
|
|
14
15
|
readonly group_id: number;
|
|
15
16
|
readonly slot_name: string;
|
|
16
17
|
readonly factory: BucketStorageFactory;
|
|
18
|
+
readonly logger: Logger;
|
|
17
19
|
/**
|
|
18
20
|
* Resolve a table, keeping track of it internally.
|
|
19
21
|
*/
|
|
20
22
|
resolveTable(options: ResolveTableOptions): Promise<ResolveTableResult>;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
24
|
+
* Create a new writer.
|
|
25
|
+
*
|
|
26
|
+
* The writer must be flushed and disposed when done.
|
|
27
|
+
*/
|
|
28
|
+
createWriter(options: CreateWriterOptions): Promise<BucketStorageBatch>;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use `createWriter()` with `await using` instead.
|
|
23
31
|
*/
|
|
24
|
-
startBatch(options:
|
|
32
|
+
startBatch(options: CreateWriterOptions, callback: (batch: BucketStorageBatch) => Promise<void>): Promise<FlushedResult | null>;
|
|
25
33
|
getParsedSyncRules(options: ParseSyncRulesOptions): HydratedSyncRules;
|
|
26
34
|
/**
|
|
27
|
-
* Terminate the
|
|
35
|
+
* Terminate the replication stream.
|
|
28
36
|
*
|
|
29
37
|
* This clears the storage, and sets state to TERMINATED.
|
|
30
38
|
*
|
|
31
|
-
* Must only be called on stopped
|
|
39
|
+
* Must only be called on stopped replication streams.
|
|
32
40
|
*/
|
|
33
41
|
terminate(options?: TerminateOptions): Promise<void>;
|
|
34
42
|
getStatus(): Promise<SyncRuleStatus>;
|
|
@@ -65,7 +73,7 @@ export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketSt
|
|
|
65
73
|
/**
|
|
66
74
|
* Yields the latest user write checkpoint whenever the sync checkpoint updates.
|
|
67
75
|
*
|
|
68
|
-
* The stream stops or errors if this is not the active sync
|
|
76
|
+
* The stream stops or errors if this is not the active sync config (anymore).
|
|
69
77
|
*/
|
|
70
78
|
watchCheckpointChanges(options: WatchWriteCheckpointOptions): AsyncIterable<StorageCheckpointUpdate>;
|
|
71
79
|
/**
|
|
@@ -79,7 +87,7 @@ export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketSt
|
|
|
79
87
|
* @param dataBuckets current bucket states
|
|
80
88
|
* @param options batch size options
|
|
81
89
|
*/
|
|
82
|
-
getBucketDataBatch(checkpoint: util.InternalOpId, dataBuckets:
|
|
90
|
+
getBucketDataBatch(checkpoint: util.InternalOpId, dataBuckets: BucketDataRequest[], options?: BucketDataBatchOptions): AsyncIterable<SyncBucketDataChunk>;
|
|
83
91
|
/**
|
|
84
92
|
* Compute checksums for a given list of buckets.
|
|
85
93
|
*
|
|
@@ -88,7 +96,7 @@ export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketSt
|
|
|
88
96
|
* This may be slow, depending on the size of the buckets.
|
|
89
97
|
* The checksums are cached internally to compensate for this, but does not cover all cases.
|
|
90
98
|
*/
|
|
91
|
-
getChecksums(checkpoint: util.InternalOpId, buckets:
|
|
99
|
+
getChecksums(checkpoint: util.InternalOpId, buckets: BucketChecksumRequest[]): Promise<util.ChecksumMap>;
|
|
92
100
|
/**
|
|
93
101
|
* Clear checksum cache. Primarily intended for tests.
|
|
94
102
|
*/
|
|
@@ -97,6 +105,15 @@ export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketSt
|
|
|
97
105
|
export interface SyncRulesBucketStorageListener {
|
|
98
106
|
batchStarted: (batch: BucketStorageBatch) => void;
|
|
99
107
|
}
|
|
108
|
+
export interface BucketDataRequest {
|
|
109
|
+
bucket: string;
|
|
110
|
+
start: util.InternalOpId;
|
|
111
|
+
source: BucketDataSource;
|
|
112
|
+
}
|
|
113
|
+
export interface BucketChecksumRequest {
|
|
114
|
+
bucket: string;
|
|
115
|
+
source: BucketDataSource;
|
|
116
|
+
}
|
|
100
117
|
export interface SyncRuleStatus {
|
|
101
118
|
checkpoint_lsn: string | null;
|
|
102
119
|
active: boolean;
|
|
@@ -114,7 +131,7 @@ export interface ResolveTableResult {
|
|
|
114
131
|
table: SourceTable;
|
|
115
132
|
dropTables: SourceTable[];
|
|
116
133
|
}
|
|
117
|
-
export interface
|
|
134
|
+
export interface CreateWriterOptions extends ParseSyncRulesOptions {
|
|
118
135
|
zeroLSN: string;
|
|
119
136
|
/**
|
|
120
137
|
* Whether or not to store a copy of the current data.
|
|
@@ -138,8 +155,14 @@ export interface StartBatchOptions extends ParseSyncRulesOptions {
|
|
|
138
155
|
* This is expected to happen in some initial replication edge cases, only if storeCurrentData = true.
|
|
139
156
|
*/
|
|
140
157
|
markRecordUnavailable?: BucketStorageMarkRecordUnavailable;
|
|
158
|
+
tracer?: PerformanceTracer<'storage' | 'evaluate'>;
|
|
141
159
|
logger?: Logger;
|
|
142
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated Use `CreateWriterOptions`.
|
|
163
|
+
*/
|
|
164
|
+
export interface StartBatchOptions extends CreateWriterOptions {
|
|
165
|
+
}
|
|
143
166
|
export interface CompactOptions {
|
|
144
167
|
/**
|
|
145
168
|
* Heap memory limit for the compact process.
|
|
@@ -191,6 +214,7 @@ export interface CompactOptions {
|
|
|
191
214
|
*/
|
|
192
215
|
compactParameterCacheLimit?: number;
|
|
193
216
|
signal?: AbortSignal;
|
|
217
|
+
logger?: Logger;
|
|
194
218
|
}
|
|
195
219
|
export interface PopulateChecksumCacheOptions {
|
|
196
220
|
maxOpId: util.InternalOpId;
|
|
@@ -237,8 +261,36 @@ export interface ReplicationCheckpoint {
|
|
|
237
261
|
* Used to resolve "dynamic" parameter queries.
|
|
238
262
|
*
|
|
239
263
|
* This gets parameter sets specific to this checkpoint.
|
|
264
|
+
*
|
|
265
|
+
* @throws {@link ParameterSetLimitExceededError}
|
|
266
|
+
* Thrown if resolved lookups in bucket storage exceed the `limit` parameter.
|
|
267
|
+
*/
|
|
268
|
+
getParameterSets(lookups: ScopedParameterLookup[], limit: number): Promise<SqliteJsonRow[]>;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* An exception thrown by {@link ReplicationCheckpoint} implementations if there are too many parameter results.
|
|
272
|
+
*
|
|
273
|
+
* This is not a suitable exception to show to users, `BucketParameterState` adds additional context.
|
|
274
|
+
*/
|
|
275
|
+
export declare class ParameterSetLimitExceededError extends Error {
|
|
276
|
+
readonly limit: number;
|
|
277
|
+
readonly breakdown?: ParameterQueryInvocationLog[] | undefined;
|
|
278
|
+
constructor(limit: number, breakdown?: ParameterQueryInvocationLog[] | undefined);
|
|
279
|
+
}
|
|
280
|
+
export interface ParameterQueryInvocationLog {
|
|
281
|
+
/**
|
|
282
|
+
* The definition for which a parameter query was invoked.
|
|
283
|
+
*
|
|
284
|
+
* The exact format of definition is unspecified, it's shown to users to help them debug this failure.
|
|
285
|
+
*/
|
|
286
|
+
definition: string;
|
|
287
|
+
/**
|
|
288
|
+
* If {@link didExceedLimit} is false, the amount of rows returned by the invocation.
|
|
289
|
+
*
|
|
290
|
+
* Otherwise, the maximum amount of rows this invocation was allowed to return.
|
|
240
291
|
*/
|
|
241
|
-
|
|
292
|
+
resultsOrLimit: number;
|
|
293
|
+
didExceedLimit: boolean;
|
|
242
294
|
}
|
|
243
295
|
export interface WatchWriteCheckpointOptions {
|
|
244
296
|
/** user_id and client_id combined. */
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An exception thrown by {@link ReplicationCheckpoint} implementations if there are too many parameter results.
|
|
3
|
+
*
|
|
4
|
+
* This is not a suitable exception to show to users, `BucketParameterState` adds additional context.
|
|
5
|
+
*/
|
|
6
|
+
export class ParameterSetLimitExceededError extends Error {
|
|
7
|
+
limit;
|
|
8
|
+
breakdown;
|
|
9
|
+
constructor(limit, breakdown) {
|
|
10
|
+
super(`Too many parameter results (limit was ${limit})`);
|
|
11
|
+
this.limit = limit;
|
|
12
|
+
this.breakdown = breakdown;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
1
15
|
export const CHECKPOINT_INVALIDATE_ALL = {
|
|
2
16
|
updatedDataBuckets: new Set(),
|
|
3
17
|
invalidateDataBuckets: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncRulesBucketStorage.js","sourceRoot":"","sources":["../../src/storage/SyncRulesBucketStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SyncRulesBucketStorage.js","sourceRoot":"","sources":["../../src/storage/SyncRulesBucketStorage.ts"],"names":[],"mappings":"AA+UA;;;;GAIG;AACH,MAAM,OAAO,8BAA+B,SAAQ,KAAK;IAE5C;IACA;IAFX,YACW,KAAa,EACb,SAAyC;QAElD,KAAK,CAAC,yCAAyC,KAAK,GAAG,CAAC,CAAC;QAHhD,UAAK,GAAL,KAAK,CAAQ;QACb,cAAS,GAAT,SAAS,CAAgC;IAGpD,CAAC;CACF;AAqDD,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,kBAAkB,EAAE,IAAI,GAAG,EAAU;IACrC,qBAAqB,EAAE,IAAI;IAC3B,uBAAuB,EAAE,IAAI,GAAG,EAAU;IAC1C,0BAA0B,EAAE,IAAI;CACjC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare enum WriteCheckpointMode {
|
|
2
2
|
/**
|
|
3
3
|
* Raw mappings of `user_id` to `write_checkpoint`s should
|
|
4
|
-
* be supplied for each
|
|
4
|
+
* be supplied for each replication stream.
|
|
5
5
|
*/
|
|
6
6
|
CUSTOM = "custom",
|
|
7
7
|
/**
|
|
@@ -19,7 +19,7 @@ export interface BaseWriteCheckpointIdentifier {
|
|
|
19
19
|
}
|
|
20
20
|
export interface CustomWriteCheckpointFilters extends BaseWriteCheckpointIdentifier {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Replication stream which was active when this checkpoint was created.
|
|
23
23
|
*/
|
|
24
24
|
sync_rules_id: number;
|
|
25
25
|
}
|
|
@@ -31,7 +31,7 @@ export interface BatchedCustomWriteCheckpointOptions extends BaseWriteCheckpoint
|
|
|
31
31
|
}
|
|
32
32
|
export interface CustomWriteCheckpointOptions extends BatchedCustomWriteCheckpointOptions {
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Replication stream which was active when this checkpoint was created.
|
|
35
35
|
*/
|
|
36
36
|
sync_rules_id: number;
|
|
37
37
|
}
|
|
@@ -54,15 +54,15 @@ export interface BaseWriteCheckpointAPI {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Write Checkpoint API to be used in conjunction with a {@link SyncRulesBucketStorage}.
|
|
57
|
-
* This storage corresponds with a
|
|
58
|
-
*
|
|
57
|
+
* This storage corresponds with a replication stream. These APIs don't require specifying a
|
|
58
|
+
* replication stream id.
|
|
59
59
|
*/
|
|
60
60
|
export interface SyncStorageWriteCheckpointAPI extends BaseWriteCheckpointAPI {
|
|
61
61
|
lastWriteCheckpoint(filters: SyncStorageLastWriteCheckpointFilters): Promise<bigint | null>;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Write Checkpoint API which is interfaced directly with the storage layer. This requires
|
|
65
|
-
*
|
|
65
|
+
* replication stream identifiers for custom write checkpoints.
|
|
66
66
|
*/
|
|
67
67
|
export interface WriteCheckpointAPI extends BaseWriteCheckpointAPI {
|
|
68
68
|
lastWriteCheckpoint(filters: LastWriteCheckpointFilters): Promise<bigint | null>;
|
|
@@ -2,7 +2,7 @@ export var WriteCheckpointMode;
|
|
|
2
2
|
(function (WriteCheckpointMode) {
|
|
3
3
|
/**
|
|
4
4
|
* Raw mappings of `user_id` to `write_checkpoint`s should
|
|
5
|
-
* be supplied for each
|
|
5
|
+
* be supplied for each replication stream.
|
|
6
6
|
*/
|
|
7
7
|
WriteCheckpointMode["CUSTOM"] = "custom";
|
|
8
8
|
/**
|
package/dist/storage/bson.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export declare const BSON_DESERIALIZE_DATA_OPTIONS: bson.DeserializeOptions;
|
|
|
17
17
|
export declare const serializeLookupBuffer: (lookup: ScopedParameterLookup) => NodeBuffer;
|
|
18
18
|
export declare const serializeLookup: (lookup: ScopedParameterLookup) => bson.Binary;
|
|
19
19
|
export declare const deserializeParameterLookup: (lookup: bson.Binary) => SqliteJsonValue[];
|
|
20
|
-
export declare const getLookupBucketDefinitionName: (lookup: bson.Binary) => string;
|
|
21
20
|
/**
|
|
22
21
|
* True if this is a bson.UUID.
|
|
23
22
|
*
|
package/dist/storage/bson.js
CHANGED
|
@@ -29,10 +29,6 @@ export const deserializeParameterLookup = (lookup) => {
|
|
|
29
29
|
const parsed = bson.deserialize(lookup.buffer, BSON_DESERIALIZE_INTERNAL_OPTIONS).l;
|
|
30
30
|
return parsed;
|
|
31
31
|
};
|
|
32
|
-
export const getLookupBucketDefinitionName = (lookup) => {
|
|
33
|
-
const parsed = deserializeParameterLookup(lookup);
|
|
34
|
-
return parsed[0];
|
|
35
|
-
};
|
|
36
32
|
/**
|
|
37
33
|
* True if this is a bson.UUID.
|
|
38
34
|
*
|
package/dist/storage/bson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bson.js","sourceRoot":"","sources":["../../src/storage/bson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,6BAA6B;IAC7B,WAAW,EAAE,IAAI;IACjB,8EAA8E;IAC9E,2DAA2D;IAC3D,cAAc,EAAE,KAAK;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAA4B;IACpE,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA6B,EAAc,EAAE;IACjF,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAe,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAA6B,EAAE,EAAE;IAC/D,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAmB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAC,CAAsB,CAAC;IACzG,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF
|
|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I,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,iEAAiE;QACjE,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export * from './bson.js';
|
|
2
2
|
export * from './BucketStorage.js';
|
|
3
|
+
export * from './BucketStorageBatch.js';
|
|
4
|
+
export * from './BucketStorageFactory.js';
|
|
3
5
|
export * from './ChecksumCache.js';
|
|
6
|
+
export * from './PersistedSyncRulesContent.js';
|
|
4
7
|
export * from './ReplicationEventPayload.js';
|
|
8
|
+
export * from './ReplicationLock.js';
|
|
9
|
+
export * from './ReportStorage.js';
|
|
5
10
|
export * from './SourceEntity.js';
|
|
6
11
|
export * from './SourceTable.js';
|
|
12
|
+
export * from './storage-metrics.js';
|
|
7
13
|
export * from './StorageEngine.js';
|
|
8
14
|
export * from './StorageProvider.js';
|
|
9
|
-
export * from './storage-metrics.js';
|
|
10
|
-
export * from './WriteCheckpointAPI.js';
|
|
11
|
-
export * from './BucketStorageFactory.js';
|
|
12
|
-
export * from './BucketStorageBatch.js';
|
|
13
|
-
export * from './SyncRulesBucketStorage.js';
|
|
14
|
-
export * from './PersistedSyncRulesContent.js';
|
|
15
|
-
export * from './ReplicationLock.js';
|
|
16
|
-
export * from './ReportStorage.js';
|
|
17
15
|
export * from './StorageVersionConfig.js';
|
|
16
|
+
export * from './SyncRulesBucketStorage.js';
|
|
17
|
+
export * from './WriteCheckpointAPI.js';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export * from './bson.js';
|
|
2
2
|
export * from './BucketStorage.js';
|
|
3
|
+
export * from './BucketStorageBatch.js';
|
|
4
|
+
export * from './BucketStorageFactory.js';
|
|
3
5
|
export * from './ChecksumCache.js';
|
|
6
|
+
export * from './PersistedSyncRulesContent.js';
|
|
4
7
|
export * from './ReplicationEventPayload.js';
|
|
8
|
+
export * from './ReplicationLock.js';
|
|
9
|
+
export * from './ReportStorage.js';
|
|
5
10
|
export * from './SourceEntity.js';
|
|
6
11
|
export * from './SourceTable.js';
|
|
12
|
+
export * from './storage-metrics.js';
|
|
7
13
|
export * from './StorageEngine.js';
|
|
8
14
|
export * from './StorageProvider.js';
|
|
9
|
-
export * from './storage-metrics.js';
|
|
10
|
-
export * from './WriteCheckpointAPI.js';
|
|
11
|
-
export * from './BucketStorageFactory.js';
|
|
12
|
-
export * from './BucketStorageBatch.js';
|
|
13
|
-
export * from './SyncRulesBucketStorage.js';
|
|
14
|
-
export * from './PersistedSyncRulesContent.js';
|
|
15
|
-
export * from './ReplicationLock.js';
|
|
16
|
-
export * from './ReportStorage.js';
|
|
17
15
|
export * from './StorageVersionConfig.js';
|
|
16
|
+
export * from './SyncRulesBucketStorage.js';
|
|
17
|
+
export * from './WriteCheckpointAPI.js';
|
|
18
18
|
//# sourceMappingURL=storage-index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-index.js","sourceRoot":"","sources":["../../src/storage/storage-index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"storage-index.js","sourceRoot":"","sources":["../../src/storage/storage-index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-metrics.js","sourceRoot":"","sources":["../../src/storage/storage-metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage-metrics.js","sourceRoot":"","sources":["../../src/storage/storage-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,MAAM,UAAU,wBAAwB,CAAC,MAAqB;IAC5D,MAAM,CAAC,qBAAqB,CAAC;QAC3B,IAAI,EAAE,aAAa,CAAC,sBAAsB;QAC1C,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,qBAAqB,CAAC;QAC3B,IAAI,EAAE,aAAa,CAAC,oBAAoB;QACxC,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,qBAAqB,CAAC;QAC3B,IAAI,EAAE,aAAa,CAAC,oBAAoB;QACxC,WAAW,EAAE,4CAA4C;QACzD,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAAqB,EAAE,OAA6B;IAC/F,MAAM,8BAA8B,GAAG,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;IACvG,MAAM,4BAA4B,GAAG,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACnG,MAAM,4BAA4B,GAAG,MAAM,CAAC,kBAAkB,CAAC,aAA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-
{"version":3,"file":"streams-index.js","sourceRoot":"","sources":["../../src/streams/streams-index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"streams-index.js","sourceRoot":"","sources":["../../src/streams/streams-index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BucketSource, HydratedSyncRules, QuerierError, RequestParameters, ResolvedBucket } from '@powersync/service-sync-rules';
|
|
2
2
|
import * as storage from '../storage/storage-index.js';
|
|
3
3
|
import * as util from '../util/util-index.js';
|
|
4
4
|
import { Logger } from '@powersync/lib-services-framework';
|
|
@@ -79,11 +79,8 @@ export interface CheckpointUpdate {
|
|
|
79
79
|
* If null, assume that any bucket in `buckets` may have been updated.
|
|
80
80
|
*/
|
|
81
81
|
updatedBuckets: Set<string> | typeof INVALIDATE_ALL_BUCKETS;
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
* Map from definition name to count.
|
|
85
|
-
*/
|
|
86
|
-
parameterQueryResultsByDefinition?: Map<string, number>;
|
|
82
|
+
/** The amount of rows fetched from parameters indexes. */
|
|
83
|
+
usedParameterResults: number;
|
|
87
84
|
}
|
|
88
85
|
export declare class BucketParameterState {
|
|
89
86
|
private readonly context;
|
|
@@ -126,7 +123,7 @@ export declare class BucketParameterState {
|
|
|
126
123
|
}
|
|
127
124
|
export interface CheckpointLine {
|
|
128
125
|
checkpointLine: util.StreamingSyncCheckpointDiff | util.StreamingSyncCheckpoint;
|
|
129
|
-
bucketsToFetch:
|
|
126
|
+
bucketsToFetch: ResolvedBucket[];
|
|
130
127
|
/**
|
|
131
128
|
* Call when a checkpoint line is being sent to a client, to update the internal state.
|
|
132
129
|
*/
|
|
@@ -136,7 +133,7 @@ export interface CheckpointLine {
|
|
|
136
133
|
*
|
|
137
134
|
* @param bucketsToFetch List of buckets to fetch - either this.bucketsToFetch, or a subset of it. Defaults to this.bucketsToFetch.
|
|
138
135
|
*/
|
|
139
|
-
getFilteredBucketPositions(bucketsToFetch?:
|
|
136
|
+
getFilteredBucketPositions(bucketsToFetch?: ResolvedBucket[]): storage.BucketDataRequest[];
|
|
140
137
|
/**
|
|
141
138
|
* Update the position of bucket data the client has, after it was sent to the client.
|
|
142
139
|
*
|