@powersync/service-module-mongodb-storage 0.0.0-dev-20260225160713 → 0.0.0-dev-20260313100403
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 +47 -6
- package/dist/storage/MongoBucketStorage.js +16 -3
- package/dist/storage/MongoBucketStorage.js.map +1 -1
- package/dist/storage/MongoReportStorage.d.ts +3 -3
- package/dist/storage/MongoReportStorage.js +5 -5
- package/dist/storage/MongoReportStorage.js.map +1 -1
- package/dist/storage/implementation/MongoBucketBatch.d.ts +13 -11
- package/dist/storage/implementation/MongoBucketBatch.js +208 -127
- package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
- package/dist/storage/implementation/MongoChecksums.d.ts +4 -4
- package/dist/storage/implementation/MongoChecksums.js +1 -0
- package/dist/storage/implementation/MongoChecksums.js.map +1 -1
- package/dist/storage/implementation/MongoCompactor.d.ts +2 -2
- package/dist/storage/implementation/MongoCompactor.js +10 -9
- package/dist/storage/implementation/MongoCompactor.js.map +1 -1
- package/dist/storage/implementation/MongoParameterCompactor.d.ts +2 -2
- package/dist/storage/implementation/MongoParameterCompactor.js.map +1 -1
- package/dist/storage/implementation/MongoPersistedSyncRulesContent.js +2 -7
- package/dist/storage/implementation/MongoPersistedSyncRulesContent.js.map +1 -1
- package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +9 -4
- package/dist/storage/implementation/MongoSyncBucketStorage.js +35 -33
- package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
- package/dist/storage/implementation/MongoSyncRulesLock.d.ts +3 -3
- package/dist/storage/implementation/MongoSyncRulesLock.js.map +1 -1
- package/dist/storage/implementation/MongoWriteCheckpointAPI.d.ts +4 -4
- package/dist/storage/implementation/MongoWriteCheckpointAPI.js.map +1 -1
- package/dist/storage/implementation/OperationBatch.js +3 -2
- package/dist/storage/implementation/OperationBatch.js.map +1 -1
- package/dist/storage/implementation/PersistedBatch.d.ts +11 -4
- package/dist/storage/implementation/PersistedBatch.js +42 -11
- package/dist/storage/implementation/PersistedBatch.js.map +1 -1
- package/dist/storage/implementation/db.d.ts +35 -1
- package/dist/storage/implementation/db.js +99 -0
- package/dist/storage/implementation/db.js.map +1 -1
- package/dist/storage/implementation/models.d.ts +13 -1
- package/dist/storage/implementation/models.js +2 -1
- package/dist/storage/implementation/models.js.map +1 -1
- package/dist/utils/test-utils.d.ts +4 -1
- package/dist/utils/test-utils.js +15 -12
- package/dist/utils/test-utils.js.map +1 -1
- package/dist/utils/util.d.ts +2 -1
- package/dist/utils/util.js +15 -1
- package/dist/utils/util.js.map +1 -1
- package/package.json +7 -7
- package/src/storage/MongoBucketStorage.ts +29 -8
- package/src/storage/MongoReportStorage.ts +5 -5
- package/src/storage/implementation/MongoBucketBatch.ts +263 -177
- package/src/storage/implementation/MongoChecksums.ts +5 -3
- package/src/storage/implementation/MongoCompactor.ts +13 -12
- package/src/storage/implementation/MongoParameterCompactor.ts +3 -3
- package/src/storage/implementation/MongoPersistedSyncRulesContent.ts +3 -11
- package/src/storage/implementation/MongoSyncBucketStorage.ts +33 -26
- package/src/storage/implementation/MongoSyncRulesLock.ts +3 -3
- package/src/storage/implementation/MongoWriteCheckpointAPI.ts +4 -4
- package/src/storage/implementation/OperationBatch.ts +3 -2
- package/src/storage/implementation/PersistedBatch.ts +42 -11
- package/src/storage/implementation/db.ts +129 -1
- package/src/storage/implementation/models.ts +16 -2
- package/src/utils/test-utils.ts +15 -12
- package/src/utils/util.ts +17 -2
- package/test/src/__snapshots__/{connection-report-storage.test.ts.snap → client-connections-storage.test.ts.snap} +68 -68
- package/test/src/__snapshots__/storage.test.ts.snap +201 -0
- package/test/src/__snapshots__/storage_compacting.test.ts.snap +17 -0
- package/test/src/__snapshots__/storage_sync.test.ts.snap +1111 -16
- package/test/src/{connection-report-storage.test.ts → client-connections-storage.test.ts} +1 -1
- package/test/src/storage.test.ts +9 -7
- package/test/src/storage_compacting.test.ts +54 -45
- package/test/src/storage_sync.test.ts +53 -51
- package/test/src/util.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,6 +2,7 @@ import { InternalOpId, SerializedSyncPlan, storage } from '@powersync/service-co
|
|
|
2
2
|
import { SqliteJsonValue } from '@powersync/service-sync-rules';
|
|
3
3
|
import * as bson from 'bson';
|
|
4
4
|
import { event_types } from '@powersync/service-types';
|
|
5
|
+
import { ErrorCode, ServiceError } from '@powersync/lib-services-framework';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Replica id uniquely identifying a row on the source database.
|
|
@@ -37,6 +38,19 @@ export interface CurrentDataDocument {
|
|
|
37
38
|
lookups: bson.Binary[];
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
export interface CurrentDataDocumentV3 {
|
|
42
|
+
_id: SourceKey;
|
|
43
|
+
data: bson.Binary;
|
|
44
|
+
buckets: CurrentBucket[];
|
|
45
|
+
lookups: bson.Binary[];
|
|
46
|
+
/**
|
|
47
|
+
* If set, this can be deleted, once there is a consistent checkpoint >= pending_delete.
|
|
48
|
+
*
|
|
49
|
+
* This must only be set if buckets = [], lookups = [].
|
|
50
|
+
*/
|
|
51
|
+
pending_delete?: bigint;
|
|
52
|
+
}
|
|
53
|
+
|
|
40
54
|
export interface CurrentBucket {
|
|
41
55
|
bucket: string;
|
|
42
56
|
table: string;
|
|
@@ -221,10 +235,10 @@ export interface StorageConfig extends storage.StorageVersionConfig {
|
|
|
221
235
|
|
|
222
236
|
const LONG_CHECKSUMS_STORAGE_VERSION = 2;
|
|
223
237
|
|
|
224
|
-
export function getMongoStorageConfig(storageVersion: number): StorageConfig
|
|
238
|
+
export function getMongoStorageConfig(storageVersion: number): StorageConfig {
|
|
225
239
|
const baseConfig = storage.STORAGE_VERSION_CONFIG[storageVersion];
|
|
226
240
|
if (baseConfig == null) {
|
|
227
|
-
|
|
241
|
+
throw new ServiceError(ErrorCode.PSYNC_S1005, `Unsupported storage version ${storageVersion}`);
|
|
228
242
|
}
|
|
229
243
|
|
|
230
244
|
return { ...baseConfig, longChecksums: storageVersion >= LONG_CHECKSUMS_STORAGE_VERSION };
|
package/src/utils/test-utils.ts
CHANGED
|
@@ -11,22 +11,25 @@ export type MongoTestStorageOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export function mongoTestStorageFactoryGenerator(factoryOptions: MongoTestStorageOptions) {
|
|
14
|
-
return
|
|
15
|
-
|
|
14
|
+
return {
|
|
15
|
+
factory: async (options?: TestStorageOptions) => {
|
|
16
|
+
const db = connectMongoForTests(factoryOptions.url, factoryOptions.isCI);
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
// None of the tests insert data into this collection, so it was never created
|
|
19
|
+
if (!(await db.db.listCollections({ name: db.bucket_parameters.collectionName }).hasNext())) {
|
|
20
|
+
await db.db.createCollection('bucket_parameters');
|
|
21
|
+
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
// Full migrations are not currently run for tests, so we manually create this
|
|
24
|
+
await db.createCheckpointEventsCollection();
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (!options?.doNotClear) {
|
|
27
|
+
await db.clear();
|
|
28
|
+
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
return new MongoBucketStorage(db, { slot_name_prefix: 'test_' }, factoryOptions.internalOptions);
|
|
31
|
+
},
|
|
32
|
+
tableIdStrings: false
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
|
package/src/utils/util.ts
CHANGED
|
@@ -91,10 +91,10 @@ export function mapOpEntry(row: BucketDataDocument): utils.OplogEntry {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
export function replicaIdToSubkey(table:
|
|
94
|
+
export function replicaIdToSubkey(table: storage.SourceTableId, id: storage.ReplicaId): string {
|
|
95
95
|
if (storage.isUUID(id)) {
|
|
96
96
|
// Special case for UUID for backwards-compatiblity
|
|
97
|
-
return `${table
|
|
97
|
+
return `${tableIdString(table)}/${id.toHexString()}`;
|
|
98
98
|
} else {
|
|
99
99
|
// Hashed UUID from the table and id
|
|
100
100
|
const repr = bson.serialize({ table, id });
|
|
@@ -102,6 +102,21 @@ export function replicaIdToSubkey(table: bson.ObjectId, id: storage.ReplicaId):
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
export function mongoTableId(table: storage.SourceTableId): bson.ObjectId {
|
|
106
|
+
if (typeof table == 'string') {
|
|
107
|
+
throw new ServiceAssertionError(`Got string table id, expected ObjectId`);
|
|
108
|
+
}
|
|
109
|
+
return table;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function tableIdString(table: storage.SourceTableId) {
|
|
113
|
+
if (typeof table == 'string') {
|
|
114
|
+
return table;
|
|
115
|
+
} else {
|
|
116
|
+
return table.toHexString();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
105
120
|
export function setSessionSnapshotTime(session: mongo.ClientSession, time: bson.Timestamp) {
|
|
106
121
|
// This is a workaround for the lack of direct support for snapshot reads in the MongoDB driver.
|
|
107
122
|
if (!session.snapshotEnabled) {
|
|
@@ -19,7 +19,7 @@ exports[`Connection reporting storage > Should create a connection report if its
|
|
|
19
19
|
|
|
20
20
|
exports[`Connection reporting storage > Should delete rows older than specified range 1`] = `
|
|
21
21
|
{
|
|
22
|
-
"
|
|
22
|
+
"sdk_breakdown": [
|
|
23
23
|
{
|
|
24
24
|
"clients": 1,
|
|
25
25
|
"sdk": "powersync-dart/1.6.4",
|
|
@@ -51,7 +51,7 @@ exports[`Connection reporting storage > Should delete rows older than specified
|
|
|
51
51
|
"users": 1,
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
|
-
"
|
|
54
|
+
"total_users": 5,
|
|
55
55
|
}
|
|
56
56
|
`;
|
|
57
57
|
|
|
@@ -77,9 +77,9 @@ exports[`Connection reporting storage > Should update a connection report if its
|
|
|
77
77
|
]
|
|
78
78
|
`;
|
|
79
79
|
|
|
80
|
-
exports[`Report storage tests >
|
|
80
|
+
exports[`Report storage tests > getClientConnectionsSummary returns the past day summary 1`] = `
|
|
81
81
|
{
|
|
82
|
-
"
|
|
82
|
+
"sdk_breakdown": [
|
|
83
83
|
{
|
|
84
84
|
"clients": 1,
|
|
85
85
|
"sdk": "powersync-dart/1.6.4",
|
|
@@ -101,13 +101,13 @@ exports[`Report storage tests > Should show connection report data for user over
|
|
|
101
101
|
"users": 1,
|
|
102
102
|
},
|
|
103
103
|
],
|
|
104
|
-
"
|
|
104
|
+
"total_users": 3,
|
|
105
105
|
}
|
|
106
106
|
`;
|
|
107
107
|
|
|
108
|
-
exports[`Report storage tests >
|
|
108
|
+
exports[`Report storage tests > getClientConnectionsSummary returns the past month summary 1`] = `
|
|
109
109
|
{
|
|
110
|
-
"
|
|
110
|
+
"sdk_breakdown": [
|
|
111
111
|
{
|
|
112
112
|
"clients": 1,
|
|
113
113
|
"sdk": "powersync-dart/1.6.4",
|
|
@@ -149,13 +149,13 @@ exports[`Report storage tests > Should show connection report data for user over
|
|
|
149
149
|
"users": 1,
|
|
150
150
|
},
|
|
151
151
|
],
|
|
152
|
-
"
|
|
152
|
+
"total_users": 7,
|
|
153
153
|
}
|
|
154
154
|
`;
|
|
155
155
|
|
|
156
|
-
exports[`Report storage tests >
|
|
156
|
+
exports[`Report storage tests > getClientConnectionsSummary returns the past week summary 1`] = `
|
|
157
157
|
{
|
|
158
|
-
"
|
|
158
|
+
"sdk_breakdown": [
|
|
159
159
|
{
|
|
160
160
|
"clients": 1,
|
|
161
161
|
"sdk": "powersync-dart/1.6.4",
|
|
@@ -187,50 +187,11 @@ exports[`Report storage tests > Should show connection report data for user over
|
|
|
187
187
|
"users": 1,
|
|
188
188
|
},
|
|
189
189
|
],
|
|
190
|
-
"
|
|
190
|
+
"total_users": 5,
|
|
191
191
|
}
|
|
192
192
|
`;
|
|
193
193
|
|
|
194
|
-
exports[`Report storage tests >
|
|
195
|
-
{
|
|
196
|
-
"sdks": [
|
|
197
|
-
{
|
|
198
|
-
"clients": 1,
|
|
199
|
-
"sdk": "powersync-dart/1.6.4",
|
|
200
|
-
"users": 1,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"clients": 1,
|
|
204
|
-
"sdk": "powersync-js/1.21.1",
|
|
205
|
-
"users": 1,
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"clients": 1,
|
|
209
|
-
"sdk": "unknown",
|
|
210
|
-
"users": 1,
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
"users": 2,
|
|
214
|
-
}
|
|
215
|
-
`;
|
|
216
|
-
|
|
217
|
-
exports[`Report storage tests > Should show paginated response of all connections of specified client_id 1`] = `
|
|
218
|
-
{
|
|
219
|
-
"count": 1,
|
|
220
|
-
"cursor": undefined,
|
|
221
|
-
"items": [
|
|
222
|
-
{
|
|
223
|
-
"client_id": "client_two",
|
|
224
|
-
"sdk": "powersync-js/1.21.1",
|
|
225
|
-
"user_agent": "powersync-js/1.21.0 powersync-web Chromium/138 linux",
|
|
226
|
-
"user_id": "user_two",
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
"more": false,
|
|
230
|
-
}
|
|
231
|
-
`;
|
|
232
|
-
|
|
233
|
-
exports[`Report storage tests > Should show paginated response of all connections with a limit 1`] = `
|
|
194
|
+
exports[`Report storage tests > getClientSessions returns paginated sessions with a limit 1`] = `
|
|
234
195
|
{
|
|
235
196
|
"count": 4,
|
|
236
197
|
"cursor": "<removed-for-snapshot>",
|
|
@@ -264,7 +225,7 @@ exports[`Report storage tests > Should show paginated response of all connection
|
|
|
264
225
|
}
|
|
265
226
|
`;
|
|
266
227
|
|
|
267
|
-
exports[`Report storage tests >
|
|
228
|
+
exports[`Report storage tests > getClientSessions returns paginated sessions with a limit 2`] = `
|
|
268
229
|
{
|
|
269
230
|
"count": 4,
|
|
270
231
|
"cursor": undefined,
|
|
@@ -298,7 +259,7 @@ exports[`Report storage tests > Should show paginated response of all connection
|
|
|
298
259
|
}
|
|
299
260
|
`;
|
|
300
261
|
|
|
301
|
-
exports[`Report storage tests >
|
|
262
|
+
exports[`Report storage tests > getClientSessions returns paginated sessions with a limit and date range 1`] = `
|
|
302
263
|
{
|
|
303
264
|
"count": 4,
|
|
304
265
|
"cursor": "<removed-for-snapshot>",
|
|
@@ -332,7 +293,7 @@ exports[`Report storage tests > Should show paginated response of all connection
|
|
|
332
293
|
}
|
|
333
294
|
`;
|
|
334
295
|
|
|
335
|
-
exports[`Report storage tests >
|
|
296
|
+
exports[`Report storage tests > getClientSessions returns paginated sessions with a limit and date range 2`] = `
|
|
336
297
|
{
|
|
337
298
|
"count": 2,
|
|
338
299
|
"cursor": undefined,
|
|
@@ -366,29 +327,23 @@ exports[`Report storage tests > Should show paginated response of all connection
|
|
|
366
327
|
}
|
|
367
328
|
`;
|
|
368
329
|
|
|
369
|
-
exports[`Report storage tests >
|
|
330
|
+
exports[`Report storage tests > getClientSessions returns sessions for a client_id 1`] = `
|
|
370
331
|
{
|
|
371
|
-
"count":
|
|
332
|
+
"count": 1,
|
|
372
333
|
"cursor": undefined,
|
|
373
334
|
"items": [
|
|
374
335
|
{
|
|
375
|
-
"client_id": "
|
|
376
|
-
"sdk": "powersync-
|
|
377
|
-
"user_agent": "powersync-
|
|
378
|
-
"user_id": "
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
"client_id": "",
|
|
382
|
-
"sdk": "unknown",
|
|
383
|
-
"user_agent": "Dart (flutter-web) Chrome/128 android",
|
|
384
|
-
"user_id": "user_one",
|
|
336
|
+
"client_id": "client_two",
|
|
337
|
+
"sdk": "powersync-js/1.21.1",
|
|
338
|
+
"user_agent": "powersync-js/1.21.0 powersync-web Chromium/138 linux",
|
|
339
|
+
"user_id": "user_two",
|
|
385
340
|
},
|
|
386
341
|
],
|
|
387
342
|
"more": false,
|
|
388
343
|
}
|
|
389
344
|
`;
|
|
390
345
|
|
|
391
|
-
exports[`Report storage tests >
|
|
346
|
+
exports[`Report storage tests > getClientSessions returns sessions for a date range 1`] = `
|
|
392
347
|
{
|
|
393
348
|
"count": 6,
|
|
394
349
|
"cursor": undefined,
|
|
@@ -434,7 +389,29 @@ exports[`Report storage tests > Should show paginated response of connections ov
|
|
|
434
389
|
}
|
|
435
390
|
`;
|
|
436
391
|
|
|
437
|
-
exports[`Report storage tests >
|
|
392
|
+
exports[`Report storage tests > getClientSessions returns sessions for a user_id 1`] = `
|
|
393
|
+
{
|
|
394
|
+
"count": 2,
|
|
395
|
+
"cursor": undefined,
|
|
396
|
+
"items": [
|
|
397
|
+
{
|
|
398
|
+
"client_id": "client_one",
|
|
399
|
+
"sdk": "powersync-dart/1.6.4",
|
|
400
|
+
"user_agent": "powersync-dart/1.6.4 Dart (flutter-web) Chrome/128 android",
|
|
401
|
+
"user_id": "user_one",
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"client_id": "",
|
|
405
|
+
"sdk": "unknown",
|
|
406
|
+
"user_agent": "Dart (flutter-web) Chrome/128 android",
|
|
407
|
+
"user_id": "user_one",
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
"more": false,
|
|
411
|
+
}
|
|
412
|
+
`;
|
|
413
|
+
|
|
414
|
+
exports[`Report storage tests > getClientSessions returns sessions for client_id and user_id within a date range 1`] = `
|
|
438
415
|
{
|
|
439
416
|
"count": 1,
|
|
440
417
|
"cursor": undefined,
|
|
@@ -449,3 +426,26 @@ exports[`Report storage tests > Should show paginated response of connections ov
|
|
|
449
426
|
"more": false,
|
|
450
427
|
}
|
|
451
428
|
`;
|
|
429
|
+
|
|
430
|
+
exports[`Report storage tests > getCurrentConnections returns current connections 1`] = `
|
|
431
|
+
{
|
|
432
|
+
"sdk_breakdown": [
|
|
433
|
+
{
|
|
434
|
+
"clients": 1,
|
|
435
|
+
"sdk": "powersync-dart/1.6.4",
|
|
436
|
+
"users": 1,
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"clients": 1,
|
|
440
|
+
"sdk": "powersync-js/1.21.1",
|
|
441
|
+
"users": 1,
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"clients": 1,
|
|
445
|
+
"sdk": "unknown",
|
|
446
|
+
"users": 1,
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
"total_users": 2,
|
|
450
|
+
}
|
|
451
|
+
`;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Mongo Sync Bucket Storage - Data > (insert, delete, insert), (delete) 1`] = `
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
"checksum": 2871785649,
|
|
7
|
+
"object_id": "test1",
|
|
8
|
+
"op": "PUT",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"checksum": 2872534815,
|
|
12
|
+
"object_id": "test1",
|
|
13
|
+
"op": "REMOVE",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"checksum": 2871785649,
|
|
17
|
+
"object_id": "test1",
|
|
18
|
+
"op": "PUT",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"checksum": 2872534815,
|
|
22
|
+
"object_id": "test1",
|
|
23
|
+
"op": "REMOVE",
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
exports[`Mongo Sync Bucket Storage - Data > (insert, delete, insert), (delete) 2`] = `
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"checksum": 2871785649,
|
|
32
|
+
"object_id": "test1",
|
|
33
|
+
"op": "PUT",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"checksum": 2872534815,
|
|
37
|
+
"object_id": "test1",
|
|
38
|
+
"op": "REMOVE",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"checksum": 2871785649,
|
|
42
|
+
"object_id": "test1",
|
|
43
|
+
"op": "PUT",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"checksum": 2872534815,
|
|
47
|
+
"object_id": "test1",
|
|
48
|
+
"op": "REMOVE",
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
exports[`Mongo Sync Bucket Storage - Data > (insert, delete, insert), (delete) 3`] = `
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
"checksum": 2871785649,
|
|
57
|
+
"object_id": "test1",
|
|
58
|
+
"op": "PUT",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"checksum": 2872534815,
|
|
62
|
+
"object_id": "test1",
|
|
63
|
+
"op": "REMOVE",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"checksum": 2871785649,
|
|
67
|
+
"object_id": "test1",
|
|
68
|
+
"op": "PUT",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"checksum": 2872534815,
|
|
72
|
+
"object_id": "test1",
|
|
73
|
+
"op": "REMOVE",
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`Mongo Sync Bucket Storage - Data - v1 > (insert, delete, insert), (delete) 1`] = `
|
|
79
|
+
[
|
|
80
|
+
{
|
|
81
|
+
"checksum": 2871785649,
|
|
82
|
+
"object_id": "test1",
|
|
83
|
+
"op": "PUT",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"checksum": 2872534815,
|
|
87
|
+
"object_id": "test1",
|
|
88
|
+
"op": "REMOVE",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"checksum": 2871785649,
|
|
92
|
+
"object_id": "test1",
|
|
93
|
+
"op": "PUT",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"checksum": 2872534815,
|
|
97
|
+
"object_id": "test1",
|
|
98
|
+
"op": "REMOVE",
|
|
99
|
+
},
|
|
100
|
+
]
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`Mongo Sync Bucket Storage - Data - v2 > (insert, delete, insert), (delete) 1`] = `
|
|
104
|
+
[
|
|
105
|
+
{
|
|
106
|
+
"checksum": 2871785649,
|
|
107
|
+
"object_id": "test1",
|
|
108
|
+
"op": "PUT",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"checksum": 2872534815,
|
|
112
|
+
"object_id": "test1",
|
|
113
|
+
"op": "REMOVE",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"checksum": 2871785649,
|
|
117
|
+
"object_id": "test1",
|
|
118
|
+
"op": "PUT",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"checksum": 2872534815,
|
|
122
|
+
"object_id": "test1",
|
|
123
|
+
"op": "REMOVE",
|
|
124
|
+
},
|
|
125
|
+
]
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
exports[`Mongo Sync Bucket Storage - Data - v3 > (insert, delete, insert), (delete) 1`] = `
|
|
129
|
+
[
|
|
130
|
+
{
|
|
131
|
+
"checksum": 2871785649,
|
|
132
|
+
"object_id": "test1",
|
|
133
|
+
"op": "PUT",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"checksum": 2872534815,
|
|
137
|
+
"object_id": "test1",
|
|
138
|
+
"op": "REMOVE",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"checksum": 2871785649,
|
|
142
|
+
"object_id": "test1",
|
|
143
|
+
"op": "PUT",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"checksum": 2872534815,
|
|
147
|
+
"object_id": "test1",
|
|
148
|
+
"op": "REMOVE",
|
|
149
|
+
},
|
|
150
|
+
]
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
exports[`Mongo Sync Bucket Storage - split buckets > (insert, delete, insert), (delete) 1`] = `
|
|
154
|
+
[
|
|
155
|
+
{
|
|
156
|
+
"checksum": 2871785649,
|
|
157
|
+
"object_id": "test1",
|
|
158
|
+
"op": "PUT",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"checksum": 2872534815,
|
|
162
|
+
"object_id": "test1",
|
|
163
|
+
"op": "REMOVE",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"checksum": 2871785649,
|
|
167
|
+
"object_id": "test1",
|
|
168
|
+
"op": "PUT",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"checksum": 2872534815,
|
|
172
|
+
"object_id": "test1",
|
|
173
|
+
"op": "REMOVE",
|
|
174
|
+
},
|
|
175
|
+
]
|
|
176
|
+
`;
|
|
177
|
+
|
|
178
|
+
exports[`Mongo Sync Bucket Storage - split operations > (insert, delete, insert), (delete) 1`] = `
|
|
179
|
+
[
|
|
180
|
+
{
|
|
181
|
+
"checksum": 2871785649,
|
|
182
|
+
"object_id": "test1",
|
|
183
|
+
"op": "PUT",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"checksum": 2872534815,
|
|
187
|
+
"object_id": "test1",
|
|
188
|
+
"op": "REMOVE",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"checksum": 2871785649,
|
|
192
|
+
"object_id": "test1",
|
|
193
|
+
"op": "PUT",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"checksum": 2872534815,
|
|
197
|
+
"object_id": "test1",
|
|
198
|
+
"op": "REMOVE",
|
|
199
|
+
},
|
|
200
|
+
]
|
|
201
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Mongo Sync Bucket Storage Compact > partial checksums after compacting (2) 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"bucket": "1#global[]",
|
|
6
|
+
"checksum": -1481659821,
|
|
7
|
+
"count": 1,
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`Mongo Sync Bucket Storage Compact > partial checksums after compacting 1`] = `
|
|
12
|
+
{
|
|
13
|
+
"bucket": "1#global[]",
|
|
14
|
+
"checksum": 1874612650,
|
|
15
|
+
"count": 4,
|
|
16
|
+
}
|
|
17
|
+
`;
|