@powersync/service-module-mongodb-storage 0.0.0-dev-20260602073133 → 0.0.0-dev-20260909133214

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.
Files changed (275) hide show
  1. package/CHANGELOG.md +177 -5
  2. package/dist/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.d.ts +3 -0
  3. package/dist/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.js +41 -0
  4. package/dist/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.js.map +1 -0
  5. package/dist/storage/MongoBucketStorage.d.ts +71 -18
  6. package/dist/storage/MongoBucketStorage.js +516 -202
  7. package/dist/storage/MongoBucketStorage.js.map +1 -1
  8. package/dist/storage/implementation/MongoBucketBatch.d.ts +71 -29
  9. package/dist/storage/implementation/MongoBucketBatch.js +140 -66
  10. package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
  11. package/dist/storage/implementation/MongoChecksums.d.ts +41 -13
  12. package/dist/storage/implementation/MongoChecksums.js +36 -121
  13. package/dist/storage/implementation/MongoChecksums.js.map +1 -1
  14. package/dist/storage/implementation/MongoCompactor.d.ts +28 -90
  15. package/dist/storage/implementation/MongoCompactor.js +87 -481
  16. package/dist/storage/implementation/MongoCompactor.js.map +1 -1
  17. package/dist/storage/implementation/MongoHydrationState.d.ts +11 -0
  18. package/dist/storage/implementation/MongoHydrationState.js +49 -0
  19. package/dist/storage/implementation/MongoHydrationState.js.map +1 -0
  20. package/dist/storage/implementation/MongoParameterCompactor.d.ts +82 -8
  21. package/dist/storage/implementation/MongoParameterCompactor.js +312 -76
  22. package/dist/storage/implementation/MongoParameterCompactor.js.map +1 -1
  23. package/dist/storage/implementation/MongoParsedSyncConfigSet.d.ts +21 -0
  24. package/dist/storage/implementation/MongoParsedSyncConfigSet.js +93 -0
  25. package/dist/storage/implementation/MongoParsedSyncConfigSet.js.map +1 -0
  26. package/dist/storage/implementation/MongoPersistedReplicationStream.d.ts +36 -0
  27. package/dist/storage/implementation/MongoPersistedReplicationStream.js +90 -0
  28. package/dist/storage/implementation/MongoPersistedReplicationStream.js.map +1 -0
  29. package/dist/storage/implementation/MongoPersistedSyncConfigContent.d.ts +25 -0
  30. package/dist/storage/implementation/MongoPersistedSyncConfigContent.js +125 -0
  31. package/dist/storage/implementation/MongoPersistedSyncConfigContent.js.map +1 -0
  32. package/dist/storage/implementation/MongoStorageProvider.js +41 -4
  33. package/dist/storage/implementation/MongoStorageProvider.js.map +1 -1
  34. package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +81 -37
  35. package/dist/storage/implementation/MongoSyncBucketStorage.js +159 -86
  36. package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
  37. package/dist/storage/implementation/MongoSyncRulesLock.d.ts +1 -1
  38. package/dist/storage/implementation/MongoSyncRulesLock.js +23 -11
  39. package/dist/storage/implementation/MongoSyncRulesLock.js.map +1 -1
  40. package/dist/storage/implementation/MongoWriteCheckpointAPI.d.ts +11 -8
  41. package/dist/storage/implementation/MongoWriteCheckpointAPI.js +159 -33
  42. package/dist/storage/implementation/MongoWriteCheckpointAPI.js.map +1 -1
  43. package/dist/storage/implementation/SyncRuleStateUpdate.d.ts +11 -5
  44. package/dist/storage/implementation/SyncRuleStateUpdate.js +14 -6
  45. package/dist/storage/implementation/SyncRuleStateUpdate.js.map +1 -1
  46. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.d.ts +28 -0
  47. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.js +2 -0
  48. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.js.map +1 -0
  49. package/dist/storage/implementation/common/PersistedBatch.d.ts +34 -2
  50. package/dist/storage/implementation/common/PersistedBatch.js +63 -10
  51. package/dist/storage/implementation/common/PersistedBatch.js.map +1 -1
  52. package/dist/storage/implementation/common/VersionedPowerSyncMongoBase.js +1 -1
  53. package/dist/storage/implementation/common/VersionedPowerSyncMongoBase.js.map +1 -1
  54. package/dist/storage/implementation/createMongoSyncBucketStorage.d.ts +2 -2
  55. package/dist/storage/implementation/createMongoSyncBucketStorage.js +4 -4
  56. package/dist/storage/implementation/createMongoSyncBucketStorage.js.map +1 -1
  57. package/dist/storage/implementation/db.d.ts +4 -1
  58. package/dist/storage/implementation/db.js +31 -16
  59. package/dist/storage/implementation/db.js.map +1 -1
  60. package/dist/storage/implementation/models.d.ts +55 -13
  61. package/dist/storage/implementation/models.js.map +1 -1
  62. package/dist/storage/implementation/v1/MongoBucketBatchV1.d.ts +15 -1
  63. package/dist/storage/implementation/v1/MongoBucketBatchV1.js +135 -107
  64. package/dist/storage/implementation/v1/MongoBucketBatchV1.js.map +1 -1
  65. package/dist/storage/implementation/v1/MongoChecksumsV1.d.ts +4 -4
  66. package/dist/storage/implementation/v1/MongoChecksumsV1.js +119 -7
  67. package/dist/storage/implementation/v1/MongoChecksumsV1.js.map +1 -1
  68. package/dist/storage/implementation/v1/MongoCompactorV1.d.ts +47 -7
  69. package/dist/storage/implementation/v1/MongoCompactorV1.js +478 -8
  70. package/dist/storage/implementation/v1/MongoCompactorV1.js.map +1 -1
  71. package/dist/storage/implementation/v1/MongoParameterCompactorV1.d.ts +16 -2
  72. package/dist/storage/implementation/v1/MongoParameterCompactorV1.js +20 -9
  73. package/dist/storage/implementation/v1/MongoParameterCompactorV1.js.map +1 -1
  74. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.d.ts +33 -27
  75. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.js +146 -73
  76. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.js.map +1 -1
  77. package/dist/storage/implementation/v1/SingleBucketStoreV1.d.ts +9 -10
  78. package/dist/storage/implementation/v1/SingleBucketStoreV1.js +2 -8
  79. package/dist/storage/implementation/v1/SingleBucketStoreV1.js.map +1 -1
  80. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.d.ts +2 -1
  81. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.js +3 -0
  82. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.js.map +1 -1
  83. package/dist/storage/implementation/v1/models.d.ts +10 -1
  84. package/dist/storage/implementation/v1/models.js +1 -0
  85. package/dist/storage/implementation/v1/models.js.map +1 -1
  86. package/dist/storage/implementation/v3/BucketDataContextV3.d.ts +13 -0
  87. package/dist/storage/implementation/v3/BucketDataContextV3.js +23 -0
  88. package/dist/storage/implementation/v3/BucketDataContextV3.js.map +1 -0
  89. package/dist/storage/implementation/v3/CompactionLease.d.ts +50 -0
  90. package/dist/storage/implementation/v3/CompactionLease.js +131 -0
  91. package/dist/storage/implementation/v3/CompactionLease.js.map +1 -0
  92. package/dist/storage/implementation/v3/MongoBucketBatchV3.d.ts +16 -5
  93. package/dist/storage/implementation/v3/MongoBucketBatchV3.js +393 -262
  94. package/dist/storage/implementation/v3/MongoBucketBatchV3.js.map +1 -1
  95. package/dist/storage/implementation/v3/MongoChecksumsV3.d.ts +30 -9
  96. package/dist/storage/implementation/v3/MongoChecksumsV3.js +161 -20
  97. package/dist/storage/implementation/v3/MongoChecksumsV3.js.map +1 -1
  98. package/dist/storage/implementation/v3/MongoCompactorV3.d.ts +108 -18
  99. package/dist/storage/implementation/v3/MongoCompactorV3.js +1115 -47
  100. package/dist/storage/implementation/v3/MongoCompactorV3.js.map +1 -1
  101. package/dist/storage/implementation/v3/MongoParameterCompactorV3.d.ts +12 -3
  102. package/dist/storage/implementation/v3/MongoParameterCompactorV3.js +13 -8
  103. package/dist/storage/implementation/v3/MongoParameterCompactorV3.js.map +1 -1
  104. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.d.ts +54 -0
  105. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.js +319 -0
  106. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.js.map +1 -0
  107. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.d.ts +61 -36
  108. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.js +353 -161
  109. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.js.map +1 -1
  110. package/dist/storage/implementation/v3/MongoWriteCheckpointAPIV3.d.ts +26 -0
  111. package/dist/storage/implementation/v3/MongoWriteCheckpointAPIV3.js +82 -0
  112. package/dist/storage/implementation/v3/MongoWriteCheckpointAPIV3.js.map +1 -0
  113. package/dist/storage/implementation/v3/PersistedBatchV3.d.ts +8 -3
  114. package/dist/storage/implementation/v3/PersistedBatchV3.js +131 -29
  115. package/dist/storage/implementation/v3/PersistedBatchV3.js.map +1 -1
  116. package/dist/storage/implementation/v3/SourceRecordStoreV3.d.ts +3 -3
  117. package/dist/storage/implementation/v3/SourceRecordStoreV3.js +13 -11
  118. package/dist/storage/implementation/v3/SourceRecordStoreV3.js.map +1 -1
  119. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.d.ts +26 -14
  120. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.js +73 -29
  121. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.js.map +1 -1
  122. package/dist/storage/implementation/v3/bucket-format.d.ts +13 -0
  123. package/dist/storage/implementation/v3/bucket-format.js +79 -0
  124. package/dist/storage/implementation/v3/bucket-format.js.map +1 -0
  125. package/dist/storage/implementation/v3/chunking.d.ts +10 -0
  126. package/dist/storage/implementation/v3/chunking.js +30 -0
  127. package/dist/storage/implementation/v3/chunking.js.map +1 -0
  128. package/dist/storage/implementation/v3/compact-utils.d.ts +107 -0
  129. package/dist/storage/implementation/v3/compact-utils.js +216 -0
  130. package/dist/storage/implementation/v3/compact-utils.js.map +1 -0
  131. package/dist/storage/implementation/v3/compaction-constants.d.ts +5 -0
  132. package/dist/storage/implementation/v3/compaction-constants.js +6 -0
  133. package/dist/storage/implementation/v3/compaction-constants.js.map +1 -0
  134. package/dist/storage/implementation/v3/models.d.ts +187 -23
  135. package/dist/storage/implementation/v3/models.js +11 -28
  136. package/dist/storage/implementation/v3/models.js.map +1 -1
  137. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.d.ts +20 -0
  138. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.js +48 -0
  139. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.js.map +1 -0
  140. package/dist/storage/implementation/v3/object-storage/ObjectStorage.d.ts +33 -0
  141. package/dist/storage/implementation/v3/object-storage/ObjectStorage.js +12 -0
  142. package/dist/storage/implementation/v3/object-storage/ObjectStorage.js.map +1 -0
  143. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.d.ts +68 -0
  144. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.js +154 -0
  145. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.js.map +1 -0
  146. package/dist/storage/implementation/v3/object-storage/ObjectStorageUsage.d.ts +37 -0
  147. package/dist/storage/implementation/v3/object-storage/ObjectStorageUsage.js +167 -0
  148. package/dist/storage/implementation/v3/object-storage/ObjectStorageUsage.js.map +1 -0
  149. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.d.ts +67 -0
  150. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.js +439 -0
  151. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.js.map +1 -0
  152. package/dist/storage/implementation/v3/source-table-utils.d.ts +63 -0
  153. package/dist/storage/implementation/v3/source-table-utils.js +206 -0
  154. package/dist/storage/implementation/v3/source-table-utils.js.map +1 -0
  155. package/dist/storage/storage-index.d.ts +5 -4
  156. package/dist/storage/storage-index.js +5 -4
  157. package/dist/storage/storage-index.js.map +1 -1
  158. package/dist/types/types.d.ts +71 -3
  159. package/dist/types/types.js +58 -2
  160. package/dist/types/types.js.map +1 -1
  161. package/dist/utils/test-utils.d.ts +1 -2
  162. package/dist/utils/test-utils.js +7 -1
  163. package/dist/utils/test-utils.js.map +1 -1
  164. package/dist/utils/util.d.ts +9 -2
  165. package/dist/utils/util.js +131 -5
  166. package/dist/utils/util.js.map +1 -1
  167. package/package.json +13 -19
  168. package/src/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.ts +55 -0
  169. package/src/storage/MongoBucketStorage.ts +728 -242
  170. package/src/storage/implementation/MongoBucketBatch.ts +196 -91
  171. package/src/storage/implementation/MongoChecksums.ts +93 -153
  172. package/src/storage/implementation/MongoCompactor.ts +106 -631
  173. package/src/storage/implementation/MongoHydrationState.ts +61 -0
  174. package/src/storage/implementation/MongoParameterCompactor.ts +392 -87
  175. package/src/storage/implementation/MongoParsedSyncConfigSet.ts +122 -0
  176. package/src/storage/implementation/MongoPersistedReplicationStream.ts +118 -0
  177. package/src/storage/implementation/MongoPersistedSyncConfigContent.ts +156 -0
  178. package/src/storage/implementation/MongoStorageProvider.ts +48 -4
  179. package/src/storage/implementation/MongoSyncBucketStorage.ts +226 -118
  180. package/src/storage/implementation/MongoSyncRulesLock.ts +28 -12
  181. package/src/storage/implementation/MongoWriteCheckpointAPI.ts +194 -52
  182. package/src/storage/implementation/SyncRuleStateUpdate.ts +13 -6
  183. package/src/storage/implementation/common/MongoSyncBucketStorageCheckpoint.ts +31 -0
  184. package/src/storage/implementation/common/PersistedBatch.ts +83 -15
  185. package/src/storage/implementation/common/VersionedPowerSyncMongoBase.ts +1 -1
  186. package/src/storage/implementation/createMongoSyncBucketStorage.ts +21 -7
  187. package/src/storage/implementation/db.ts +40 -22
  188. package/src/storage/implementation/models.ts +58 -14
  189. package/src/storage/implementation/v1/MongoBucketBatchV1.ts +174 -125
  190. package/src/storage/implementation/v1/MongoChecksumsV1.ts +154 -12
  191. package/src/storage/implementation/v1/MongoCompactorV1.ts +594 -25
  192. package/src/storage/implementation/v1/MongoParameterCompactorV1.ts +25 -9
  193. package/src/storage/implementation/v1/MongoSyncBucketStorageV1.ts +226 -129
  194. package/src/storage/implementation/v1/SingleBucketStoreV1.ts +18 -27
  195. package/src/storage/implementation/v1/VersionedPowerSyncMongoV1.ts +11 -1
  196. package/src/storage/implementation/v1/models.ts +12 -1
  197. package/src/storage/implementation/v3/BucketDataContextV3.ts +32 -0
  198. package/src/storage/implementation/v3/CompactionLease.ts +152 -0
  199. package/src/storage/implementation/v3/MongoBucketBatchV3.ts +502 -324
  200. package/src/storage/implementation/v3/MongoChecksumsV3.ts +250 -32
  201. package/src/storage/implementation/v3/MongoCompactorV3.ts +1439 -70
  202. package/src/storage/implementation/v3/MongoParameterCompactorV3.ts +19 -9
  203. package/src/storage/implementation/v3/MongoStoppedSyncConfigCleanup.ts +473 -0
  204. package/src/storage/implementation/v3/MongoSyncBucketStorageV3.ts +453 -211
  205. package/src/storage/implementation/v3/MongoWriteCheckpointAPIV3.ts +111 -0
  206. package/src/storage/implementation/v3/PersistedBatchV3.ts +169 -45
  207. package/src/storage/implementation/v3/SourceRecordStoreV3.ts +12 -12
  208. package/src/storage/implementation/v3/VersionedPowerSyncMongoV3.ts +99 -38
  209. package/src/storage/implementation/v3/bucket-format.ts +99 -0
  210. package/src/storage/implementation/v3/chunking.ts +40 -0
  211. package/src/storage/implementation/v3/compact-utils.ts +320 -0
  212. package/src/storage/implementation/v3/compaction-constants.ts +5 -0
  213. package/src/storage/implementation/v3/models.ts +228 -58
  214. package/src/storage/implementation/v3/object-storage/BucketDataObjectStorage.ts +62 -0
  215. package/src/storage/implementation/v3/object-storage/ObjectStorage.ts +44 -0
  216. package/src/storage/implementation/v3/object-storage/ObjectStorageLifecycle.ts +182 -0
  217. package/src/storage/implementation/v3/object-storage/ObjectStorageUsage.ts +230 -0
  218. package/src/storage/implementation/v3/object-storage/S3ObjectStorage.ts +573 -0
  219. package/src/storage/implementation/v3/source-table-utils.ts +398 -0
  220. package/src/storage/storage-index.ts +14 -4
  221. package/src/types/types.ts +76 -2
  222. package/src/utils/test-utils.ts +8 -3
  223. package/src/utils/util.ts +188 -7
  224. package/test/src/__snapshots__/storage.test.ts.snap +4 -54
  225. package/test/src/__snapshots__/storage_sync.test.ts.snap +652 -645
  226. package/test/src/cleanup-stopped-sync-configs.test.ts +698 -0
  227. package/test/src/compact-utils.test.ts +226 -0
  228. package/test/src/helpers/MemoryObjectStorage.ts +61 -0
  229. package/test/src/helpers/s3TestFactory.ts +69 -0
  230. package/test/src/object_storage_lifecycle.test.ts +59 -0
  231. package/test/src/object_storage_usage.test.ts +255 -0
  232. package/test/src/parameter_compacting_v1.test.ts +120 -0
  233. package/test/src/parameter_compacting_v3.test.ts +192 -0
  234. package/test/src/parameter_compaction_fence.test.ts +276 -0
  235. package/test/src/setup.ts +6 -1
  236. package/test/src/storage.test.ts +478 -13
  237. package/test/src/storage_compacting.test.ts +2516 -107
  238. package/test/src/storage_object_storage_inline_threshold.test.ts +116 -0
  239. package/test/src/storage_s3_checksums.test.ts +190 -0
  240. package/test/src/storage_s3_compaction_lifecycle.test.ts +543 -0
  241. package/test/src/storage_s3_reading.test.ts +768 -0
  242. package/test/src/storage_s3_writing.test.ts +136 -0
  243. package/test/src/storage_sync.test.ts +1507 -76
  244. package/test/src/storeCurrentData.test.ts +227 -0
  245. package/test/src/util.ts +3 -2
  246. package/tsconfig.json +1 -4
  247. package/tsconfig.tsbuildinfo +1 -1
  248. package/dist/storage/implementation/BucketDefinitionMapping.d.ts +0 -15
  249. package/dist/storage/implementation/BucketDefinitionMapping.js +0 -58
  250. package/dist/storage/implementation/BucketDefinitionMapping.js.map +0 -1
  251. package/dist/storage/implementation/MongoPersistedSyncRules.d.ts +0 -14
  252. package/dist/storage/implementation/MongoPersistedSyncRules.js +0 -67
  253. package/dist/storage/implementation/MongoPersistedSyncRules.js.map +0 -1
  254. package/dist/storage/implementation/MongoPersistedSyncRulesContent.d.ts +0 -29
  255. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js +0 -76
  256. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js.map +0 -1
  257. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.d.ts +0 -13
  258. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.js +0 -2
  259. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.js.map +0 -1
  260. package/dist/storage/implementation/common/SingleBucketStore.d.ts +0 -54
  261. package/dist/storage/implementation/common/SingleBucketStore.js +0 -3
  262. package/dist/storage/implementation/common/SingleBucketStore.js.map +0 -1
  263. package/dist/storage/implementation/v3/MongoParameterLookupV3.d.ts +0 -4
  264. package/dist/storage/implementation/v3/MongoParameterLookupV3.js +0 -9
  265. package/dist/storage/implementation/v3/MongoParameterLookupV3.js.map +0 -1
  266. package/dist/storage/implementation/v3/SingleBucketStoreV3.d.ts +0 -18
  267. package/dist/storage/implementation/v3/SingleBucketStoreV3.js +0 -48
  268. package/dist/storage/implementation/v3/SingleBucketStoreV3.js.map +0 -1
  269. package/src/storage/implementation/BucketDefinitionMapping.ts +0 -75
  270. package/src/storage/implementation/MongoPersistedSyncRules.ts +0 -82
  271. package/src/storage/implementation/MongoPersistedSyncRulesContent.ts +0 -101
  272. package/src/storage/implementation/common/MongoSyncBucketStorageContext.ts +0 -15
  273. package/src/storage/implementation/common/SingleBucketStore.ts +0 -63
  274. package/src/storage/implementation/v3/MongoParameterLookupV3.ts +0 -11
  275. package/src/storage/implementation/v3/SingleBucketStoreV3.ts +0 -68
@@ -589,200 +589,6 @@ exports[`sync - mongodb > storage v1 > sync global data 1`] = `
589
589
  ]
590
590
  `;
591
591
 
592
- exports[`sync - mongodb > storage v1 > sync interrupts low-priority buckets on new checkpoints (2) 1`] = `
593
- [
594
- {
595
- "checkpoint": {
596
- "buckets": [
597
- {
598
- "bucket": "b0a[]",
599
- "checksum": -659831575,
600
- "count": 2000,
601
- "priority": 2,
602
- "subscriptions": [
603
- {
604
- "default": 0,
605
- },
606
- ],
607
- },
608
- {
609
- "bucket": "b0b[]",
610
- "checksum": -659831575,
611
- "count": 2000,
612
- "priority": 2,
613
- "subscriptions": [
614
- {
615
- "default": 1,
616
- },
617
- ],
618
- },
619
- {
620
- "bucket": "b1[]",
621
- "checksum": -1096116670,
622
- "count": 1,
623
- "priority": 1,
624
- "subscriptions": [
625
- {
626
- "default": 2,
627
- },
628
- ],
629
- },
630
- ],
631
- "last_op_id": "4001",
632
- "streams": [
633
- {
634
- "errors": [],
635
- "is_default": true,
636
- "name": "b0a",
637
- },
638
- {
639
- "errors": [],
640
- "is_default": true,
641
- "name": "b0b",
642
- },
643
- {
644
- "errors": [],
645
- "is_default": true,
646
- "name": "b1",
647
- },
648
- ],
649
- "write_checkpoint": undefined,
650
- },
651
- },
652
- {
653
- "data": {
654
- "after": "0",
655
- "bucket": "b1[]",
656
- "data": undefined,
657
- "has_more": false,
658
- "next_after": "1",
659
- },
660
- },
661
- {
662
- "partial_checkpoint_complete": {
663
- "last_op_id": "4001",
664
- "priority": 1,
665
- },
666
- },
667
- {
668
- "data": {
669
- "after": "0",
670
- "bucket": "b0a[]",
671
- "data": undefined,
672
- "has_more": true,
673
- "next_after": "2000",
674
- },
675
- },
676
- {
677
- "data": {
678
- "after": "2000",
679
- "bucket": "b0a[]",
680
- "data": undefined,
681
- "has_more": true,
682
- "next_after": "4000",
683
- },
684
- },
685
- {
686
- "checkpoint_diff": {
687
- "last_op_id": "4004",
688
- "removed_buckets": [],
689
- "updated_buckets": [
690
- {
691
- "bucket": "b0a[]",
692
- "checksum": 883076828,
693
- "count": 2001,
694
- "priority": 2,
695
- "subscriptions": [
696
- {
697
- "default": 0,
698
- },
699
- ],
700
- },
701
- {
702
- "bucket": "b0b[]",
703
- "checksum": 883076828,
704
- "count": 2001,
705
- "priority": 2,
706
- "subscriptions": [
707
- {
708
- "default": 1,
709
- },
710
- ],
711
- },
712
- {
713
- "bucket": "b1[]",
714
- "checksum": 1841937527,
715
- "count": 2,
716
- "priority": 1,
717
- "subscriptions": [
718
- {
719
- "default": 2,
720
- },
721
- ],
722
- },
723
- ],
724
- "write_checkpoint": undefined,
725
- },
726
- },
727
- {
728
- "data": {
729
- "after": "1",
730
- "bucket": "b1[]",
731
- "data": undefined,
732
- "has_more": false,
733
- "next_after": "4002",
734
- },
735
- },
736
- {
737
- "partial_checkpoint_complete": {
738
- "last_op_id": "4004",
739
- "priority": 1,
740
- },
741
- },
742
- {
743
- "data": {
744
- "after": "4000",
745
- "bucket": "b0a[]",
746
- "data": undefined,
747
- "has_more": false,
748
- "next_after": "4003",
749
- },
750
- },
751
- {
752
- "data": {
753
- "after": "0",
754
- "bucket": "b0b[]",
755
- "data": undefined,
756
- "has_more": true,
757
- "next_after": "1999",
758
- },
759
- },
760
- {
761
- "data": {
762
- "after": "1999",
763
- "bucket": "b0b[]",
764
- "data": undefined,
765
- "has_more": true,
766
- "next_after": "3999",
767
- },
768
- },
769
- {
770
- "data": {
771
- "after": "3999",
772
- "bucket": "b0b[]",
773
- "data": undefined,
774
- "has_more": false,
775
- "next_after": "4004",
776
- },
777
- },
778
- {
779
- "checkpoint_complete": {
780
- "last_op_id": "4004",
781
- },
782
- },
783
- ]
784
- `;
785
-
786
592
  exports[`sync - mongodb > storage v1 > sync legacy non-raw data 1`] = `
787
593
  [
788
594
  {
@@ -1778,61 +1584,29 @@ exports[`sync - mongodb > storage v2 > sync global data 1`] = `
1778
1584
  ]
1779
1585
  `;
1780
1586
 
1781
- exports[`sync - mongodb > storage v2 > sync interrupts low-priority buckets on new checkpoints (2) 1`] = `
1587
+ exports[`sync - mongodb > storage v2 > sync legacy non-raw data 1`] = `
1782
1588
  [
1783
1589
  {
1784
1590
  "checkpoint": {
1785
1591
  "buckets": [
1786
1592
  {
1787
- "bucket": "1#b0a[]",
1788
- "checksum": -659831575,
1789
- "count": 2000,
1790
- "priority": 2,
1791
- "subscriptions": [
1792
- {
1793
- "default": 0,
1794
- },
1795
- ],
1796
- },
1797
- {
1798
- "bucket": "1#b0b[]",
1799
- "checksum": -659831575,
1800
- "count": 2000,
1801
- "priority": 2,
1802
- "subscriptions": [
1803
- {
1804
- "default": 1,
1805
- },
1806
- ],
1807
- },
1808
- {
1809
- "bucket": "1#b1[]",
1810
- "checksum": -1096116670,
1593
+ "bucket": "1#mybucket[]",
1594
+ "checksum": -852817836,
1811
1595
  "count": 1,
1812
- "priority": 1,
1596
+ "priority": 3,
1813
1597
  "subscriptions": [
1814
1598
  {
1815
- "default": 2,
1599
+ "default": 0,
1816
1600
  },
1817
1601
  ],
1818
1602
  },
1819
1603
  ],
1820
- "last_op_id": "4001",
1604
+ "last_op_id": "1",
1821
1605
  "streams": [
1822
1606
  {
1823
1607
  "errors": [],
1824
1608
  "is_default": true,
1825
- "name": "b0a",
1826
- },
1827
- {
1828
- "errors": [],
1829
- "is_default": true,
1830
- "name": "b0b",
1831
- },
1832
- {
1833
- "errors": [],
1834
- "is_default": true,
1835
- "name": "b1",
1609
+ "name": "mybucket",
1836
1610
  },
1837
1611
  ],
1838
1612
  "write_checkpoint": undefined,
@@ -1841,146 +1615,129 @@ exports[`sync - mongodb > storage v2 > sync interrupts low-priority buckets on n
1841
1615
  {
1842
1616
  "data": {
1843
1617
  "after": "0",
1844
- "bucket": "1#b1[]",
1845
- "data": undefined,
1618
+ "bucket": "1#mybucket[]",
1619
+ "data": [
1620
+ {
1621
+ "checksum": 3442149460n,
1622
+ "data": {
1623
+ "description": "Test
1624
+ "string"",
1625
+ "id": "t1",
1626
+ "large_num": 12345678901234567890n,
1627
+ },
1628
+ "object_id": "t1",
1629
+ "object_type": "test",
1630
+ "op": "PUT",
1631
+ "op_id": "1",
1632
+ "subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
1633
+ },
1634
+ ],
1846
1635
  "has_more": false,
1847
1636
  "next_after": "1",
1848
1637
  },
1849
1638
  },
1850
1639
  {
1851
- "partial_checkpoint_complete": {
1852
- "last_op_id": "4001",
1853
- "priority": 1,
1854
- },
1855
- },
1856
- {
1857
- "data": {
1858
- "after": "0",
1859
- "bucket": "1#b0a[]",
1860
- "data": undefined,
1861
- "has_more": true,
1862
- "next_after": "2000",
1863
- },
1864
- },
1865
- {
1866
- "data": {
1867
- "after": "2000",
1868
- "bucket": "1#b0a[]",
1869
- "data": undefined,
1870
- "has_more": true,
1871
- "next_after": "4000",
1640
+ "checkpoint_complete": {
1641
+ "last_op_id": "1",
1872
1642
  },
1873
1643
  },
1644
+ ]
1645
+ `;
1646
+
1647
+ exports[`sync - mongodb > storage v2 > sync updates to data query only 1`] = `
1648
+ [
1874
1649
  {
1875
- "checkpoint_diff": {
1876
- "last_op_id": "4004",
1877
- "removed_buckets": [],
1878
- "updated_buckets": [
1650
+ "checkpoint": {
1651
+ "buckets": [
1879
1652
  {
1880
- "bucket": "1#b0a[]",
1881
- "checksum": 883076828,
1882
- "count": 2001,
1883
- "priority": 2,
1653
+ "bucket": "1#by_user["user1"]",
1654
+ "checksum": 0,
1655
+ "count": 0,
1656
+ "priority": 3,
1884
1657
  "subscriptions": [
1885
1658
  {
1886
1659
  "default": 0,
1887
1660
  },
1888
1661
  ],
1889
1662
  },
1663
+ ],
1664
+ "last_op_id": "1",
1665
+ "streams": [
1890
1666
  {
1891
- "bucket": "1#b0b[]",
1892
- "checksum": 883076828,
1893
- "count": 2001,
1894
- "priority": 2,
1895
- "subscriptions": [
1896
- {
1897
- "default": 1,
1898
- },
1899
- ],
1900
- },
1901
- {
1902
- "bucket": "1#b1[]",
1903
- "checksum": 1841937527,
1904
- "count": 2,
1905
- "priority": 1,
1906
- "subscriptions": [
1907
- {
1908
- "default": 2,
1909
- },
1910
- ],
1667
+ "errors": [],
1668
+ "is_default": true,
1669
+ "name": "by_user",
1911
1670
  },
1912
1671
  ],
1913
1672
  "write_checkpoint": undefined,
1914
1673
  },
1915
1674
  },
1916
1675
  {
1917
- "data": {
1918
- "after": "1",
1919
- "bucket": "1#b1[]",
1920
- "data": undefined,
1921
- "has_more": false,
1922
- "next_after": "4002",
1676
+ "checkpoint_complete": {
1677
+ "last_op_id": "1",
1923
1678
  },
1924
1679
  },
1680
+ ]
1681
+ `;
1682
+
1683
+ exports[`sync - mongodb > storage v2 > sync updates to data query only 2`] = `
1684
+ [
1925
1685
  {
1926
- "partial_checkpoint_complete": {
1927
- "last_op_id": "4004",
1928
- "priority": 1,
1929
- },
1930
- },
1931
- {
1932
- "data": {
1933
- "after": "4000",
1934
- "bucket": "1#b0a[]",
1935
- "data": undefined,
1936
- "has_more": false,
1937
- "next_after": "4003",
1686
+ "checkpoint_diff": {
1687
+ "last_op_id": "2",
1688
+ "removed_buckets": [],
1689
+ "updated_buckets": [
1690
+ {
1691
+ "bucket": "1#by_user["user1"]",
1692
+ "checksum": 1418351250,
1693
+ "count": 1,
1694
+ "priority": 3,
1695
+ "subscriptions": [
1696
+ {
1697
+ "default": 0,
1698
+ },
1699
+ ],
1700
+ },
1701
+ ],
1702
+ "write_checkpoint": undefined,
1938
1703
  },
1939
1704
  },
1940
1705
  {
1941
1706
  "data": {
1942
1707
  "after": "0",
1943
- "bucket": "1#b0b[]",
1944
- "data": undefined,
1945
- "has_more": true,
1946
- "next_after": "1999",
1947
- },
1948
- },
1949
- {
1950
- "data": {
1951
- "after": "1999",
1952
- "bucket": "1#b0b[]",
1953
- "data": undefined,
1954
- "has_more": true,
1955
- "next_after": "3999",
1956
- },
1957
- },
1958
- {
1959
- "data": {
1960
- "after": "3999",
1961
- "bucket": "1#b0b[]",
1962
- "data": undefined,
1708
+ "bucket": "1#by_user["user1"]",
1709
+ "data": [
1710
+ {
1711
+ "checksum": 1418351250,
1712
+ "data": "{"id":"list1","user_id":"user1","name":"User 1"}",
1713
+ "object_id": "list1",
1714
+ "object_type": "lists",
1715
+ "op": "PUT",
1716
+ "op_id": "2",
1717
+ "subkey": "ae9cbda1-5d8a-5a61-aaa4-366940758339",
1718
+ },
1719
+ ],
1963
1720
  "has_more": false,
1964
- "next_after": "4004",
1721
+ "next_after": "2",
1965
1722
  },
1966
1723
  },
1967
1724
  {
1968
1725
  "checkpoint_complete": {
1969
- "last_op_id": "4004",
1726
+ "last_op_id": "2",
1970
1727
  },
1971
1728
  },
1972
1729
  ]
1973
1730
  `;
1974
1731
 
1975
- exports[`sync - mongodb > storage v2 > sync legacy non-raw data 1`] = `
1732
+ exports[`sync - mongodb > storage v2 > sync updates to global data 1`] = `
1976
1733
  [
1977
1734
  {
1978
1735
  "checkpoint": {
1979
1736
  "buckets": [
1980
1737
  {
1981
1738
  "bucket": "1#mybucket[]",
1982
- "checksum": -852817836,
1983
- "count": 1,
1739
+ "checksum": 0,
1740
+ "count": 0,
1984
1741
  "priority": 3,
1985
1742
  "subscriptions": [
1986
1743
  {
@@ -1989,7 +1746,7 @@ exports[`sync - mongodb > storage v2 > sync legacy non-raw data 1`] = `
1989
1746
  ],
1990
1747
  },
1991
1748
  ],
1992
- "last_op_id": "1",
1749
+ "last_op_id": "0",
1993
1750
  "streams": [
1994
1751
  {
1995
1752
  "errors": [],
@@ -2000,19 +1757,44 @@ exports[`sync - mongodb > storage v2 > sync legacy non-raw data 1`] = `
2000
1757
  "write_checkpoint": undefined,
2001
1758
  },
2002
1759
  },
1760
+ {
1761
+ "checkpoint_complete": {
1762
+ "last_op_id": "0",
1763
+ },
1764
+ },
1765
+ ]
1766
+ `;
1767
+
1768
+ exports[`sync - mongodb > storage v2 > sync updates to global data 2`] = `
1769
+ [
1770
+ {
1771
+ "checkpoint_diff": {
1772
+ "last_op_id": "1",
1773
+ "removed_buckets": [],
1774
+ "updated_buckets": [
1775
+ {
1776
+ "bucket": "1#mybucket[]",
1777
+ "checksum": 920318466,
1778
+ "count": 1,
1779
+ "priority": 3,
1780
+ "subscriptions": [
1781
+ {
1782
+ "default": 0,
1783
+ },
1784
+ ],
1785
+ },
1786
+ ],
1787
+ "write_checkpoint": undefined,
1788
+ },
1789
+ },
2003
1790
  {
2004
1791
  "data": {
2005
1792
  "after": "0",
2006
1793
  "bucket": "1#mybucket[]",
2007
1794
  "data": [
2008
1795
  {
2009
- "checksum": 3442149460n,
2010
- "data": {
2011
- "description": "Test
2012
- "string"",
2013
- "id": "t1",
2014
- "large_num": 12345678901234567890n,
2015
- },
1796
+ "checksum": 920318466,
1797
+ "data": "{"id":"t1","description":"Test 1"}",
2016
1798
  "object_id": "t1",
2017
1799
  "object_type": "test",
2018
1800
  "op": "PUT",
@@ -2032,15 +1814,17 @@ exports[`sync - mongodb > storage v2 > sync legacy non-raw data 1`] = `
2032
1814
  ]
2033
1815
  `;
2034
1816
 
2035
- exports[`sync - mongodb > storage v2 > sync updates to data query only 1`] = `
1817
+ exports[`sync - mongodb > storage v2 > sync updates to global data 3`] = `
2036
1818
  [
2037
1819
  {
2038
- "checkpoint": {
2039
- "buckets": [
1820
+ "checkpoint_diff": {
1821
+ "last_op_id": "2",
1822
+ "removed_buckets": [],
1823
+ "updated_buckets": [
2040
1824
  {
2041
- "bucket": "1#by_user["user1"]",
2042
- "checksum": 0,
2043
- "count": 0,
1825
+ "bucket": "1#mybucket[]",
1826
+ "checksum": -93886621,
1827
+ "count": 2,
2044
1828
  "priority": 3,
2045
1829
  "subscriptions": [
2046
1830
  {
@@ -2049,7 +1833,42 @@ exports[`sync - mongodb > storage v2 > sync updates to data query only 1`] = `
2049
1833
  ],
2050
1834
  },
2051
1835
  ],
2052
- "last_op_id": "1",
1836
+ "write_checkpoint": undefined,
1837
+ },
1838
+ },
1839
+ {
1840
+ "data": {
1841
+ "after": "1",
1842
+ "bucket": "1#mybucket[]",
1843
+ "data": [
1844
+ {
1845
+ "checksum": 3280762209,
1846
+ "data": "{"id":"t2","description":"Test 2"}",
1847
+ "object_id": "t2",
1848
+ "object_type": "test",
1849
+ "op": "PUT",
1850
+ "op_id": "2",
1851
+ "subkey": "13423353-9f27-59b4-baf0-64a5e09f1769",
1852
+ },
1853
+ ],
1854
+ "has_more": false,
1855
+ "next_after": "2",
1856
+ },
1857
+ },
1858
+ {
1859
+ "checkpoint_complete": {
1860
+ "last_op_id": "2",
1861
+ },
1862
+ },
1863
+ ]
1864
+ `;
1865
+
1866
+ exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 1`] = `
1867
+ [
1868
+ {
1869
+ "checkpoint": {
1870
+ "buckets": [],
1871
+ "last_op_id": "0",
2053
1872
  "streams": [
2054
1873
  {
2055
1874
  "errors": [],
@@ -2062,13 +1881,13 @@ exports[`sync - mongodb > storage v2 > sync updates to data query only 1`] = `
2062
1881
  },
2063
1882
  {
2064
1883
  "checkpoint_complete": {
2065
- "last_op_id": "1",
1884
+ "last_op_id": "0",
2066
1885
  },
2067
1886
  },
2068
1887
  ]
2069
1888
  `;
2070
1889
 
2071
- exports[`sync - mongodb > storage v2 > sync updates to data query only 2`] = `
1890
+ exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 2`] = `
2072
1891
  [
2073
1892
  {
2074
1893
  "checkpoint_diff": {
@@ -2101,12 +1920,12 @@ exports[`sync - mongodb > storage v2 > sync updates to data query only 2`] = `
2101
1920
  "object_id": "list1",
2102
1921
  "object_type": "lists",
2103
1922
  "op": "PUT",
2104
- "op_id": "2",
1923
+ "op_id": "1",
2105
1924
  "subkey": "ae9cbda1-5d8a-5a61-aaa4-366940758339",
2106
1925
  },
2107
1926
  ],
2108
1927
  "has_more": false,
2109
- "next_after": "2",
1928
+ "next_after": "1",
2110
1929
  },
2111
1930
  },
2112
1931
  {
@@ -2117,13 +1936,39 @@ exports[`sync - mongodb > storage v2 > sync updates to data query only 2`] = `
2117
1936
  ]
2118
1937
  `;
2119
1938
 
2120
- exports[`sync - mongodb > storage v2 > sync updates to global data 1`] = `
1939
+ exports[`sync - mongodb > storage v2 > sync updates to parameter query only 1`] = `
2121
1940
  [
2122
1941
  {
2123
1942
  "checkpoint": {
2124
- "buckets": [
1943
+ "buckets": [],
1944
+ "last_op_id": "0",
1945
+ "streams": [
2125
1946
  {
2126
- "bucket": "1#mybucket[]",
1947
+ "errors": [],
1948
+ "is_default": true,
1949
+ "name": "by_user",
1950
+ },
1951
+ ],
1952
+ "write_checkpoint": undefined,
1953
+ },
1954
+ },
1955
+ {
1956
+ "checkpoint_complete": {
1957
+ "last_op_id": "0",
1958
+ },
1959
+ },
1960
+ ]
1961
+ `;
1962
+
1963
+ exports[`sync - mongodb > storage v2 > sync updates to parameter query only 2`] = `
1964
+ [
1965
+ {
1966
+ "checkpoint_diff": {
1967
+ "last_op_id": "1",
1968
+ "removed_buckets": [],
1969
+ "updated_buckets": [
1970
+ {
1971
+ "bucket": "1#by_user["user1"]",
2127
1972
  "checksum": 0,
2128
1973
  "count": 0,
2129
1974
  "priority": 3,
@@ -2134,36 +1979,403 @@ exports[`sync - mongodb > storage v2 > sync updates to global data 1`] = `
2134
1979
  ],
2135
1980
  },
2136
1981
  ],
2137
- "last_op_id": "0",
1982
+ "write_checkpoint": undefined,
1983
+ },
1984
+ },
1985
+ {
1986
+ "checkpoint_complete": {
1987
+ "last_op_id": "1",
1988
+ },
1989
+ },
1990
+ ]
1991
+ `;
1992
+
1993
+ exports[`sync - mongodb > storage v3 > can override priority when subscribing to stream 1`] = `
1994
+ [
1995
+ {
1996
+ "checkpoint": {
1997
+ "buckets": [
1998
+ {
1999
+ "bucket": "todos|0.1.1["a"]",
2000
+ "checksum": -1712802421,
2001
+ "count": 1,
2002
+ "priority": 0,
2003
+ "subscriptions": [
2004
+ {
2005
+ "sub": 0,
2006
+ },
2007
+ {
2008
+ "sub": 1,
2009
+ },
2010
+ ],
2011
+ },
2012
+ {
2013
+ "bucket": "todos|0.1.1["b"]",
2014
+ "checksum": -1291414318,
2015
+ "count": 1,
2016
+ "priority": 3,
2017
+ "subscriptions": [
2018
+ {
2019
+ "sub": 1,
2020
+ },
2021
+ ],
2022
+ },
2023
+ ],
2024
+ "last_op_id": "2",
2138
2025
  "streams": [
2139
2026
  {
2140
2027
  "errors": [],
2141
- "is_default": true,
2142
- "name": "mybucket",
2028
+ "is_default": false,
2029
+ "name": "todos",
2143
2030
  },
2144
2031
  ],
2145
2032
  "write_checkpoint": undefined,
2146
2033
  },
2147
2034
  },
2035
+ {
2036
+ "data": {
2037
+ "after": "0",
2038
+ "bucket": "todos|0.1.1["a"]",
2039
+ "data": [
2040
+ {
2041
+ "checksum": 2582164875,
2042
+ "data": "{"id":"a","description":"Test 1"}",
2043
+ "object_id": "a",
2044
+ "object_type": "test",
2045
+ "op": "PUT",
2046
+ "op_id": "1",
2047
+ "subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
2048
+ },
2049
+ ],
2050
+ "has_more": false,
2051
+ "next_after": "1",
2052
+ },
2053
+ },
2054
+ {
2055
+ "partial_checkpoint_complete": {
2056
+ "last_op_id": "2",
2057
+ "priority": 0,
2058
+ },
2059
+ },
2060
+ {
2061
+ "data": {
2062
+ "after": "0",
2063
+ "bucket": "todos|0.1.1["b"]",
2064
+ "data": [
2065
+ {
2066
+ "checksum": 3003552978,
2067
+ "data": "{"id":"b","description":"Test 2"}",
2068
+ "object_id": "b",
2069
+ "object_type": "test",
2070
+ "op": "PUT",
2071
+ "op_id": "2",
2072
+ "subkey": "0dfe86bd-d15b-5fd0-9c7b-a31693030ee0",
2073
+ },
2074
+ ],
2075
+ "has_more": false,
2076
+ "next_after": "2",
2077
+ },
2078
+ },
2079
+ {
2080
+ "checkpoint_complete": {
2081
+ "last_op_id": "2",
2082
+ },
2083
+ },
2084
+ ]
2085
+ `;
2086
+
2087
+ exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 1`] = `
2088
+ [
2089
+ {
2090
+ "checkpoint": {
2091
+ "buckets": [
2092
+ {
2093
+ "bucket": "mybucket.1.1[]",
2094
+ "checksum": -93886621,
2095
+ "count": 2,
2096
+ "priority": 3,
2097
+ "subscriptions": [
2098
+ {
2099
+ "default": 0,
2100
+ },
2101
+ ],
2102
+ },
2103
+ ],
2104
+ "last_op_id": "2",
2105
+ "streams": [
2106
+ {
2107
+ "errors": [],
2108
+ "is_default": true,
2109
+ "name": "mybucket",
2110
+ },
2111
+ ],
2112
+ "write_checkpoint": undefined,
2113
+ },
2114
+ },
2115
+ ]
2116
+ `;
2117
+
2118
+ exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 2`] = `
2119
+ [
2120
+ {
2121
+ "data": {
2122
+ "after": "0",
2123
+ "bucket": "mybucket.1.1[]",
2124
+ "data": [
2125
+ {
2126
+ "checksum": -93886621,
2127
+ "op": "CLEAR",
2128
+ "op_id": "2",
2129
+ },
2130
+ ],
2131
+ "has_more": false,
2132
+ "next_after": "2",
2133
+ },
2134
+ },
2135
+ {
2136
+ "checkpoint_diff": {
2137
+ "last_op_id": "4",
2138
+ "removed_buckets": [],
2139
+ "updated_buckets": [
2140
+ {
2141
+ "bucket": "mybucket.1.1[]",
2142
+ "checksum": 499012468,
2143
+ "count": 4,
2144
+ "priority": 3,
2145
+ "subscriptions": [
2146
+ {
2147
+ "default": 0,
2148
+ },
2149
+ ],
2150
+ },
2151
+ ],
2152
+ "write_checkpoint": undefined,
2153
+ },
2154
+ },
2155
+ {
2156
+ "data": {
2157
+ "after": "2",
2158
+ "bucket": "mybucket.1.1[]",
2159
+ "data": [
2160
+ {
2161
+ "checksum": 1859363232,
2162
+ "data": "{"id":"t1","description":"Test 1b"}",
2163
+ "object_id": "t1",
2164
+ "object_type": "test",
2165
+ "op": "PUT",
2166
+ "op_id": "3",
2167
+ "subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
2168
+ },
2169
+ {
2170
+ "checksum": 3028503153,
2171
+ "data": "{"id":"t2","description":"Test 2b"}",
2172
+ "object_id": "t2",
2173
+ "object_type": "test",
2174
+ "op": "PUT",
2175
+ "op_id": "4",
2176
+ "subkey": "13423353-9f27-59b4-baf0-64a5e09f1769",
2177
+ },
2178
+ ],
2179
+ "has_more": false,
2180
+ "next_after": "4",
2181
+ },
2182
+ },
2183
+ {
2184
+ "checkpoint_complete": {
2185
+ "last_op_id": "4",
2186
+ },
2187
+ },
2188
+ ]
2189
+ `;
2190
+
2191
+ exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for streams 1`] = `
2192
+ [
2193
+ {
2194
+ "checkpoint": {
2195
+ "buckets": [
2196
+ {
2197
+ "bucket": "test|0.1.1[]",
2198
+ "checksum": 920318466,
2199
+ "count": 1,
2200
+ "priority": 3,
2201
+ "subscriptions": [
2202
+ {
2203
+ "default": 0,
2204
+ },
2205
+ ],
2206
+ },
2207
+ ],
2208
+ "last_op_id": "1",
2209
+ "streams": [
2210
+ {
2211
+ "errors": [],
2212
+ "is_default": true,
2213
+ "name": "test",
2214
+ },
2215
+ ],
2216
+ "write_checkpoint": undefined,
2217
+ },
2218
+ },
2219
+ {
2220
+ "data": {
2221
+ "after": "0",
2222
+ "bucket": "test|0.1.1[]",
2223
+ "data": [
2224
+ {
2225
+ "checksum": 920318466,
2226
+ "data": "{"id":"t1","description":"Test 1"}",
2227
+ "object_id": "t1",
2228
+ "object_type": "test",
2229
+ "op": "PUT",
2230
+ "op_id": "1",
2231
+ "subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
2232
+ },
2233
+ ],
2234
+ "has_more": false,
2235
+ "next_after": "1",
2236
+ },
2237
+ },
2238
+ {
2239
+ "checkpoint_complete": {
2240
+ "last_op_id": "1",
2241
+ },
2242
+ },
2243
+ ]
2244
+ `;
2245
+
2246
+ exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for streams 2`] = `
2247
+ [
2248
+ {
2249
+ "checkpoint": {
2250
+ "buckets": [
2251
+ {
2252
+ "bucket": "test2|0.2.1[]",
2253
+ "checksum": 920318466,
2254
+ "count": 1,
2255
+ "priority": 3,
2256
+ "subscriptions": [
2257
+ {
2258
+ "default": 0,
2259
+ },
2260
+ ],
2261
+ },
2262
+ ],
2263
+ "last_op_id": "2",
2264
+ "streams": [
2265
+ {
2266
+ "errors": [],
2267
+ "is_default": true,
2268
+ "name": "test2",
2269
+ },
2270
+ ],
2271
+ "write_checkpoint": undefined,
2272
+ },
2273
+ },
2274
+ {
2275
+ "data": {
2276
+ "after": "0",
2277
+ "bucket": "test2|0.2.1[]",
2278
+ "data": [
2279
+ {
2280
+ "checksum": 920318466,
2281
+ "data": "{"id":"t1","description":"Test 1"}",
2282
+ "object_id": "t1",
2283
+ "object_type": "test",
2284
+ "op": "PUT",
2285
+ "op_id": "2",
2286
+ "subkey": "bfe6a7fc-1a36-5a95-877f-518ff63ecb56",
2287
+ },
2288
+ ],
2289
+ "has_more": false,
2290
+ "next_after": "2",
2291
+ },
2292
+ },
2293
+ {
2294
+ "checkpoint_complete": {
2295
+ "last_op_id": "2",
2296
+ },
2297
+ },
2298
+ ]
2299
+ `;
2300
+
2301
+ exports[`sync - mongodb > storage v3 > sends checkpoint complete line for empty checkpoint 1`] = `
2302
+ [
2303
+ {
2304
+ "checkpoint": {
2305
+ "buckets": [
2306
+ {
2307
+ "bucket": "mybucket.1.1[]",
2308
+ "checksum": -1221282404,
2309
+ "count": 1,
2310
+ "priority": 3,
2311
+ "subscriptions": [
2312
+ {
2313
+ "default": 0,
2314
+ },
2315
+ ],
2316
+ },
2317
+ ],
2318
+ "last_op_id": "1",
2319
+ "streams": [
2320
+ {
2321
+ "errors": [],
2322
+ "is_default": true,
2323
+ "name": "mybucket",
2324
+ },
2325
+ ],
2326
+ "write_checkpoint": undefined,
2327
+ },
2328
+ },
2329
+ {
2330
+ "data": {
2331
+ "after": "0",
2332
+ "bucket": "mybucket.1.1[]",
2333
+ "data": [
2334
+ {
2335
+ "checksum": 3073684892,
2336
+ "data": "{"id":"t1","description":"sync"}",
2337
+ "object_id": "t1",
2338
+ "object_type": "test",
2339
+ "op": "PUT",
2340
+ "op_id": "1",
2341
+ "subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
2342
+ },
2343
+ ],
2344
+ "has_more": false,
2345
+ "next_after": "1",
2346
+ },
2347
+ },
2348
+ null,
2349
+ {
2350
+ "checkpoint_complete": {
2351
+ "last_op_id": "1",
2352
+ },
2353
+ },
2354
+ {
2355
+ "checkpoint_diff": {
2356
+ "last_op_id": "1",
2357
+ "removed_buckets": [],
2358
+ "updated_buckets": [],
2359
+ "write_checkpoint": "1",
2360
+ },
2361
+ },
2148
2362
  {
2149
2363
  "checkpoint_complete": {
2150
- "last_op_id": "0",
2364
+ "last_op_id": "1",
2151
2365
  },
2152
2366
  },
2153
2367
  ]
2154
2368
  `;
2155
2369
 
2156
- exports[`sync - mongodb > storage v2 > sync updates to global data 2`] = `
2370
+ exports[`sync - mongodb > storage v3 > sync updates to data query only 1`] = `
2157
2371
  [
2158
2372
  {
2159
- "checkpoint_diff": {
2160
- "last_op_id": "1",
2161
- "removed_buckets": [],
2162
- "updated_buckets": [
2373
+ "checkpoint": {
2374
+ "buckets": [
2163
2375
  {
2164
- "bucket": "1#mybucket[]",
2165
- "checksum": 920318466,
2166
- "count": 1,
2376
+ "bucket": "by_user.1.1["user1"]",
2377
+ "checksum": 0,
2378
+ "count": 0,
2167
2379
  "priority": 3,
2168
2380
  "subscriptions": [
2169
2381
  {
@@ -2172,26 +2384,15 @@ exports[`sync - mongodb > storage v2 > sync updates to global data 2`] = `
2172
2384
  ],
2173
2385
  },
2174
2386
  ],
2175
- "write_checkpoint": undefined,
2176
- },
2177
- },
2178
- {
2179
- "data": {
2180
- "after": "0",
2181
- "bucket": "1#mybucket[]",
2182
- "data": [
2387
+ "last_op_id": "1",
2388
+ "streams": [
2183
2389
  {
2184
- "checksum": 920318466,
2185
- "data": "{"id":"t1","description":"Test 1"}",
2186
- "object_id": "t1",
2187
- "object_type": "test",
2188
- "op": "PUT",
2189
- "op_id": "1",
2190
- "subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
2390
+ "errors": [],
2391
+ "is_default": true,
2392
+ "name": "by_user",
2191
2393
  },
2192
2394
  ],
2193
- "has_more": false,
2194
- "next_after": "1",
2395
+ "write_checkpoint": undefined,
2195
2396
  },
2196
2397
  },
2197
2398
  {
@@ -2202,7 +2403,7 @@ exports[`sync - mongodb > storage v2 > sync updates to global data 2`] = `
2202
2403
  ]
2203
2404
  `;
2204
2405
 
2205
- exports[`sync - mongodb > storage v2 > sync updates to global data 3`] = `
2406
+ exports[`sync - mongodb > storage v3 > sync updates to data query only 2`] = `
2206
2407
  [
2207
2408
  {
2208
2409
  "checkpoint_diff": {
@@ -2210,9 +2411,9 @@ exports[`sync - mongodb > storage v2 > sync updates to global data 3`] = `
2210
2411
  "removed_buckets": [],
2211
2412
  "updated_buckets": [
2212
2413
  {
2213
- "bucket": "1#mybucket[]",
2214
- "checksum": -93886621,
2215
- "count": 2,
2414
+ "bucket": "by_user.1.1["user1"]",
2415
+ "checksum": 1418351250,
2416
+ "count": 1,
2216
2417
  "priority": 3,
2217
2418
  "subscriptions": [
2218
2419
  {
@@ -2227,16 +2428,16 @@ exports[`sync - mongodb > storage v2 > sync updates to global data 3`] = `
2227
2428
  {
2228
2429
  "data": {
2229
2430
  "after": "1",
2230
- "bucket": "1#mybucket[]",
2431
+ "bucket": "by_user.1.1["user1"]",
2231
2432
  "data": [
2232
2433
  {
2233
- "checksum": 3280762209,
2234
- "data": "{"id":"t2","description":"Test 2"}",
2235
- "object_id": "t2",
2236
- "object_type": "test",
2434
+ "checksum": 1418351250,
2435
+ "data": "{"id":"list1","user_id":"user1","name":"User 1"}",
2436
+ "object_id": "list1",
2437
+ "object_type": "lists",
2237
2438
  "op": "PUT",
2238
2439
  "op_id": "2",
2239
- "subkey": "13423353-9f27-59b4-baf0-64a5e09f1769",
2440
+ "subkey": "ae9cbda1-5d8a-5a61-aaa4-366940758339",
2240
2441
  },
2241
2442
  ],
2242
2443
  "has_more": false,
@@ -2251,7 +2452,7 @@ exports[`sync - mongodb > storage v2 > sync updates to global data 3`] = `
2251
2452
  ]
2252
2453
  `;
2253
2454
 
2254
- exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 1`] = `
2455
+ exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 1`] = `
2255
2456
  [
2256
2457
  {
2257
2458
  "checkpoint": {
@@ -2275,7 +2476,7 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 1`
2275
2476
  ]
2276
2477
  `;
2277
2478
 
2278
- exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 2`] = `
2479
+ exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 2`] = `
2279
2480
  [
2280
2481
  {
2281
2482
  "checkpoint_diff": {
@@ -2283,7 +2484,7 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 2`
2283
2484
  "removed_buckets": [],
2284
2485
  "updated_buckets": [
2285
2486
  {
2286
- "bucket": "1#by_user["user1"]",
2487
+ "bucket": "by_user.1.1["user1"]",
2287
2488
  "checksum": 1418351250,
2288
2489
  "count": 1,
2289
2490
  "priority": 3,
@@ -2300,7 +2501,7 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 2`
2300
2501
  {
2301
2502
  "data": {
2302
2503
  "after": "0",
2303
- "bucket": "1#by_user["user1"]",
2504
+ "bucket": "by_user.1.1["user1"]",
2304
2505
  "data": [
2305
2506
  {
2306
2507
  "checksum": 1418351250,
@@ -2324,7 +2525,7 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query + data 2`
2324
2525
  ]
2325
2526
  `;
2326
2527
 
2327
- exports[`sync - mongodb > storage v2 > sync updates to parameter query only 1`] = `
2528
+ exports[`sync - mongodb > storage v3 > sync updates to parameter query only 1`] = `
2328
2529
  [
2329
2530
  {
2330
2531
  "checkpoint": {
@@ -2348,7 +2549,7 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query only 1`]
2348
2549
  ]
2349
2550
  `;
2350
2551
 
2351
- exports[`sync - mongodb > storage v2 > sync updates to parameter query only 2`] = `
2552
+ exports[`sync - mongodb > storage v3 > sync updates to parameter query only 2`] = `
2352
2553
  [
2353
2554
  {
2354
2555
  "checkpoint_diff": {
@@ -2356,7 +2557,7 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query only 2`]
2356
2557
  "removed_buckets": [],
2357
2558
  "updated_buckets": [
2358
2559
  {
2359
- "bucket": "1#by_user["user1"]",
2560
+ "bucket": "by_user.1.1["user1"]",
2360
2561
  "checksum": 0,
2361
2562
  "count": 0,
2362
2563
  "priority": 3,
@@ -2378,13 +2579,13 @@ exports[`sync - mongodb > storage v2 > sync updates to parameter query only 2`]
2378
2579
  ]
2379
2580
  `;
2380
2581
 
2381
- exports[`sync - mongodb > storage v3 > can override priority when subscribing to stream 1`] = `
2582
+ exports[`sync - mongodb > storage v4 > can override priority when subscribing to stream 1`] = `
2382
2583
  [
2383
2584
  {
2384
2585
  "checkpoint": {
2385
2586
  "buckets": [
2386
2587
  {
2387
- "bucket": "1#todos|0["a"]",
2588
+ "bucket": "todos|0.1.1["a"]",
2388
2589
  "checksum": -1712802421,
2389
2590
  "count": 1,
2390
2591
  "priority": 0,
@@ -2398,7 +2599,7 @@ exports[`sync - mongodb > storage v3 > can override priority when subscribing to
2398
2599
  ],
2399
2600
  },
2400
2601
  {
2401
- "bucket": "1#todos|0["b"]",
2602
+ "bucket": "todos|0.1.1["b"]",
2402
2603
  "checksum": -1291414318,
2403
2604
  "count": 1,
2404
2605
  "priority": 3,
@@ -2423,7 +2624,7 @@ exports[`sync - mongodb > storage v3 > can override priority when subscribing to
2423
2624
  {
2424
2625
  "data": {
2425
2626
  "after": "0",
2426
- "bucket": "1#todos|0["a"]",
2627
+ "bucket": "todos|0.1.1["a"]",
2427
2628
  "data": [
2428
2629
  {
2429
2630
  "checksum": 2582164875,
@@ -2448,7 +2649,7 @@ exports[`sync - mongodb > storage v3 > can override priority when subscribing to
2448
2649
  {
2449
2650
  "data": {
2450
2651
  "after": "0",
2451
- "bucket": "1#todos|0["b"]",
2652
+ "bucket": "todos|0.1.1["b"]",
2452
2653
  "data": [
2453
2654
  {
2454
2655
  "checksum": 3003552978,
@@ -2472,13 +2673,13 @@ exports[`sync - mongodb > storage v3 > can override priority when subscribing to
2472
2673
  ]
2473
2674
  `;
2474
2675
 
2475
- exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 1`] = `
2676
+ exports[`sync - mongodb > storage v4 > compacting data - invalidate checkpoint 1`] = `
2476
2677
  [
2477
2678
  {
2478
2679
  "checkpoint": {
2479
2680
  "buckets": [
2480
2681
  {
2481
- "bucket": "1#mybucket[]",
2682
+ "bucket": "mybucket.1.1[]",
2482
2683
  "checksum": -93886621,
2483
2684
  "count": 2,
2484
2685
  "priority": 3,
@@ -2503,12 +2704,12 @@ exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 1
2503
2704
  ]
2504
2705
  `;
2505
2706
 
2506
- exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 2`] = `
2707
+ exports[`sync - mongodb > storage v4 > compacting data - invalidate checkpoint 2`] = `
2507
2708
  [
2508
2709
  {
2509
2710
  "data": {
2510
2711
  "after": "0",
2511
- "bucket": "1#mybucket[]",
2712
+ "bucket": "mybucket.1.1[]",
2512
2713
  "data": [
2513
2714
  {
2514
2715
  "checksum": -93886621,
@@ -2526,7 +2727,7 @@ exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 2
2526
2727
  "removed_buckets": [],
2527
2728
  "updated_buckets": [
2528
2729
  {
2529
- "bucket": "1#mybucket[]",
2730
+ "bucket": "mybucket.1.1[]",
2530
2731
  "checksum": 499012468,
2531
2732
  "count": 4,
2532
2733
  "priority": 3,
@@ -2543,7 +2744,7 @@ exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 2
2543
2744
  {
2544
2745
  "data": {
2545
2746
  "after": "2",
2546
- "bucket": "1#mybucket[]",
2747
+ "bucket": "mybucket.1.1[]",
2547
2748
  "data": [
2548
2749
  {
2549
2750
  "checksum": 1859363232,
@@ -2576,13 +2777,13 @@ exports[`sync - mongodb > storage v3 > compacting data - invalidate checkpoint 2
2576
2777
  ]
2577
2778
  `;
2578
2779
 
2579
- exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for streams 1`] = `
2780
+ exports[`sync - mongodb > storage v4 > encodes sync rules id in buckets for streams 1`] = `
2580
2781
  [
2581
2782
  {
2582
2783
  "checkpoint": {
2583
2784
  "buckets": [
2584
2785
  {
2585
- "bucket": "1#test|0[]",
2786
+ "bucket": "test|0.1.1[]",
2586
2787
  "checksum": 920318466,
2587
2788
  "count": 1,
2588
2789
  "priority": 3,
@@ -2607,7 +2808,7 @@ exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for stre
2607
2808
  {
2608
2809
  "data": {
2609
2810
  "after": "0",
2610
- "bucket": "1#test|0[]",
2811
+ "bucket": "test|0.1.1[]",
2611
2812
  "data": [
2612
2813
  {
2613
2814
  "checksum": 920318466,
@@ -2631,13 +2832,13 @@ exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for stre
2631
2832
  ]
2632
2833
  `;
2633
2834
 
2634
- exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for streams 2`] = `
2835
+ exports[`sync - mongodb > storage v4 > encodes sync rules id in buckets for streams 2`] = `
2635
2836
  [
2636
2837
  {
2637
2838
  "checkpoint": {
2638
2839
  "buckets": [
2639
2840
  {
2640
- "bucket": "2#test2|0[]",
2841
+ "bucket": "test2|0.2.1[]",
2641
2842
  "checksum": 920318466,
2642
2843
  "count": 1,
2643
2844
  "priority": 3,
@@ -2662,7 +2863,7 @@ exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for stre
2662
2863
  {
2663
2864
  "data": {
2664
2865
  "after": "0",
2665
- "bucket": "2#test2|0[]",
2866
+ "bucket": "test2|0.2.1[]",
2666
2867
  "data": [
2667
2868
  {
2668
2869
  "checksum": 920318466,
@@ -2686,7 +2887,7 @@ exports[`sync - mongodb > storage v3 > encodes sync rules id in buckets for stre
2686
2887
  ]
2687
2888
  `;
2688
2889
 
2689
- exports[`sync - mongodb > storage v3 > expired token 1`] = `
2890
+ exports[`sync - mongodb > storage v4 > expired token 1`] = `
2690
2891
  [
2691
2892
  {
2692
2893
  "token_expires_in": 0,
@@ -2694,13 +2895,13 @@ exports[`sync - mongodb > storage v3 > expired token 1`] = `
2694
2895
  ]
2695
2896
  `;
2696
2897
 
2697
- exports[`sync - mongodb > storage v3 > expiring token 1`] = `
2898
+ exports[`sync - mongodb > storage v4 > expiring token 1`] = `
2698
2899
  [
2699
2900
  {
2700
2901
  "checkpoint": {
2701
2902
  "buckets": [
2702
2903
  {
2703
- "bucket": "1#mybucket[]",
2904
+ "bucket": "mybucket.1.1[]",
2704
2905
  "checksum": 0,
2705
2906
  "count": 0,
2706
2907
  "priority": 3,
@@ -2730,7 +2931,7 @@ exports[`sync - mongodb > storage v3 > expiring token 1`] = `
2730
2931
  ]
2731
2932
  `;
2732
2933
 
2733
- exports[`sync - mongodb > storage v3 > expiring token 2`] = `
2934
+ exports[`sync - mongodb > storage v4 > expiring token 2`] = `
2734
2935
  [
2735
2936
  {
2736
2937
  "token_expires_in": 0,
@@ -2738,13 +2939,13 @@ exports[`sync - mongodb > storage v3 > expiring token 2`] = `
2738
2939
  ]
2739
2940
  `;
2740
2941
 
2741
- exports[`sync - mongodb > storage v3 > sends checkpoint complete line for empty checkpoint 1`] = `
2942
+ exports[`sync - mongodb > storage v4 > sends checkpoint complete line for empty checkpoint 1`] = `
2742
2943
  [
2743
2944
  {
2744
2945
  "checkpoint": {
2745
2946
  "buckets": [
2746
2947
  {
2747
- "bucket": "1#mybucket[]",
2948
+ "bucket": "mybucket.1.1[]",
2748
2949
  "checksum": -1221282404,
2749
2950
  "count": 1,
2750
2951
  "priority": 3,
@@ -2769,7 +2970,7 @@ exports[`sync - mongodb > storage v3 > sends checkpoint complete line for empty
2769
2970
  {
2770
2971
  "data": {
2771
2972
  "after": "0",
2772
- "bucket": "1#mybucket[]",
2973
+ "bucket": "mybucket.1.1[]",
2773
2974
  "data": [
2774
2975
  {
2775
2976
  "checksum": 3073684892,
@@ -2807,13 +3008,13 @@ exports[`sync - mongodb > storage v3 > sends checkpoint complete line for empty
2807
3008
  ]
2808
3009
  `;
2809
3010
 
2810
- exports[`sync - mongodb > storage v3 > sync buckets in order 1`] = `
3011
+ exports[`sync - mongodb > storage v4 > sync buckets in order 1`] = `
2811
3012
  [
2812
3013
  {
2813
3014
  "checkpoint": {
2814
3015
  "buckets": [
2815
3016
  {
2816
- "bucket": "1#b0[]",
3017
+ "bucket": "b0.1.1[]",
2817
3018
  "checksum": 920318466,
2818
3019
  "count": 1,
2819
3020
  "priority": 2,
@@ -2824,7 +3025,7 @@ exports[`sync - mongodb > storage v3 > sync buckets in order 1`] = `
2824
3025
  ],
2825
3026
  },
2826
3027
  {
2827
- "bucket": "1#b1[]",
3028
+ "bucket": "b1.1.2[]",
2828
3029
  "checksum": -1382098757,
2829
3030
  "count": 1,
2830
3031
  "priority": 1,
@@ -2854,7 +3055,7 @@ exports[`sync - mongodb > storage v3 > sync buckets in order 1`] = `
2854
3055
  {
2855
3056
  "data": {
2856
3057
  "after": "0",
2857
- "bucket": "1#b1[]",
3058
+ "bucket": "b1.1.2[]",
2858
3059
  "data": [
2859
3060
  {
2860
3061
  "checksum": 2912868539,
@@ -2879,7 +3080,7 @@ exports[`sync - mongodb > storage v3 > sync buckets in order 1`] = `
2879
3080
  {
2880
3081
  "data": {
2881
3082
  "after": "0",
2882
- "bucket": "1#b0[]",
3083
+ "bucket": "b0.1.1[]",
2883
3084
  "data": [
2884
3085
  {
2885
3086
  "checksum": 920318466,
@@ -2903,13 +3104,13 @@ exports[`sync - mongodb > storage v3 > sync buckets in order 1`] = `
2903
3104
  ]
2904
3105
  `;
2905
3106
 
2906
- exports[`sync - mongodb > storage v3 > sync global data 1`] = `
3107
+ exports[`sync - mongodb > storage v4 > sync global data 1`] = `
2907
3108
  [
2908
3109
  {
2909
3110
  "checkpoint": {
2910
3111
  "buckets": [
2911
3112
  {
2912
- "bucket": "1#mybucket[]",
3113
+ "bucket": "mybucket.1.1[]",
2913
3114
  "checksum": -93886621,
2914
3115
  "count": 2,
2915
3116
  "priority": 3,
@@ -2934,7 +3135,7 @@ exports[`sync - mongodb > storage v3 > sync global data 1`] = `
2934
3135
  {
2935
3136
  "data": {
2936
3137
  "after": "0",
2937
- "bucket": "1#mybucket[]",
3138
+ "bucket": "mybucket.1.1[]",
2938
3139
  "data": [
2939
3140
  {
2940
3141
  "checksum": 920318466,
@@ -2967,207 +3168,13 @@ exports[`sync - mongodb > storage v3 > sync global data 1`] = `
2967
3168
  ]
2968
3169
  `;
2969
3170
 
2970
- exports[`sync - mongodb > storage v3 > sync interrupts low-priority buckets on new checkpoints (2) 1`] = `
2971
- [
2972
- {
2973
- "checkpoint": {
2974
- "buckets": [
2975
- {
2976
- "bucket": "1#b0a[]",
2977
- "checksum": -659831575,
2978
- "count": 2000,
2979
- "priority": 2,
2980
- "subscriptions": [
2981
- {
2982
- "default": 0,
2983
- },
2984
- ],
2985
- },
2986
- {
2987
- "bucket": "1#b0b[]",
2988
- "checksum": -659831575,
2989
- "count": 2000,
2990
- "priority": 2,
2991
- "subscriptions": [
2992
- {
2993
- "default": 1,
2994
- },
2995
- ],
2996
- },
2997
- {
2998
- "bucket": "1#b1[]",
2999
- "checksum": -1096116670,
3000
- "count": 1,
3001
- "priority": 1,
3002
- "subscriptions": [
3003
- {
3004
- "default": 2,
3005
- },
3006
- ],
3007
- },
3008
- ],
3009
- "last_op_id": "4001",
3010
- "streams": [
3011
- {
3012
- "errors": [],
3013
- "is_default": true,
3014
- "name": "b0a",
3015
- },
3016
- {
3017
- "errors": [],
3018
- "is_default": true,
3019
- "name": "b0b",
3020
- },
3021
- {
3022
- "errors": [],
3023
- "is_default": true,
3024
- "name": "b1",
3025
- },
3026
- ],
3027
- "write_checkpoint": undefined,
3028
- },
3029
- },
3030
- {
3031
- "data": {
3032
- "after": "0",
3033
- "bucket": "1#b1[]",
3034
- "data": undefined,
3035
- "has_more": false,
3036
- "next_after": "1",
3037
- },
3038
- },
3039
- {
3040
- "partial_checkpoint_complete": {
3041
- "last_op_id": "4001",
3042
- "priority": 1,
3043
- },
3044
- },
3045
- {
3046
- "data": {
3047
- "after": "0",
3048
- "bucket": "1#b0a[]",
3049
- "data": undefined,
3050
- "has_more": true,
3051
- "next_after": "2000",
3052
- },
3053
- },
3054
- {
3055
- "data": {
3056
- "after": "2000",
3057
- "bucket": "1#b0a[]",
3058
- "data": undefined,
3059
- "has_more": true,
3060
- "next_after": "4000",
3061
- },
3062
- },
3063
- {
3064
- "checkpoint_diff": {
3065
- "last_op_id": "4004",
3066
- "removed_buckets": [],
3067
- "updated_buckets": [
3068
- {
3069
- "bucket": "1#b0a[]",
3070
- "checksum": 883076828,
3071
- "count": 2001,
3072
- "priority": 2,
3073
- "subscriptions": [
3074
- {
3075
- "default": 0,
3076
- },
3077
- ],
3078
- },
3079
- {
3080
- "bucket": "1#b0b[]",
3081
- "checksum": 883076828,
3082
- "count": 2001,
3083
- "priority": 2,
3084
- "subscriptions": [
3085
- {
3086
- "default": 1,
3087
- },
3088
- ],
3089
- },
3090
- {
3091
- "bucket": "1#b1[]",
3092
- "checksum": 1841937527,
3093
- "count": 2,
3094
- "priority": 1,
3095
- "subscriptions": [
3096
- {
3097
- "default": 2,
3098
- },
3099
- ],
3100
- },
3101
- ],
3102
- "write_checkpoint": undefined,
3103
- },
3104
- },
3105
- {
3106
- "data": {
3107
- "after": "1",
3108
- "bucket": "1#b1[]",
3109
- "data": undefined,
3110
- "has_more": false,
3111
- "next_after": "4002",
3112
- },
3113
- },
3114
- {
3115
- "partial_checkpoint_complete": {
3116
- "last_op_id": "4004",
3117
- "priority": 1,
3118
- },
3119
- },
3120
- {
3121
- "data": {
3122
- "after": "4000",
3123
- "bucket": "1#b0a[]",
3124
- "data": undefined,
3125
- "has_more": false,
3126
- "next_after": "4003",
3127
- },
3128
- },
3129
- {
3130
- "data": {
3131
- "after": "0",
3132
- "bucket": "1#b0b[]",
3133
- "data": undefined,
3134
- "has_more": true,
3135
- "next_after": "1999",
3136
- },
3137
- },
3138
- {
3139
- "data": {
3140
- "after": "1999",
3141
- "bucket": "1#b0b[]",
3142
- "data": undefined,
3143
- "has_more": true,
3144
- "next_after": "3999",
3145
- },
3146
- },
3147
- {
3148
- "data": {
3149
- "after": "3999",
3150
- "bucket": "1#b0b[]",
3151
- "data": undefined,
3152
- "has_more": false,
3153
- "next_after": "4004",
3154
- },
3155
- },
3156
- {
3157
- "checkpoint_complete": {
3158
- "last_op_id": "4004",
3159
- },
3160
- },
3161
- ]
3162
- `;
3163
-
3164
- exports[`sync - mongodb > storage v3 > sync legacy non-raw data 1`] = `
3171
+ exports[`sync - mongodb > storage v4 > sync legacy non-raw data 1`] = `
3165
3172
  [
3166
3173
  {
3167
3174
  "checkpoint": {
3168
3175
  "buckets": [
3169
3176
  {
3170
- "bucket": "1#mybucket[]",
3177
+ "bucket": "mybucket.1.1[]",
3171
3178
  "checksum": -852817836,
3172
3179
  "count": 1,
3173
3180
  "priority": 3,
@@ -3192,7 +3199,7 @@ exports[`sync - mongodb > storage v3 > sync legacy non-raw data 1`] = `
3192
3199
  {
3193
3200
  "data": {
3194
3201
  "after": "0",
3195
- "bucket": "1#mybucket[]",
3202
+ "bucket": "mybucket.1.1[]",
3196
3203
  "data": [
3197
3204
  {
3198
3205
  "checksum": 3442149460n,
@@ -3221,13 +3228,13 @@ exports[`sync - mongodb > storage v3 > sync legacy non-raw data 1`] = `
3221
3228
  ]
3222
3229
  `;
3223
3230
 
3224
- exports[`sync - mongodb > storage v3 > sync updates to data query only 1`] = `
3231
+ exports[`sync - mongodb > storage v4 > sync updates to data query only 1`] = `
3225
3232
  [
3226
3233
  {
3227
3234
  "checkpoint": {
3228
3235
  "buckets": [
3229
3236
  {
3230
- "bucket": "1#by_user["user1"]",
3237
+ "bucket": "by_user.1.1["user1"]",
3231
3238
  "checksum": 0,
3232
3239
  "count": 0,
3233
3240
  "priority": 3,
@@ -3257,7 +3264,7 @@ exports[`sync - mongodb > storage v3 > sync updates to data query only 1`] = `
3257
3264
  ]
3258
3265
  `;
3259
3266
 
3260
- exports[`sync - mongodb > storage v3 > sync updates to data query only 2`] = `
3267
+ exports[`sync - mongodb > storage v4 > sync updates to data query only 2`] = `
3261
3268
  [
3262
3269
  {
3263
3270
  "checkpoint_diff": {
@@ -3265,7 +3272,7 @@ exports[`sync - mongodb > storage v3 > sync updates to data query only 2`] = `
3265
3272
  "removed_buckets": [],
3266
3273
  "updated_buckets": [
3267
3274
  {
3268
- "bucket": "1#by_user["user1"]",
3275
+ "bucket": "by_user.1.1["user1"]",
3269
3276
  "checksum": 1418351250,
3270
3277
  "count": 1,
3271
3278
  "priority": 3,
@@ -3281,8 +3288,8 @@ exports[`sync - mongodb > storage v3 > sync updates to data query only 2`] = `
3281
3288
  },
3282
3289
  {
3283
3290
  "data": {
3284
- "after": "0",
3285
- "bucket": "1#by_user["user1"]",
3291
+ "after": "1",
3292
+ "bucket": "by_user.1.1["user1"]",
3286
3293
  "data": [
3287
3294
  {
3288
3295
  "checksum": 1418351250,
@@ -3306,13 +3313,13 @@ exports[`sync - mongodb > storage v3 > sync updates to data query only 2`] = `
3306
3313
  ]
3307
3314
  `;
3308
3315
 
3309
- exports[`sync - mongodb > storage v3 > sync updates to global data 1`] = `
3316
+ exports[`sync - mongodb > storage v4 > sync updates to global data 1`] = `
3310
3317
  [
3311
3318
  {
3312
3319
  "checkpoint": {
3313
3320
  "buckets": [
3314
3321
  {
3315
- "bucket": "1#mybucket[]",
3322
+ "bucket": "mybucket.1.1[]",
3316
3323
  "checksum": 0,
3317
3324
  "count": 0,
3318
3325
  "priority": 3,
@@ -3342,7 +3349,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 1`] = `
3342
3349
  ]
3343
3350
  `;
3344
3351
 
3345
- exports[`sync - mongodb > storage v3 > sync updates to global data 2`] = `
3352
+ exports[`sync - mongodb > storage v4 > sync updates to global data 2`] = `
3346
3353
  [
3347
3354
  {
3348
3355
  "checkpoint_diff": {
@@ -3350,7 +3357,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 2`] = `
3350
3357
  "removed_buckets": [],
3351
3358
  "updated_buckets": [
3352
3359
  {
3353
- "bucket": "1#mybucket[]",
3360
+ "bucket": "mybucket.1.1[]",
3354
3361
  "checksum": 920318466,
3355
3362
  "count": 1,
3356
3363
  "priority": 3,
@@ -3367,7 +3374,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 2`] = `
3367
3374
  {
3368
3375
  "data": {
3369
3376
  "after": "0",
3370
- "bucket": "1#mybucket[]",
3377
+ "bucket": "mybucket.1.1[]",
3371
3378
  "data": [
3372
3379
  {
3373
3380
  "checksum": 920318466,
@@ -3391,7 +3398,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 2`] = `
3391
3398
  ]
3392
3399
  `;
3393
3400
 
3394
- exports[`sync - mongodb > storage v3 > sync updates to global data 3`] = `
3401
+ exports[`sync - mongodb > storage v4 > sync updates to global data 3`] = `
3395
3402
  [
3396
3403
  {
3397
3404
  "checkpoint_diff": {
@@ -3399,7 +3406,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 3`] = `
3399
3406
  "removed_buckets": [],
3400
3407
  "updated_buckets": [
3401
3408
  {
3402
- "bucket": "1#mybucket[]",
3409
+ "bucket": "mybucket.1.1[]",
3403
3410
  "checksum": -93886621,
3404
3411
  "count": 2,
3405
3412
  "priority": 3,
@@ -3416,7 +3423,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 3`] = `
3416
3423
  {
3417
3424
  "data": {
3418
3425
  "after": "1",
3419
- "bucket": "1#mybucket[]",
3426
+ "bucket": "mybucket.1.1[]",
3420
3427
  "data": [
3421
3428
  {
3422
3429
  "checksum": 3280762209,
@@ -3440,7 +3447,7 @@ exports[`sync - mongodb > storage v3 > sync updates to global data 3`] = `
3440
3447
  ]
3441
3448
  `;
3442
3449
 
3443
- exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 1`] = `
3450
+ exports[`sync - mongodb > storage v4 > sync updates to parameter query + data 1`] = `
3444
3451
  [
3445
3452
  {
3446
3453
  "checkpoint": {
@@ -3464,7 +3471,7 @@ exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 1`
3464
3471
  ]
3465
3472
  `;
3466
3473
 
3467
- exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 2`] = `
3474
+ exports[`sync - mongodb > storage v4 > sync updates to parameter query + data 2`] = `
3468
3475
  [
3469
3476
  {
3470
3477
  "checkpoint_diff": {
@@ -3472,7 +3479,7 @@ exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 2`
3472
3479
  "removed_buckets": [],
3473
3480
  "updated_buckets": [
3474
3481
  {
3475
- "bucket": "1#by_user["user1"]",
3482
+ "bucket": "by_user.1.1["user1"]",
3476
3483
  "checksum": 1418351250,
3477
3484
  "count": 1,
3478
3485
  "priority": 3,
@@ -3489,7 +3496,7 @@ exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 2`
3489
3496
  {
3490
3497
  "data": {
3491
3498
  "after": "0",
3492
- "bucket": "1#by_user["user1"]",
3499
+ "bucket": "by_user.1.1["user1"]",
3493
3500
  "data": [
3494
3501
  {
3495
3502
  "checksum": 1418351250,
@@ -3513,7 +3520,7 @@ exports[`sync - mongodb > storage v3 > sync updates to parameter query + data 2`
3513
3520
  ]
3514
3521
  `;
3515
3522
 
3516
- exports[`sync - mongodb > storage v3 > sync updates to parameter query only 1`] = `
3523
+ exports[`sync - mongodb > storage v4 > sync updates to parameter query only 1`] = `
3517
3524
  [
3518
3525
  {
3519
3526
  "checkpoint": {
@@ -3537,7 +3544,7 @@ exports[`sync - mongodb > storage v3 > sync updates to parameter query only 1`]
3537
3544
  ]
3538
3545
  `;
3539
3546
 
3540
- exports[`sync - mongodb > storage v3 > sync updates to parameter query only 2`] = `
3547
+ exports[`sync - mongodb > storage v4 > sync updates to parameter query only 2`] = `
3541
3548
  [
3542
3549
  {
3543
3550
  "checkpoint_diff": {
@@ -3545,7 +3552,7 @@ exports[`sync - mongodb > storage v3 > sync updates to parameter query only 2`]
3545
3552
  "removed_buckets": [],
3546
3553
  "updated_buckets": [
3547
3554
  {
3548
- "bucket": "1#by_user["user1"]",
3555
+ "bucket": "by_user.1.1["user1"]",
3549
3556
  "checksum": 0,
3550
3557
  "count": 0,
3551
3558
  "priority": 3,