@rocicorp/zero 1.12.0-canary.6 → 1.12.0-canary.8

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 (379) hide show
  1. package/out/zero/package.js +10 -10
  2. package/out/zero/package.js.map +1 -1
  3. package/out/zero-cache/src/auth/write-authorizer.js +9 -2
  4. package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
  5. package/out/zero-cache/src/server/change-streamer.js +1 -0
  6. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  7. package/out/zero-cache/src/services/change-source/common/replica-restore.js.map +1 -1
  8. package/out/zero-cache/src/services/change-source/pg/change-source-init.js +17 -9
  9. package/out/zero-cache/src/services/change-source/pg/change-source-init.js.map +1 -1
  10. package/out/zero-cache/src/services/change-streamer/server-start-metrics.js +1 -1
  11. package/out/zero-cache/src/services/change-streamer/server-start-metrics.js.map +1 -1
  12. package/out/zero-cache/src/services/mutagen/mutagen.js +1 -2
  13. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  14. package/out/zero-cache/src/services/mutagen/pusher.js +57 -14
  15. package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
  16. package/out/zero-cache/src/services/view-syncer/drain-coordinator.js +1 -1
  17. package/out/zero-cache/src/services/view-syncer/drain-coordinator.js.map +1 -1
  18. package/out/zero-cache/src/services/view-syncer/view-syncer.js +22 -2
  19. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  20. package/out/zero-cache/src/workers/syncer.js +9 -1
  21. package/out/zero-cache/src/workers/syncer.js.map +1 -1
  22. package/out/zero-client/src/client/version.js +1 -1
  23. package/out/zero-protocol/src/inspect-down.d.ts +81 -81
  24. package/out/zero-protocol/src/up.d.ts +60 -60
  25. package/package.json +10 -10
  26. package/out/shared/src/cache.d.ts +0 -22
  27. package/out/shared/src/cache.d.ts.map +0 -1
  28. package/out/shared/src/custom-key-map.d.ts +0 -26
  29. package/out/shared/src/custom-key-map.d.ts.map +0 -1
  30. package/out/shared/src/custom-key-set.d.ts +0 -25
  31. package/out/shared/src/custom-key-set.d.ts.map +0 -1
  32. package/out/shared/src/logging-test-utils.d.ts +0 -12
  33. package/out/shared/src/logging-test-utils.d.ts.map +0 -1
  34. package/out/shared/src/queue.d.ts +0 -53
  35. package/out/shared/src/queue.d.ts.map +0 -1
  36. package/out/shared/src/ring-buffer.d.ts +0 -42
  37. package/out/shared/src/ring-buffer.d.ts.map +0 -1
  38. package/out/shared/src/sorted-entries.d.ts +0 -2
  39. package/out/shared/src/sorted-entries.d.ts.map +0 -1
  40. package/out/zero/src/server/change-streamer.d.ts +0 -2
  41. package/out/zero/src/server/change-streamer.d.ts.map +0 -1
  42. package/out/zero/src/server/main.d.ts +0 -2
  43. package/out/zero/src/server/main.d.ts.map +0 -1
  44. package/out/zero/src/server/reaper.d.ts +0 -2
  45. package/out/zero/src/server/reaper.d.ts.map +0 -1
  46. package/out/zero/src/server/replicator.d.ts +0 -2
  47. package/out/zero/src/server/replicator.d.ts.map +0 -1
  48. package/out/zero/src/server/syncer.d.ts +0 -2
  49. package/out/zero/src/server/syncer.d.ts.map +0 -1
  50. package/out/zero-cache/src/auth/jwt.d.ts +0 -12
  51. package/out/zero-cache/src/auth/jwt.d.ts.map +0 -1
  52. package/out/zero-cache/src/auth/load-permissions.d.ts +0 -17
  53. package/out/zero-cache/src/auth/load-permissions.d.ts.map +0 -1
  54. package/out/zero-cache/src/auth/write-authorizer.d.ts +0 -28
  55. package/out/zero-cache/src/auth/write-authorizer.d.ts.map +0 -1
  56. package/out/zero-cache/src/config/server-context.d.ts +0 -16
  57. package/out/zero-cache/src/config/server-context.d.ts.map +0 -1
  58. package/out/zero-cache/src/custom/fetch.d.ts +0 -38
  59. package/out/zero-cache/src/custom/fetch.d.ts.map +0 -1
  60. package/out/zero-cache/src/custom/metrics.d.ts +0 -31
  61. package/out/zero-cache/src/custom/metrics.d.ts.map +0 -1
  62. package/out/zero-cache/src/custom-queries/transform-query.d.ts +0 -68
  63. package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +0 -1
  64. package/out/zero-cache/src/db/create.d.ts +0 -12
  65. package/out/zero-cache/src/db/create.d.ts.map +0 -1
  66. package/out/zero-cache/src/db/delete-lite-db.d.ts +0 -2
  67. package/out/zero-cache/src/db/delete-lite-db.d.ts.map +0 -1
  68. package/out/zero-cache/src/db/index-predicate.d.ts +0 -4
  69. package/out/zero-cache/src/db/index-predicate.d.ts.map +0 -1
  70. package/out/zero-cache/src/db/migration-lite.d.ts +0 -78
  71. package/out/zero-cache/src/db/migration-lite.d.ts.map +0 -1
  72. package/out/zero-cache/src/db/migration.d.ts +0 -80
  73. package/out/zero-cache/src/db/migration.d.ts.map +0 -1
  74. package/out/zero-cache/src/db/pg-copy-binary.d.ts +0 -101
  75. package/out/zero-cache/src/db/pg-copy-binary.d.ts.map +0 -1
  76. package/out/zero-cache/src/db/pg-copy.d.ts +0 -30
  77. package/out/zero-cache/src/db/pg-copy.d.ts.map +0 -1
  78. package/out/zero-cache/src/db/pg-type-parser.d.ts +0 -15
  79. package/out/zero-cache/src/db/pg-type-parser.d.ts.map +0 -1
  80. package/out/zero-cache/src/db/transaction-pool.d.ts +0 -205
  81. package/out/zero-cache/src/db/transaction-pool.d.ts.map +0 -1
  82. package/out/zero-cache/src/db/warmup.d.ts +0 -4
  83. package/out/zero-cache/src/db/warmup.d.ts.map +0 -1
  84. package/out/zero-cache/src/observability/events.d.ts +0 -15
  85. package/out/zero-cache/src/observability/events.d.ts.map +0 -1
  86. package/out/zero-cache/src/observability/log-throttle.d.ts +0 -44
  87. package/out/zero-cache/src/observability/log-throttle.d.ts.map +0 -1
  88. package/out/zero-cache/src/server/anonymous-otel-start.d.ts +0 -21
  89. package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +0 -1
  90. package/out/zero-cache/src/server/change-streamer.d.ts +0 -3
  91. package/out/zero-cache/src/server/change-streamer.d.ts.map +0 -1
  92. package/out/zero-cache/src/server/inspector-delegate.d.ts +0 -71
  93. package/out/zero-cache/src/server/inspector-delegate.d.ts.map +0 -1
  94. package/out/zero-cache/src/server/main.d.ts +0 -3
  95. package/out/zero-cache/src/server/main.d.ts.map +0 -1
  96. package/out/zero-cache/src/server/otel-diag-logger.d.ts +0 -16
  97. package/out/zero-cache/src/server/otel-diag-logger.d.ts.map +0 -1
  98. package/out/zero-cache/src/server/otel-start.d.ts +0 -3
  99. package/out/zero-cache/src/server/otel-start.d.ts.map +0 -1
  100. package/out/zero-cache/src/server/priority-op.d.ts +0 -8
  101. package/out/zero-cache/src/server/priority-op.d.ts.map +0 -1
  102. package/out/zero-cache/src/server/reaper.d.ts +0 -3
  103. package/out/zero-cache/src/server/reaper.d.ts.map +0 -1
  104. package/out/zero-cache/src/server/replicator.d.ts +0 -10
  105. package/out/zero-cache/src/server/replicator.d.ts.map +0 -1
  106. package/out/zero-cache/src/server/slot-keeper.d.ts +0 -26
  107. package/out/zero-cache/src/server/slot-keeper.d.ts.map +0 -1
  108. package/out/zero-cache/src/server/syncer-assigner.d.ts +0 -14
  109. package/out/zero-cache/src/server/syncer-assigner.d.ts.map +0 -1
  110. package/out/zero-cache/src/server/syncer.d.ts +0 -3
  111. package/out/zero-cache/src/server/syncer.d.ts.map +0 -1
  112. package/out/zero-cache/src/server/worker-dispatcher.d.ts +0 -17
  113. package/out/zero-cache/src/server/worker-dispatcher.d.ts.map +0 -1
  114. package/out/zero-cache/src/services/analyze.d.ts +0 -9
  115. package/out/zero-cache/src/services/analyze.d.ts.map +0 -1
  116. package/out/zero-cache/src/services/change-source/change-source.d.ts +0 -39
  117. package/out/zero-cache/src/services/change-source/change-source.d.ts.map +0 -1
  118. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts +0 -57
  119. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts.map +0 -1
  120. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts +0 -55
  121. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts.map +0 -1
  122. package/out/zero-cache/src/services/change-source/common/init-cleanup.d.ts +0 -24
  123. package/out/zero-cache/src/services/change-source/common/init-cleanup.d.ts.map +0 -1
  124. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts +0 -140
  125. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts.map +0 -1
  126. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts +0 -14
  127. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts.map +0 -1
  128. package/out/zero-cache/src/services/change-source/custom/change-source.d.ts +0 -25
  129. package/out/zero-cache/src/services/change-source/custom/change-source.d.ts.map +0 -1
  130. package/out/zero-cache/src/services/change-source/pg/backfill-metadata.d.ts +0 -14
  131. package/out/zero-cache/src/services/change-source/pg/backfill-metadata.d.ts.map +0 -1
  132. package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts +0 -36
  133. package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts.map +0 -1
  134. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts +0 -72
  135. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts.map +0 -1
  136. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts +0 -127
  137. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +0 -1
  138. package/out/zero-cache/src/services/change-source/pg/fork-request.d.ts +0 -57
  139. package/out/zero-cache/src/services/change-source/pg/fork-request.d.ts.map +0 -1
  140. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +0 -155
  141. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +0 -1
  142. package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts +0 -17
  143. package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts.map +0 -1
  144. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.d.ts +0 -28
  145. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.d.ts.map +0 -1
  146. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput.types.d.ts +0 -76
  147. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput.types.d.ts.map +0 -1
  148. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts +0 -169
  149. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +0 -1
  150. package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.d.ts +0 -16
  151. package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.d.ts.map +0 -1
  152. package/out/zero-cache/src/services/change-source/pg/replication-slot-health.d.ts +0 -15
  153. package/out/zero-cache/src/services/change-source/pg/replication-slot-health.d.ts.map +0 -1
  154. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts +0 -127
  155. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts.map +0 -1
  156. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts +0 -9
  157. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts.map +0 -1
  158. package/out/zero-cache/src/services/change-source/protocol/backfill-progress.d.ts +0 -68
  159. package/out/zero-cache/src/services/change-source/protocol/backfill-progress.d.ts.map +0 -1
  160. package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.d.ts +0 -72
  161. package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.d.ts.map +0 -1
  162. package/out/zero-cache/src/services/change-streamer/backfill-state.d.ts +0 -50
  163. package/out/zero-cache/src/services/change-streamer/backfill-state.d.ts.map +0 -1
  164. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts +0 -12
  165. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts.map +0 -1
  166. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts +0 -57
  167. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts.map +0 -1
  168. package/out/zero-cache/src/services/change-streamer/broadcast.d.ts +0 -98
  169. package/out/zero-cache/src/services/change-streamer/broadcast.d.ts.map +0 -1
  170. package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts +0 -34
  171. package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts.map +0 -1
  172. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts +0 -34
  173. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts.map +0 -1
  174. package/out/zero-cache/src/services/change-streamer/change-log-initializer.d.ts +0 -158
  175. package/out/zero-cache/src/services/change-streamer/change-log-initializer.d.ts.map +0 -1
  176. package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.d.ts +0 -19
  177. package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.d.ts.map +0 -1
  178. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +0 -78
  179. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +0 -1
  180. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +0 -152
  181. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +0 -1
  182. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +0 -575
  183. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.map +0 -1
  184. package/out/zero-cache/src/services/change-streamer/drain-tracker.d.ts +0 -24
  185. package/out/zero-cache/src/services/change-streamer/drain-tracker.d.ts.map +0 -1
  186. package/out/zero-cache/src/services/change-streamer/error-type-enum.d.ts +0 -15
  187. package/out/zero-cache/src/services/change-streamer/error-type-enum.d.ts.map +0 -1
  188. package/out/zero-cache/src/services/change-streamer/forwarder.d.ts +0 -49
  189. package/out/zero-cache/src/services/change-streamer/forwarder.d.ts.map +0 -1
  190. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.d.ts +0 -80
  191. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.d.ts.map +0 -1
  192. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.d.ts +0 -88
  193. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.d.ts.map +0 -1
  194. package/out/zero-cache/src/services/change-streamer/replica-poller.d.ts +0 -15
  195. package/out/zero-cache/src/services/change-streamer/replica-poller.d.ts.map +0 -1
  196. package/out/zero-cache/src/services/change-streamer/restore-admission.d.ts +0 -243
  197. package/out/zero-cache/src/services/change-streamer/restore-admission.d.ts.map +0 -1
  198. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts +0 -6
  199. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts.map +0 -1
  200. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts +0 -152
  201. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts.map +0 -1
  202. package/out/zero-cache/src/services/change-streamer/server-start-metrics.d.ts +0 -33
  203. package/out/zero-cache/src/services/change-streamer/server-start-metrics.d.ts.map +0 -1
  204. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts +0 -11
  205. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts.map +0 -1
  206. package/out/zero-cache/src/services/change-streamer/snapshot-message.d.ts +0 -92
  207. package/out/zero-cache/src/services/change-streamer/snapshot-message.d.ts.map +0 -1
  208. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts +0 -36
  209. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts.map +0 -1
  210. package/out/zero-cache/src/services/change-streamer/snapshot.d.ts +0 -22
  211. package/out/zero-cache/src/services/change-streamer/snapshot.d.ts.map +0 -1
  212. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts +0 -99
  213. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts.map +0 -1
  214. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts +0 -83
  215. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts.map +0 -1
  216. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.d.ts +0 -121
  217. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.d.ts.map +0 -1
  218. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts +0 -73
  219. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts.map +0 -1
  220. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts +0 -62
  221. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts.map +0 -1
  222. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.d.ts +0 -114
  223. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.d.ts.map +0 -1
  224. package/out/zero-cache/src/services/change-streamer/storer.d.ts +0 -276
  225. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +0 -1
  226. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts +0 -485
  227. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts.map +0 -1
  228. package/out/zero-cache/src/services/change-streamer/subscriber.d.ts +0 -205
  229. package/out/zero-cache/src/services/change-streamer/subscriber.d.ts.map +0 -1
  230. package/out/zero-cache/src/services/change-streamer/upstream-acker.d.ts +0 -52
  231. package/out/zero-cache/src/services/change-streamer/upstream-acker.d.ts.map +0 -1
  232. package/out/zero-cache/src/services/limiter/sliding-window-limiter.d.ts +0 -57
  233. package/out/zero-cache/src/services/limiter/sliding-window-limiter.d.ts.map +0 -1
  234. package/out/zero-cache/src/services/litestream/commands.d.ts +0 -77
  235. package/out/zero-cache/src/services/litestream/commands.d.ts.map +0 -1
  236. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts +0 -78
  237. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts.map +0 -1
  238. package/out/zero-cache/src/services/litestream/metrics.d.ts +0 -31
  239. package/out/zero-cache/src/services/litestream/metrics.d.ts.map +0 -1
  240. package/out/zero-cache/src/services/litestream/restore-progress.d.ts +0 -24
  241. package/out/zero-cache/src/services/litestream/restore-progress.d.ts.map +0 -1
  242. package/out/zero-cache/src/services/mutagen/mutagen.d.ts +0 -40
  243. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +0 -1
  244. package/out/zero-cache/src/services/mutagen/pusher.d.ts +0 -63
  245. package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +0 -1
  246. package/out/zero-cache/src/services/replicator/change-log-db.d.ts +0 -368
  247. package/out/zero-cache/src/services/replicator/change-log-db.d.ts.map +0 -1
  248. package/out/zero-cache/src/services/replicator/change-log-stream-writer.d.ts +0 -56
  249. package/out/zero-cache/src/services/replicator/change-log-stream-writer.d.ts.map +0 -1
  250. package/out/zero-cache/src/services/replicator/change-processor.d.ts +0 -37
  251. package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +0 -1
  252. package/out/zero-cache/src/services/replicator/drain-handler.d.ts +0 -82
  253. package/out/zero-cache/src/services/replicator/drain-handler.d.ts.map +0 -1
  254. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts +0 -25
  255. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +0 -1
  256. package/out/zero-cache/src/services/replicator/notifier.d.ts +0 -9
  257. package/out/zero-cache/src/services/replicator/notifier.d.ts.map +0 -1
  258. package/out/zero-cache/src/services/replicator/replication-status.d.ts +0 -71
  259. package/out/zero-cache/src/services/replicator/replication-status.d.ts.map +0 -1
  260. package/out/zero-cache/src/services/replicator/replicator.d.ts +0 -86
  261. package/out/zero-cache/src/services/replicator/replicator.d.ts.map +0 -1
  262. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts +0 -55
  263. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts.map +0 -1
  264. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts +0 -132
  265. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts.map +0 -1
  266. package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.d.ts +0 -120
  267. package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.d.ts.map +0 -1
  268. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts +0 -111
  269. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts.map +0 -1
  270. package/out/zero-cache/src/services/run-ast.d.ts +0 -39
  271. package/out/zero-cache/src/services/run-ast.d.ts.map +0 -1
  272. package/out/zero-cache/src/services/runner.d.ts +0 -19
  273. package/out/zero-cache/src/services/runner.d.ts.map +0 -1
  274. package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts +0 -17
  275. package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts.map +0 -1
  276. package/out/zero-cache/src/services/view-syncer/advancement-metrics.d.ts +0 -26
  277. package/out/zero-cache/src/services/view-syncer/advancement-metrics.d.ts.map +0 -1
  278. package/out/zero-cache/src/services/view-syncer/batch-pacer.d.ts +0 -79
  279. package/out/zero-cache/src/services/view-syncer/batch-pacer.d.ts.map +0 -1
  280. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts +0 -97
  281. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +0 -1
  282. package/out/zero-cache/src/services/view-syncer/client-schema.d.ts +0 -18
  283. package/out/zero-cache/src/services/view-syncer/client-schema.d.ts.map +0 -1
  284. package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts +0 -184
  285. package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts.map +0 -1
  286. package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts +0 -22
  287. package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts.map +0 -1
  288. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +0 -128
  289. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +0 -1
  290. package/out/zero-cache/src/services/view-syncer/cvr.d.ts +0 -294
  291. package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +0 -1
  292. package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.d.ts +0 -81
  293. package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.d.ts.map +0 -1
  294. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts +0 -45
  295. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts.map +0 -1
  296. package/out/zero-cache/src/services/view-syncer/e2e-serving-lag.d.ts +0 -53
  297. package/out/zero-cache/src/services/view-syncer/e2e-serving-lag.d.ts.map +0 -1
  298. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts +0 -33
  299. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts.map +0 -1
  300. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts +0 -51
  301. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts.map +0 -1
  302. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts +0 -34
  303. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts.map +0 -1
  304. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +0 -296
  305. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +0 -1
  306. package/out/zero-cache/src/services/view-syncer/plan-warnings.d.ts +0 -7
  307. package/out/zero-cache/src/services/view-syncer/plan-warnings.d.ts.map +0 -1
  308. package/out/zero-cache/src/services/view-syncer/push-cost.d.ts +0 -132
  309. package/out/zero-cache/src/services/view-syncer/push-cost.d.ts.map +0 -1
  310. package/out/zero-cache/src/services/view-syncer/push-cutoff.d.ts +0 -55
  311. package/out/zero-cache/src/services/view-syncer/push-cutoff.d.ts.map +0 -1
  312. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts +0 -28
  313. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts.map +0 -1
  314. package/out/zero-cache/src/services/view-syncer/query-shape.d.ts +0 -25
  315. package/out/zero-cache/src/services/view-syncer/query-shape.d.ts.map +0 -1
  316. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts +0 -89
  317. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts.map +0 -1
  318. package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts +0 -90
  319. package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts.map +0 -1
  320. package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts +0 -17
  321. package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts.map +0 -1
  322. package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts +0 -86
  323. package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts.map +0 -1
  324. package/out/zero-cache/src/services/view-syncer/schema/init.d.ts +0 -5
  325. package/out/zero-cache/src/services/view-syncer/schema/init.d.ts.map +0 -1
  326. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +0 -563
  327. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +0 -1
  328. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts +0 -95
  329. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts.map +0 -1
  330. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +0 -420
  331. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +0 -1
  332. package/out/zero-cache/src/services/view-syncer/tracer.d.ts +0 -2
  333. package/out/zero-cache/src/services/view-syncer/tracer.d.ts.map +0 -1
  334. package/out/zero-cache/src/services/view-syncer/ttl-clock.d.ts +0 -10
  335. package/out/zero-cache/src/services/view-syncer/ttl-clock.d.ts.map +0 -1
  336. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +0 -133
  337. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +0 -1
  338. package/out/zero-cache/src/types/downstream.d.ts +0 -11
  339. package/out/zero-cache/src/types/downstream.d.ts.map +0 -1
  340. package/out/zero-cache/src/types/error-with-level.d.ts +0 -9
  341. package/out/zero-cache/src/types/error-with-level.d.ts.map +0 -1
  342. package/out/zero-cache/src/types/pg-patch.d.ts +0 -21
  343. package/out/zero-cache/src/types/pg-patch.d.ts.map +0 -1
  344. package/out/zero-cache/src/types/pg-versions.d.ts +0 -3
  345. package/out/zero-cache/src/types/pg-versions.d.ts.map +0 -1
  346. package/out/zero-cache/src/types/poke-chunk.d.ts +0 -18
  347. package/out/zero-cache/src/types/poke-chunk.d.ts.map +0 -1
  348. package/out/zero-cache/src/types/streams.d.ts +0 -115
  349. package/out/zero-cache/src/types/streams.d.ts.map +0 -1
  350. package/out/zero-cache/src/types/subscription.d.ts +0 -197
  351. package/out/zero-cache/src/types/subscription.d.ts.map +0 -1
  352. package/out/zero-cache/src/workers/connect-params.d.ts +0 -28
  353. package/out/zero-cache/src/workers/connect-params.d.ts.map +0 -1
  354. package/out/zero-cache/src/workers/connection.d.ts +0 -77
  355. package/out/zero-cache/src/workers/connection.d.ts.map +0 -1
  356. package/out/zero-cache/src/workers/replicator.d.ts +0 -57
  357. package/out/zero-cache/src/workers/replicator.d.ts.map +0 -1
  358. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts +0 -14
  359. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +0 -1
  360. package/out/zero-cache/src/workers/syncer.d.ts +0 -67
  361. package/out/zero-cache/src/workers/syncer.d.ts.map +0 -1
  362. package/out/zero-events/src/index.d.ts +0 -27
  363. package/out/zero-events/src/index.d.ts.map +0 -1
  364. package/out/zero-events/src/json.d.ts +0 -20
  365. package/out/zero-events/src/json.d.ts.map +0 -1
  366. package/out/zero-events/src/status.d.ts +0 -144
  367. package/out/zero-events/src/status.d.ts.map +0 -1
  368. package/out/zqlite/src/database-storage.d.ts +0 -43
  369. package/out/zqlite/src/database-storage.d.ts.map +0 -1
  370. package/out/zqlite/src/explain-queries.d.ts +0 -4
  371. package/out/zqlite/src/explain-queries.d.ts.map +0 -1
  372. package/out/zqlite/src/internal/sql-inline.d.ts +0 -13
  373. package/out/zqlite/src/internal/sql-inline.d.ts.map +0 -1
  374. package/out/zqlite/src/resolve-scalar-subqueries.d.ts +0 -72
  375. package/out/zqlite/src/resolve-scalar-subqueries.d.ts.map +0 -1
  376. package/out/zqlite/src/sqlite-cost-model.d.ts +0 -17
  377. package/out/zqlite/src/sqlite-cost-model.d.ts.map +0 -1
  378. package/out/zqlite/src/sqlite-stat-fanout.d.ts +0 -121
  379. package/out/zqlite/src/sqlite-stat-fanout.d.ts.map +0 -1
@@ -1,127 +0,0 @@
1
- import type { Readable } from 'node:stream';
2
- import type { LogContext } from '@rocicorp/logger';
3
- import postgres from 'postgres';
4
- import { type PostgresDB } from '../../../types/pg.ts';
5
- import { type ShardID } from '../../../types/shards.ts';
6
- import { type ReplicaStage } from './schema/replica-stage-enum.ts';
7
- import { type BackupOptions, type ReplicaState } from './schema/shard.ts';
8
- export type ReplicationSlot = {
9
- slot_name: string;
10
- consistent_point: string;
11
- snapshot_name: string;
12
- output_plugin: string;
13
- };
14
- export type ReplicationSlotResult<T> = {
15
- slot: ReplicationSlot;
16
- capturedSnapshot: T;
17
- initialSession: Readable;
18
- replica: ReplicaState;
19
- };
20
- export type ReservedSlot = {
21
- slot: string;
22
- reservation: Readable;
23
- replica: ReplicaState;
24
- };
25
- export type CreateSlotSpec = {
26
- slotName: string;
27
- failover?: boolean;
28
- temporary?: boolean;
29
- lockTimeout?: number | undefined;
30
- diagnosticsDB?: PostgresDB | undefined;
31
- };
32
- export declare const CREATE_REPLICATION_SLOT_TIMEOUT_MS = 60000;
33
- /** Thrown when the client-side timeout for creating a slot is reached. */
34
- export declare class SlotCreationTimeoutError extends Error {
35
- readonly name = "SlotCreationTimeoutError";
36
- }
37
- export declare function createReplicationSlot(lc: LogContext, session: postgres.Sql, { slotName, failover, temporary, lockTimeout, diagnosticsDB, }: CreateSlotSpec): Promise<ReplicationSlot>;
38
- /**
39
- * Best-effort logging of what a timed out CREATE_REPLICATION_SLOT was waiting
40
- * on: the walsender's wait event and blocking pids, and the oldest
41
- * transactions holding an xid. Slot creation waits for every such transaction
42
- * on the instance (in all databases), each with its own lock_timeout, so a
43
- * chain of overlapping transactions can exceed the client-side timeout
44
- * without the lock_timeout ever firing.
45
- *
46
- * Query text is deliberately omitted since it can contain row values.
47
- *
48
- * Exported for testing.
49
- */
50
- export declare function logSlotCreationBlockers(lc: LogContext, sql: PostgresDB, walsenderPID: number, slotName: string): Promise<void>;
51
- export type CreateReplicaAndSlotOptions = {
52
- lockTimeout?: number | undefined;
53
- maxBlockedMs?: number | undefined;
54
- retryDelayMs?: number | undefined;
55
- };
56
- /**
57
- * Replica and slot creation involves several sessions for proper
58
- * coordination with other replica management logic:
59
- *
60
- * * A dedicated session acquires a (session-level) advisory lock for
61
- * replica slot management. This is the same lock that cleanup logic
62
- * acquires before cleaning up replication slots. The lock is held
63
- * outside of a transaction so that the session is not "idle in
64
- * transaction" while slot creation waits on upstream transactions,
65
- * which some upstreams terminate (e.g. idle_in_transaction_session_timeout).
66
- * * With the lock held, a new replication slot is created in a
67
- * replication session. The API of CREATE_REPLICATION_SLOT is such
68
- * that it cannot be done in a transaction, and cannot be followed by
69
- * any writes, or else its snapshot (which is needed for initial sync)
70
- * would be invalidated.
71
- * * Once the slot is created, the slot and replica information are recorded
72
- * in the `replicas` table before releasing the lock.
73
- *
74
- * Slot creation waits for all transactions on the upstream instance that
75
- * hold an xid, so it can be blocked by long-running transactions. A blocked
76
- * attempt is abandoned (see {@link CREATE_REPLICATION_SLOT_TIMEOUT_MS}) and
77
- * retried in-process, as it leaves no durable state: the `replicas` row is
78
- * only inserted after the slot has been created. Retries continue until the
79
- * slot is created or until `maxBlockedMs` has elapsed, after which the error
80
- * is thrown.
81
- *
82
- * This locking ensures that:
83
- * 1. multiple replication managers attempting to create a replication slot
84
- * will not use the same name for the replication slot (which is selected
85
- * from a pool of reused names).
86
- * 2. Running replication managers (which use an earlier replica of a lower
87
- * rank) will not delete the new slot during their cleanup logic, since
88
- * the slot will belong to a replica of a higher rank.
89
- *
90
- * When the replication slot is created, `captureSnapshot` callback is first
91
- * run while the snapshot at the consistent point is available. The callback
92
- * must capture the snapshot in postgres (e.g. `SET TRANSACTION SNAPSHOT`)
93
- * in order to use it. Once the callback completes, a placeholder replication
94
- * session (i.e. that does not consume any messages) is started, in order to
95
- * reserve the slot by mark it "active", effectively distinguishing the
96
- * initializing session from a failed or abandoned session.
97
- *
98
- * Note that starting the replication session releases the initial snapshot,
99
- * which is why the callback must capture it synchronously, before the
100
- * replication session is started.
101
- *
102
- * The placeholder replication session is closed when the
103
- * PostgresChangeSource takes over the slot to process the stream in earnest.
104
- * It is also returned for cleanup in the case of failures (and for control
105
- * in unit tests).
106
- *
107
- * For replica's created in the `Restore` stage, the `generation` is
108
- * initialized to an empty string instead of the slot's consistent point,
109
- * since the slot is not being used for initial sync. It is the
110
- * responsibiliy of the caller to call {@link initRestoreReplica} when
111
- * the source replica has been selected for restoring, which will carry
112
- * over the `generation` and other relevant values from the source.
113
- */
114
- export declare function createReplicaAndSlot<T>(lc: LogContext, sql: PostgresDB, sessionName: string, shard: ShardID, epoch: number, replicaID: string, failover: boolean, backupOptions: BackupOptions, captureSnapshot: (snapshot: string) => Promise<T>, stage: ReplicaStage, { lockTimeout, maxBlockedMs, retryDelayMs, }?: CreateReplicaAndSlotOptions): Promise<ReplicationSlotResult<T>>;
115
- /**
116
- * Claims the inactive slot of the given replica for use by this task, opening
117
- * a replication session to mark it as active. The process should follow up by
118
- * taking over the slot via the PostgresChangeSource.
119
- *
120
- * The replica is identified by its ID (and not just its slot) because rows of
121
- * replicas whose slots were dropped outside of zero-cache's control may share
122
- * the slot name.
123
- */
124
- export declare function claimSlotForResumption(lc: LogContext, sql: PostgresDB, shard: ShardID, _sessionName: string, { id: replicaID, slot }: Pick<ReplicaState, 'id' | 'slot'>): Promise<ReservedSlot | null>;
125
- export declare function dropInactiveSlotsAndReplicas(lc: LogContext, sql: PostgresDB, shard: ShardID, slots: string[]): Promise<void>;
126
- export declare function slotPoolSuffix(n: number): string;
127
- //# sourceMappingURL=replication-slots.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replication-slots.d.ts","sourceRoot":"","sources":["../../../../../../../zero-cache/src/services/change-source/pg/replication-slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAM1C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,QAA2C,MAAM,UAAU,CAAC;AAMnE,OAAO,EAAkB,KAAK,UAAU,EAAC,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAiB,KAAK,OAAO,EAAC,MAAM,0BAA0B,CAAC;AAWtE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI;IACrC,IAAI,EAAE,eAAe,CAAC;IACtB,gBAAgB,EAAE,CAAC,CAAC;IACpB,cAAc,EAAE,QAAQ,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,QAAQ,CAAC;IACtB,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IAGjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAIjC,aAAa,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACxC,CAAC;AAUF,eAAO,MAAM,kCAAkC,QAAS,CAAC;AAOzD,0EAA0E;AAC1E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,8BAA8B;CAC5C;AAKD,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,UAAU,EACd,OAAO,EAAE,QAAQ,CAAC,GAAG,EACrB,EACE,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,WAAoC,EACpC,aAAa,GACd,EAAE,cAAc,GAChB,OAAO,CAAC,eAAe,CAAC,CAwD1B;AAKD;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,iBAmCjB;AA0BD,MAAM,MAAM,2BAA2B,GAAG;IAExC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAsBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,KAAK,EAAE,YAAY,EACnB,EACE,WAAW,EACX,YAAmD,EACnD,YAAmD,GACpD,GAAE,2BAAgC,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAiLnC;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,MAAM,EACpB,EAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAC,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,GACvD,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA0D9B;AAED,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EAAE,iBA+BhB;AAmFD,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,UAUvC"}
@@ -1,9 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { PostgresDB } from '../../../../types/pg.ts';
3
- import { type ShardConfig } from '../../../../types/shards.ts';
4
- /**
5
- * Ensures that a shard is set up for initial sync.
6
- */
7
- export declare function ensureShardSchema(lc: LogContext, db: PostgresDB, shard: ShardConfig, installPartialIndexTriggers?: boolean): Promise<void>;
8
- export declare const CURRENT_SCHEMA_VERSION: number;
9
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../../../zero-cache/src/services/change-source/pg/schema/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAQjD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAiB,KAAK,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAa7E;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,UAAU,EACd,EAAE,EAAE,UAAU,EACd,KAAK,EAAE,WAAW,EAClB,2BAA2B,UAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CAiBf;AA8SD,eAAO,MAAM,sBAAsB,QASwB,CAAC"}
@@ -1,68 +0,0 @@
1
- import type { BackfillProgressMark, BackfillRequest } from './current.ts';
2
- /**
3
- * The result of applying a backfill message to a column's tracked progress.
4
- * If `accept` is true, `progress` is the column's new progress.
5
- */
6
- export type AcceptResult = {
7
- accept: true;
8
- progress: BackfillProgressMark | undefined;
9
- } | {
10
- accept: false;
11
- };
12
- /**
13
- * Applies the continuity policy of `backfill` (and `backfill-completed`)
14
- * messages to a column's `own` tracked progress, where `undefined` means that
15
- * the column has not received any backfill data (i.e. it needs a backfill
16
- * from scratch).
17
- *
18
- * * Messages without `progressMarks` are from pre-v8 replication-managers
19
- * and are accepted unconditionally (i.e. the legacy behavior), with no
20
- * change to the tracked progress.
21
- * * A message without a `previous` mark starts a backfill from scratch (or on
22
- * a new timeline), and is always accepted.
23
- * * Otherwise, the message is only accepted if it is on the same timeline as
24
- * `own`, and continues from a position at or before `own` (i.e. it does not
25
- * create a gap).
26
- *
27
- * `current` is unset for `backfill-completed` messages, which do not advance
28
- * the progress.
29
- */
30
- export declare function acceptBackfill(own: BackfillProgressMark | undefined, marks: {
31
- previous?: BackfillProgressMark | undefined;
32
- current?: BackfillProgressMark;
33
- } | undefined): AcceptResult;
34
- /**
35
- * Returns whether a stream whose progress (for a column) is at `stream`
36
- * will deliver all of the data needed by a subscriber whose progress (for the
37
- * same column) is at `subscriber`. A `stream` progress of `undefined` indicates
38
- * a backfill that will start from scratch, which covers all subscribers.
39
- */
40
- export declare function covers(stream: BackfillProgressMark | undefined, subscriber: BackfillProgressMark | undefined): boolean;
41
- /**
42
- * Returns the position from which a backfill for the `req` must start
43
- * in order to satisfy the progress of all of its columns, i.e. the earliest
44
- * progress mark, or `undefined` (i.e. from scratch) if any column has no
45
- * progress or if the columns are on different timelines.
46
- */
47
- export declare function resumePoint(req: BackfillRequest): BackfillProgressMark | undefined;
48
- /**
49
- * Returns a copy of the `req` with the progress of every column set to
50
- * the request's {@link resumePoint}, i.e. the position from which the
51
- * backfill of the request will actually start.
52
- */
53
- export declare function withResumePoint(req: BackfillRequest): BackfillRequest;
54
- /**
55
- * Merges two BackfillRequests for the same table into one that satisfies
56
- * both. Both requests are expected to reflect the same (current) upstream
57
- * schema. For columns in both requests, the earlier progress mark is chosen,
58
- * or no progress mark (i.e. from scratch) if they are on different timelines.
59
- * If a column's backfill IDs differ (which is unexpected), the ID of `req1`
60
- * is chosen, and the column is backfilled from scratch.
61
- */
62
- export declare function getTableSuperset(req1: BackfillRequest, req2: BackfillRequest): BackfillRequest;
63
- /**
64
- * Merges the BackfillRequests of multiple parties (e.g. subscribers) into
65
- * one request per table, using {@link getTableSuperset}.
66
- */
67
- export declare function getSuperset(...requestSets: Iterable<BackfillRequest>[]): BackfillRequest[];
68
- //# sourceMappingURL=backfill-progress.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backfill-progress.d.ts","sourceRoot":"","sources":["../../../../../../../zero-cache/src/services/change-source/protocol/backfill-progress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAEhB,MAAM,cAAc,CAAC;AAyBtB;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB;IAAC,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,CAAA;CAAC,GAC1D;IAAC,MAAM,EAAE,KAAK,CAAA;CAAC,CAAC;AAEpB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,oBAAoB,GAAG,SAAS,EACrC,KAAK,EACD;IACE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC5C,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,GACD,SAAS,GACZ,YAAY,CAyBd;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,oBAAoB,GAAG,SAAS,EACxC,UAAU,EAAE,oBAAoB,GAAG,SAAS,GAC3C,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,eAAe,GACnB,oBAAoB,GAAG,SAAS,CAelC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAWrE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,eAAe,GACpB,eAAe,CA4BjB;AAMD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,WAAW,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,GAC1C,eAAe,EAAE,CAUnB"}
@@ -1,72 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { Subscription } from '../../types/subscription.ts';
3
- import type { ChangeStreamData } from '../change-source/protocol/current/downstream.ts';
4
- import type { BackfillRequest } from '../change-source/protocol/current/upstream.ts';
5
- import type { PreSerializedBatch } from './broadcast.ts';
6
- import type { SubscriberContext } from './change-streamer.ts';
7
- import type { Subscriber, SubscriberOptions } from './subscriber.ts';
8
- export type SubscriberBackfillOptions = Pick<SubscriberOptions, 'backfills' | 'onAligned' | 'onBackfillIgnored'>;
9
- /**
10
- * Tracks the pending backfills (and their progress) of the change log, the
11
- * subscribers, and the current change stream, in order to determine:
12
- *
13
- * * the BackfillRequests with which to start a change stream, i.e. the
14
- * superset of the pending backfills of the change log and all aligned
15
- * subscribers, starting from the earliest progress, and
16
- * * whether (and why) the change stream must be restarted, i.e. when a
17
- * newly aligned subscriber's pending backfills are not covered by the
18
- * current stream.
19
- *
20
- * The change-streamer calls {@link startStream()} whenever it starts a change
21
- * stream, {@link track()} for every change that it forwards, and restarts
22
- * the stream at the next transaction boundary whenever a
23
- * {@link restartReason} is set.
24
- */
25
- export declare class BackfillStateTracker {
26
- #private;
27
- constructor(lc: LogContext);
28
- /**
29
- * The reason for which the change stream must be restarted, or `null` if
30
- * it need not be. The restart should happen at the next transaction
31
- * boundary, i.e. upon the next `commit`, or `status` message outside of a
32
- * transaction.
33
- */
34
- get restartReason(): string | null;
35
- /**
36
- * Computes the BackfillRequests with which to start a new change stream:
37
- * the superset of the pending backfills of the change log and of all
38
- * aligned subscribers, all of which are consistent with the stream's
39
- * starting watermark since streams are (re)started at transaction
40
- * boundaries.
41
- *
42
- * @param logBackfillRequests The BackfillRequests from the change log's
43
- * cookie jar, consistent with the stream's starting watermark.
44
- */
45
- startStream(logBackfillRequests: BackfillRequest[]): BackfillRequest[];
46
- /**
47
- * Tracks a change that is forwarded to subscribers. This must be called
48
- * (synchronously) before the change is forwarded, so that the stream's
49
- * state is never ahead of that of aligned subscribers.
50
- */
51
- track(change: ChangeStreamData): void;
52
- /**
53
- * Requests a restart of the change stream (at the next transaction
54
- * boundary), e.g. to start it with BackfillRequests that it was not
55
- * started with.
56
- */
57
- requestRestart(reason: string): void;
58
- /** Logs and records a (planned) restart for the {@link restartReason}. */
59
- recordRestart(): void;
60
- /**
61
- * Returns the backfill-related {@link SubscriberOptions} for a new
62
- * subscriber, which must subsequently be passed to {@link register()}.
63
- */
64
- subscriberOptions(lc: LogContext, ctx: SubscriberContext): SubscriberBackfillOptions;
65
- /**
66
- * Registers a subscriber (created with {@link subscriberOptions()}) until
67
- * its `downstream` is closed. This is a no-op for subscribers that do not
68
- * report their pending backfills.
69
- */
70
- register(subscriber: Subscriber, downstream: Subscription<string | PreSerializedBatch>): void;
71
- }
72
- //# sourceMappingURL=backfill-state-tracker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backfill-state-tracker.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/backfill-state-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAK9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+CAA+C,CAAC;AAEnF,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAC,UAAU,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAEnE,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,iBAAiB,EACjB,WAAW,GAAG,WAAW,GAAG,mBAAmB,CAChD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,oBAAoB;;IA6C/B,YAAY,EAAE,EAAE,UAAU,EAEzB;IAED;;;;;OAKG;IACH,IAAI,aAAa,IAAI,MAAM,GAAG,IAAI,CAEjC;IAED;;;;;;;;;OASG;IACH,WAAW,CAAC,mBAAmB,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAyBrE;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,QAG7B;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,QAE5B;IAED,0EAA0E;IAC1E,aAAa,SAGZ;IAED;;;OAGG;IACH,iBAAiB,CACf,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,iBAAiB,GACrB,yBAAyB,CAqB3B;IAED;;;;OAIG;IACH,QAAQ,CACN,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,YAAY,CAAC,MAAM,GAAG,kBAAkB,CAAC,QAMtD;CAsBF"}
@@ -1,50 +0,0 @@
1
- import type { BackfillRequest, ChangeStreamData } from '../change-source/protocol/current.ts';
2
- import type { WatermarkedChange } from './change-streamer.ts';
3
- /**
4
- * Tracks the state of the pending backfills (and their progress) of a party
5
- * in the replication stream (e.g. a subscriber, or the change-log itself), by
6
- * applying the same policies that a subscriber applies to its replica:
7
- * schema changes are folded with the {@link cookieOps} shared by the
8
- * cookie jars, and `backfill` / `backfill-completed` messages are accepted
9
- * or ignored with the continuity policy of {@link acceptBackfill}.
10
- *
11
- * Changes are applied transactionally: the changes of a transaction are
12
- * discarded if it is rolled back, and {@link requests()} only reflects
13
- * committed transactions.
14
- */
15
- export declare class BackfillState {
16
- #private;
17
- constructor(requests?: readonly BackfillRequest[]);
18
- /** The (committed) pending backfills. */
19
- requests(): BackfillRequest[];
20
- /**
21
- * Returns the `requests` with the (committed) progress of this state
22
- * applied to the columns that are pending in both, i.e. same table, column,
23
- * and backfill ID. Other columns have no progress (i.e. from scratch).
24
- */
25
- withProgress(requests: readonly BackfillRequest[]): BackfillRequest[];
26
- /** Whether there are no (committed) pending backfills. */
27
- get empty(): boolean;
28
- /**
29
- * Returns the columns (as `schema.table.column` strings) with (committed)
30
- * pending backfills that are not covered by the (committed) progress of the
31
- * `stream`, i.e. columns for which the `stream` will not deliver all of the
32
- * necessary data.
33
- */
34
- uncovered(stream: BackfillState): string[];
35
- /**
36
- * Applies a serialized change, parsing it only if it is relevant.
37
- *
38
- * @returns The columns (as `schema.table.column` strings) of a backfill
39
- * message that were ignored due to the continuity policy.
40
- */
41
- applySerialized([, tag, json]: WatermarkedChange): string[];
42
- /**
43
- * Applies a change.
44
- *
45
- * @returns The columns (as `schema.table.column` strings) of a backfill
46
- * message that were ignored due to the continuity policy.
47
- */
48
- apply(change: ChangeStreamData): string[];
49
- }
50
- //# sourceMappingURL=backfill-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backfill-state.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/backfill-state.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAIjB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,KAAK,EAAY,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AA8CvE;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;;IAIxB,YAAY,QAAQ,GAAE,SAAS,eAAe,EAAO,EASpD;IAMD,yCAAyC;IACzC,QAAQ,IAAI,eAAe,EAAE,CAE5B;IAED;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAmBpE;IAED,0DAA0D;IAC1D,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAazC;IAED;;;;;OAKG;IACH,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAgB1D;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,CA4DxC;CA6HF"}
@@ -1,12 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { NormalizedZeroConfig } from '../../config/normalize.ts';
3
- import { BackupMonitor } from './backup-monitor.ts';
4
- import { type BackupStateVerifier } from './litestream3-prometheus-poller.ts';
5
- export type BackupCleanupMonitorFactoryOptions = {
6
- lc: LogContext;
7
- config: NormalizedZeroConfig;
8
- replicaFile: string;
9
- verifyBackupState?: BackupStateVerifier | undefined;
10
- };
11
- export declare function createBackupCleanupMonitor({ lc, config, replicaFile, verifyBackupState, }: BackupCleanupMonitorFactoryOptions): BackupMonitor;
12
- //# sourceMappingURL=backup-cleanup-monitor-factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backup-cleanup-monitor-factory.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAKpE,OAAO,EAAC,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAErE,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oCAAoC,CAAC;AAG5C,MAAM,MAAM,kCAAkC,GAAG;IAC/C,EAAE,EAAE,UAAU,CAAC;IACf,MAAM,EAAE,oBAAoB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,EACzC,EAAE,EACF,MAAM,EACN,WAAW,EACX,iBAAiB,GAClB,EAAE,kCAAkC,GAAG,aAAa,CAyBpD"}
@@ -1,57 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { Source } from '../../types/streams.ts';
3
- import type { SingletonService } from '../service.ts';
4
- export type BackedUpWatermark = {
5
- watermark: string;
6
- writeTimeMs?: number | undefined;
7
- backupTimeMs: number;
8
- };
9
- /**
10
- * Determines which watermarks of the replica are backed up, by whatever means
11
- * the backup (or its absence) allows.
12
- */
13
- export interface BackupPoller {
14
- /**
15
- * Starts polling, returning the stream of backed-up watermarks. Must only
16
- * be called once.
17
- */
18
- start(): Source<BackedUpWatermark>;
19
- /**
20
- * Requests that the replica be backed up through `watermark` promptly,
21
- * rather than at the poller's regular cadence, once the replica has reached
22
- * it. The resulting watermark is emitted on the stream as usual. Pollers
23
- * that cannot initiate backups do not implement this.
24
- */
25
- requestSync?(watermark: string): void;
26
- }
27
- /**
28
- * The interface through which the change-streamer consumes backed-up
29
- * watermarks and requests prompt backups (see {@link BackupMonitor}).
30
- */
31
- export type BackupSource = Pick<BackupMonitor, 'backups' | 'requestSync'>;
32
- /**
33
- * Relays the watermarks backed up by a {@link BackupPoller} to the
34
- * change-streamer, which consumes them (see {@link backups}) and requests
35
- * prompt backups (see {@link requestSync}) as needed.
36
- */
37
- export declare class BackupMonitor implements SingletonService {
38
- #private;
39
- readonly id = "backup-monitor";
40
- constructor(lc: LogContext, poller: BackupPoller, replicaFile: string);
41
- firstBackupReceived(): Promise<void>;
42
- /**
43
- * The stream of backed-up watermarks, each later than the last, coalesced
44
- * to the latest one that has not been consumed. It ends when the monitor
45
- * stops.
46
- */
47
- backups(): Source<BackedUpWatermark>;
48
- /**
49
- * Requests that the replica be backed up through `watermark` promptly, if
50
- * the poller supports it (see {@link BackupPoller.requestSync}). A no-op
51
- * unless the monitor is running.
52
- */
53
- requestSync(watermark: string): void;
54
- run(): Promise<void>;
55
- stop(): Promise<void>;
56
- }
57
- //# sourceMappingURL=backup-monitor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backup-monitor.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/backup-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAKjD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAEnD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,WAAW,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC;AAE1E;;;;GAIG;AACH,qBAAa,aAAc,YAAW,gBAAgB;;IACpD,QAAQ,CAAC,EAAE,oBAAoB;IAwB/B,YAAY,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAIpE;IAED,mBAAmB,kBAElB;IAED;;;;OAIG;IACH,OAAO,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAEnC;IAED;;;;OAIG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,QAY5B;IAEK,GAAG,kBAsCR;IAqDD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAKpB;CA+BF"}
@@ -1,98 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import { type PreSerialized } from '../../types/streams.ts';
3
- import type { WatermarkedChange } from './change-streamer.ts';
4
- import type { Subscriber } from './subscriber.ts';
5
- export type BroadcastReleaseMode = 'all-subscribers' | 'consensus-timeout';
6
- export type PreSerializedBatch = PreSerialized & {
7
- readonly changes: readonly WatermarkedChange[];
8
- };
9
- export declare function isPreSerializedBatch(val: unknown): val is PreSerializedBatch;
10
- export declare function preSerializeBatch(changes: readonly WatermarkedChange[]): PreSerializedBatch;
11
- /**
12
- * Enables event-driven early release of a {@link Broadcast}. When provided and a
13
- * majority has acked, the broadcast schedules its own consensus-timeout release
14
- * proportional to how long the majority took to ack, instead of relying on the
15
- * Forwarder's periodic progress tick.
16
- */
17
- export type EarlyReleaseOptions = {
18
- /** Time to wait, proportional to majority completion, before releasing. */
19
- consensusTimeoutProportion: number;
20
- /** Injectable timer, for deterministic testing. */
21
- setTimeoutFn?: typeof setTimeout;
22
- /** Injectable timer cancellation, for deterministic testing. */
23
- clearTimeoutFn?: typeof clearTimeout;
24
- };
25
- /**
26
- * Initiates and tracks the progress of a change broadcasted to
27
- * a set of subscribers, implementing **consensus-based timeouts**
28
- * to effect short-term graceful degradation when a minority of
29
- * subscribers are behind.
30
- *
31
- * ### Background
32
- *
33
- * The purpose of flow control is to pull upstream replication changes
34
- * no faster than the rate they are processed by downstream subscribers
35
- * in the steady state. In the change-streamer, this is done by occasionally
36
- * waiting for ACKs from subscribers before continuing; without doing so,
37
- * I/O buffers fill up and cause the system to spend most of its time in GC.
38
- *
39
- * However, the naive algorithm of always waiting for all subscribers (e.g.
40
- * `Promise.all()`) can behave poorly in scenarios where subscribers
41
- * are imbalanced:
42
- * * New subscribers may have a backlog of changes to catch up with.
43
- * Having all subscribers wait for the new subscriber to catch up results
44
- * in delaying the entire application.
45
- * * Broken TCP connections similarly require all subscribers to wait until
46
- * connection liveness checks kick in and disconnect the subscriber.
47
- *
48
- * A simplistic approach is to add a limit to the amount of time waiting for
49
- * subscribers, i.e. an ack timeout. However, deciding what this timeout
50
- * should be is non-trivial because of the heterogeneous nature of changes;
51
- * while most changes operate on single rows and are relatively predictable
52
- * in terms of running time, some changes are table-wide operations and can
53
- * legitimately take an arbitrary amount of time. In such scenarios, a
54
- * timeout that is too short can stop progress on replication altogether.
55
- *
56
- * ### Consensus-based Timeout Algorithm
57
- *
58
- * To address these shortcomings, a "consensus-based timeout" algorithm is
59
- * used:
60
- * * Wait for more than half of the subscribers to finish. (In
61
- * case of a single node, or the case of one replication-manager
62
- * and one view-syncer, this reduces to waiting for all subscribers.)
63
- * * Once more than half of the subscribers have finished, proceed after
64
- * the configured timeout, proportional to the time it took for the
65
- * majority of subscribers to ack, even if not all subscribers have
66
- * finished.
67
- *
68
- * In other words, the subscribers themselves are used to determine the
69
- * timeout of each batch of changes; the majority determines this when
70
- * they complete, upon which a timeout is logically started.
71
- *
72
- * In the common case, the remaining subscribers finish soon afterward and
73
- * the timeout never elapses. However, in pathological cases where a minority
74
- * of subscribers have a disproportionate amount of load, some will still
75
- * be processing (or otherwise unresponsive). These subscribers are given
76
- * a bounded amount of time to catch up at each flushed batch, up to the
77
- * timeout interval. This guarantees eventual catchup because the
78
- * subscribers with a backlog of changes necessarily have a higher
79
- * processing rate than the subscribers that finished (and are made to wait).
80
- */
81
- export declare class Broadcast {
82
- #private;
83
- /**
84
- * Sends the change to the subscribers without the tracking machinery.
85
- * This is suitable for fire-and-forget (i.e. pipelined) sends.
86
- */
87
- static withoutTracking(subscribers: Iterable<Subscriber>, change: WatermarkedChange | readonly WatermarkedChange[]): void;
88
- /**
89
- * Broadcasts the `change` to the `subscribers` and tracks their
90
- * completion.
91
- */
92
- constructor(lc: LogContext, subscribers: Iterable<Subscriber>, change: WatermarkedChange | readonly WatermarkedChange[], earlyRelease?: EarlyReleaseOptions);
93
- get isDone(): boolean;
94
- get done(): Promise<void>;
95
- get releaseMode(): BroadcastReleaseMode;
96
- logSlowRequests(now: number): void;
97
- }
98
- //# sourceMappingURL=broadcast.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAkB,KAAK,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAChD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,kBAAkB,CAE5E;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,iBAAiB,EAAE,GACpC,kBAAkB,CAYpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,2EAA2E;IAC3E,0BAA0B,EAAE,MAAM,CAAC;IACnC,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,UAAU,CAAC;IACjC,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,YAAY,CAAC;CACtC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBAAa,SAAS;;IACpB;;;OAGG;IACH,MAAM,CAAC,eAAe,CACpB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,EACjC,MAAM,EAAE,iBAAiB,GAAG,SAAS,iBAAiB,EAAE,QAOzD;IA0BD;;;OAGG;IACH,YACE,EAAE,EAAE,UAAU,EACd,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,EACjC,MAAM,EAAE,iBAAiB,GAAG,SAAS,iBAAiB,EAAE,EACxD,YAAY,CAAC,EAAE,mBAAmB,EA+BnC;IAwDD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAExB;IAED,IAAI,WAAW,IAAI,oBAAoB,CAEtC;IAED,eAAe,CAAC,GAAG,EAAE,MAAM,QAa1B;CAiBF"}
@@ -1,34 +0,0 @@
1
- import type { ChangeStreamData } from '../change-source/protocol/current/downstream.ts';
2
- import type { ChangeTag, WatermarkedChange } from './change-streamer.ts';
3
- export type ChangeLogEntry = {
4
- watermark: string;
5
- tag: string;
6
- change: string;
7
- };
8
- export type SerializedChangeStreamData = {
9
- /** The canonical downstream representation forwarded to subscribers. */
10
- readonly json: string;
11
- /** The already-serialized change tuple element stored in change logs. */
12
- readonly change: string;
13
- };
14
- /**
15
- * Serializes a data-plane message and its stored change payload in one pass.
16
- *
17
- * Change logs retain only the second tuple element for backwards
18
- * compatibility. Serializing that element first avoids stringifying the full
19
- * message and then copying the payload back out of the resulting string on the
20
- * replication hot path.
21
- */
22
- export declare function serializeChangeStreamDataWithChange(data: ChangeStreamData): SerializedChangeStreamData;
23
- /** Serializes a data-plane message to the canonical downstream JSON form. */
24
- export declare function serializeChangeStreamData(data: ChangeStreamData): string;
25
- /**
26
- * Extracts the second tuple element for callers that only have the canonical
27
- * downstream JSON. The live write path uses
28
- * {@link serializeChangeStreamDataWithChange} and does not scan or copy the
29
- * completed message.
30
- */
31
- export declare function extractChangeSubstring(streamMessageJSON: string, tag: ChangeTag | undefined): string;
32
- /** Reconstructs the canonical downstream JSON around a stored change. */
33
- export declare function reconstructWatermarkedChange(watermark: string, entryTag: string, change: string): WatermarkedChange;
34
- //# sourceMappingURL=change-log-codec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change-log-codec.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/change-log-codec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAC,SAAS,EAAE,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEvE,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,gBAAgB,GACrB,0BAA0B,CAc5B;AAED,6EAA6E;AAC7E,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,SAAS,GAAG,SAAS,GACzB,MAAM,CAkBR;AAED,yEAAyE;AACzE,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,iBAAiB,CAoBnB"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Pure building blocks for comparing catchup output between the Postgres and
3
- * SQLite change logs: how to reduce a catchup range to a single comparable
4
- * digest. Which transactions to sample is `isSampledForShard`, in
5
- * `shard-sampling.ts`.
6
- *
7
- * Nothing here touches either store. The comparator service supplies the
8
- * batches.
9
- */
10
- import type { WatermarkedChange } from './change-streamer.ts';
11
- export type CatchupRangeDigest = {
12
- readonly digest: string;
13
- readonly rows: number;
14
- /** Change text hashed. This is the payload cost of the range. */
15
- readonly bytes: number;
16
- /** A row or byte limit was reached before the closing commit. */
17
- readonly limitReached: boolean;
18
- };
19
- /**
20
- * Builds one ordered digest for a catchup range.
21
- *
22
- * The row position makes missing, extra, changed, and reordered rows change the digest.
23
- * The digest omits `precommit` because a commit already includes its watermark.
24
- *
25
- * The change text is hashed as stored. Both logs write the same
26
- * `extractChangeSubstring` output, and the Postgres column is `json`, which
27
- * keeps the input text exactly, so the two sides are byte-comparable without
28
- * reparsing. Comparing the stored text also catches an encoding difference
29
- * that a semantic comparison would hide.
30
- *
31
- * The read stops at `maxRows` or at `maxBytes`, whichever comes first.
32
- */
33
- export declare function digestCatchupRange(batches: AsyncIterable<readonly WatermarkedChange[]>, throughWatermark: string, maxRows: number, maxBytes: number): Promise<CatchupRangeDigest>;
34
- //# sourceMappingURL=change-log-compare-digest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change-log-compare-digest.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/change-streamer/change-log-compare-digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,aAAa,CAAC,SAAS,iBAAiB,EAAE,CAAC,EACpD,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAsC7B"}