@rocicorp/zero 1.12.0-canary.5 → 1.12.0-canary.7

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 (414) hide show
  1. package/out/replicache/src/btree/node.js +1 -1
  2. package/out/replicache/src/deleted-clients.d.ts.map +1 -1
  3. package/out/replicache/src/deleted-clients.js +2 -1
  4. package/out/replicache/src/deleted-clients.js.map +1 -1
  5. package/out/replicache/src/kv/sqlite-store.d.ts.map +1 -1
  6. package/out/replicache/src/kv/sqlite-store.js +7 -3
  7. package/out/replicache/src/kv/sqlite-store.js.map +1 -1
  8. package/out/replicache/src/replicache-impl.d.ts.map +1 -1
  9. package/out/replicache/src/replicache-impl.js +17 -14
  10. package/out/replicache/src/replicache-impl.js.map +1 -1
  11. package/out/z2s/src/compiler.js +3 -3
  12. package/out/z2s/src/compiler.js.map +1 -1
  13. package/out/zero/package.js +11 -11
  14. package/out/zero/package.js.map +1 -1
  15. package/out/zero-cache/src/auth/write-authorizer.js +9 -2
  16. package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
  17. package/out/zero-cache/src/config/zero-config.js +2 -2
  18. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  19. package/out/zero-cache/src/server/change-streamer.js +33 -9
  20. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  21. package/out/zero-cache/src/services/change-source/common/replica-restore.js.map +1 -1
  22. package/out/zero-cache/src/services/change-source/pg/change-source-init.js +49 -24
  23. package/out/zero-cache/src/services/change-source/pg/change-source-init.js.map +1 -1
  24. package/out/zero-cache/src/services/change-source/pg/change-source.js +64 -7
  25. package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
  26. package/out/zero-cache/src/services/change-source/pg/fork-request.js +54 -0
  27. package/out/zero-cache/src/services/change-source/pg/fork-request.js.map +1 -0
  28. package/out/zero-cache/src/services/change-source/pg/replication-slots.js +6 -0
  29. package/out/zero-cache/src/services/change-source/pg/replication-slots.js.map +1 -1
  30. package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts +1 -0
  31. package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts.map +1 -1
  32. package/out/zero-cache/src/services/change-source/protocol/current/status.d.ts +3 -0
  33. package/out/zero-cache/src/services/change-source/protocol/current/status.d.ts.map +1 -1
  34. package/out/zero-cache/src/services/change-source/protocol/current/status.js +2 -1
  35. package/out/zero-cache/src/services/change-source/protocol/current/status.js.map +1 -1
  36. package/out/zero-cache/src/services/change-source/protocol/current/upstream.d.ts +1 -0
  37. package/out/zero-cache/src/services/change-source/protocol/current/upstream.d.ts.map +1 -1
  38. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.js +6 -6
  39. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.js.map +1 -1
  40. package/out/zero-cache/src/services/change-streamer/backup-monitor.js +55 -20
  41. package/out/zero-cache/src/services/change-streamer/backup-monitor.js.map +1 -1
  42. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js +27 -8
  43. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js.map +1 -1
  44. package/out/zero-cache/src/services/change-streamer/change-streamer.js.map +1 -1
  45. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.js +80 -11
  46. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.js.map +1 -1
  47. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.js.map +1 -1
  48. package/out/zero-cache/src/services/change-streamer/replica-poller.js.map +1 -1
  49. package/out/zero-cache/src/services/change-streamer/server-start-metrics.js +42 -0
  50. package/out/zero-cache/src/services/change-streamer/server-start-metrics.js.map +1 -0
  51. package/out/zero-cache/src/services/change-streamer/subscriber.js +5 -4
  52. package/out/zero-cache/src/services/change-streamer/subscriber.js.map +1 -1
  53. package/out/zero-cache/src/services/mutagen/mutagen.js +1 -2
  54. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  55. package/out/zero-cache/src/services/view-syncer/view-syncer.js +19 -2
  56. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  57. package/out/zero-client/src/client/version.js +1 -1
  58. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  59. package/out/zero-protocol/src/ast.js +2 -1
  60. package/out/zero-protocol/src/ast.js.map +1 -1
  61. package/out/zero-protocol/src/down.d.ts +27 -27
  62. package/out/zero-protocol/src/inspect-down.d.ts +81 -81
  63. package/out/zero-protocol/src/up.d.ts +60 -60
  64. package/package.json +11 -11
  65. package/out/shared/src/cache.d.ts +0 -22
  66. package/out/shared/src/cache.d.ts.map +0 -1
  67. package/out/shared/src/custom-key-map.d.ts +0 -26
  68. package/out/shared/src/custom-key-map.d.ts.map +0 -1
  69. package/out/shared/src/custom-key-set.d.ts +0 -25
  70. package/out/shared/src/custom-key-set.d.ts.map +0 -1
  71. package/out/shared/src/logging-test-utils.d.ts +0 -12
  72. package/out/shared/src/logging-test-utils.d.ts.map +0 -1
  73. package/out/shared/src/queue.d.ts +0 -53
  74. package/out/shared/src/queue.d.ts.map +0 -1
  75. package/out/shared/src/ring-buffer.d.ts +0 -42
  76. package/out/shared/src/ring-buffer.d.ts.map +0 -1
  77. package/out/shared/src/sorted-entries.d.ts +0 -2
  78. package/out/shared/src/sorted-entries.d.ts.map +0 -1
  79. package/out/zero/src/server/change-streamer.d.ts +0 -2
  80. package/out/zero/src/server/change-streamer.d.ts.map +0 -1
  81. package/out/zero/src/server/main.d.ts +0 -2
  82. package/out/zero/src/server/main.d.ts.map +0 -1
  83. package/out/zero/src/server/reaper.d.ts +0 -2
  84. package/out/zero/src/server/reaper.d.ts.map +0 -1
  85. package/out/zero/src/server/replicator.d.ts +0 -2
  86. package/out/zero/src/server/replicator.d.ts.map +0 -1
  87. package/out/zero/src/server/syncer.d.ts +0 -2
  88. package/out/zero/src/server/syncer.d.ts.map +0 -1
  89. package/out/zero-cache/src/auth/jwt.d.ts +0 -12
  90. package/out/zero-cache/src/auth/jwt.d.ts.map +0 -1
  91. package/out/zero-cache/src/auth/load-permissions.d.ts +0 -17
  92. package/out/zero-cache/src/auth/load-permissions.d.ts.map +0 -1
  93. package/out/zero-cache/src/auth/write-authorizer.d.ts +0 -28
  94. package/out/zero-cache/src/auth/write-authorizer.d.ts.map +0 -1
  95. package/out/zero-cache/src/config/server-context.d.ts +0 -16
  96. package/out/zero-cache/src/config/server-context.d.ts.map +0 -1
  97. package/out/zero-cache/src/custom/fetch.d.ts +0 -38
  98. package/out/zero-cache/src/custom/fetch.d.ts.map +0 -1
  99. package/out/zero-cache/src/custom/metrics.d.ts +0 -31
  100. package/out/zero-cache/src/custom/metrics.d.ts.map +0 -1
  101. package/out/zero-cache/src/custom-queries/transform-query.d.ts +0 -68
  102. package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +0 -1
  103. package/out/zero-cache/src/db/create.d.ts +0 -12
  104. package/out/zero-cache/src/db/create.d.ts.map +0 -1
  105. package/out/zero-cache/src/db/delete-lite-db.d.ts +0 -2
  106. package/out/zero-cache/src/db/delete-lite-db.d.ts.map +0 -1
  107. package/out/zero-cache/src/db/index-predicate.d.ts +0 -4
  108. package/out/zero-cache/src/db/index-predicate.d.ts.map +0 -1
  109. package/out/zero-cache/src/db/migration-lite.d.ts +0 -78
  110. package/out/zero-cache/src/db/migration-lite.d.ts.map +0 -1
  111. package/out/zero-cache/src/db/migration.d.ts +0 -80
  112. package/out/zero-cache/src/db/migration.d.ts.map +0 -1
  113. package/out/zero-cache/src/db/pg-copy-binary.d.ts +0 -101
  114. package/out/zero-cache/src/db/pg-copy-binary.d.ts.map +0 -1
  115. package/out/zero-cache/src/db/pg-copy.d.ts +0 -30
  116. package/out/zero-cache/src/db/pg-copy.d.ts.map +0 -1
  117. package/out/zero-cache/src/db/pg-type-parser.d.ts +0 -15
  118. package/out/zero-cache/src/db/pg-type-parser.d.ts.map +0 -1
  119. package/out/zero-cache/src/db/transaction-pool.d.ts +0 -205
  120. package/out/zero-cache/src/db/transaction-pool.d.ts.map +0 -1
  121. package/out/zero-cache/src/db/warmup.d.ts +0 -4
  122. package/out/zero-cache/src/db/warmup.d.ts.map +0 -1
  123. package/out/zero-cache/src/observability/events.d.ts +0 -15
  124. package/out/zero-cache/src/observability/events.d.ts.map +0 -1
  125. package/out/zero-cache/src/observability/log-throttle.d.ts +0 -44
  126. package/out/zero-cache/src/observability/log-throttle.d.ts.map +0 -1
  127. package/out/zero-cache/src/server/anonymous-otel-start.d.ts +0 -21
  128. package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +0 -1
  129. package/out/zero-cache/src/server/change-streamer.d.ts +0 -3
  130. package/out/zero-cache/src/server/change-streamer.d.ts.map +0 -1
  131. package/out/zero-cache/src/server/inspector-delegate.d.ts +0 -71
  132. package/out/zero-cache/src/server/inspector-delegate.d.ts.map +0 -1
  133. package/out/zero-cache/src/server/main.d.ts +0 -3
  134. package/out/zero-cache/src/server/main.d.ts.map +0 -1
  135. package/out/zero-cache/src/server/otel-diag-logger.d.ts +0 -16
  136. package/out/zero-cache/src/server/otel-diag-logger.d.ts.map +0 -1
  137. package/out/zero-cache/src/server/otel-start.d.ts +0 -3
  138. package/out/zero-cache/src/server/otel-start.d.ts.map +0 -1
  139. package/out/zero-cache/src/server/priority-op.d.ts +0 -8
  140. package/out/zero-cache/src/server/priority-op.d.ts.map +0 -1
  141. package/out/zero-cache/src/server/reaper.d.ts +0 -3
  142. package/out/zero-cache/src/server/reaper.d.ts.map +0 -1
  143. package/out/zero-cache/src/server/replicator.d.ts +0 -10
  144. package/out/zero-cache/src/server/replicator.d.ts.map +0 -1
  145. package/out/zero-cache/src/server/slot-keeper.d.ts +0 -26
  146. package/out/zero-cache/src/server/slot-keeper.d.ts.map +0 -1
  147. package/out/zero-cache/src/server/syncer-assigner.d.ts +0 -14
  148. package/out/zero-cache/src/server/syncer-assigner.d.ts.map +0 -1
  149. package/out/zero-cache/src/server/syncer.d.ts +0 -3
  150. package/out/zero-cache/src/server/syncer.d.ts.map +0 -1
  151. package/out/zero-cache/src/server/worker-dispatcher.d.ts +0 -17
  152. package/out/zero-cache/src/server/worker-dispatcher.d.ts.map +0 -1
  153. package/out/zero-cache/src/services/analyze.d.ts +0 -9
  154. package/out/zero-cache/src/services/analyze.d.ts.map +0 -1
  155. package/out/zero-cache/src/services/change-source/change-source.d.ts +0 -32
  156. package/out/zero-cache/src/services/change-source/change-source.d.ts.map +0 -1
  157. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts +0 -57
  158. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts.map +0 -1
  159. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts +0 -55
  160. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts.map +0 -1
  161. package/out/zero-cache/src/services/change-source/common/init-cleanup.d.ts +0 -24
  162. package/out/zero-cache/src/services/change-source/common/init-cleanup.d.ts.map +0 -1
  163. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts +0 -115
  164. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts.map +0 -1
  165. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts +0 -14
  166. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts.map +0 -1
  167. package/out/zero-cache/src/services/change-source/custom/change-source.d.ts +0 -25
  168. package/out/zero-cache/src/services/change-source/custom/change-source.d.ts.map +0 -1
  169. package/out/zero-cache/src/services/change-source/pg/backfill-metadata.d.ts +0 -14
  170. package/out/zero-cache/src/services/change-source/pg/backfill-metadata.d.ts.map +0 -1
  171. package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts +0 -36
  172. package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts.map +0 -1
  173. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts +0 -65
  174. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts.map +0 -1
  175. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts +0 -115
  176. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +0 -1
  177. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +0 -155
  178. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +0 -1
  179. package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts +0 -17
  180. package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts.map +0 -1
  181. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.d.ts +0 -28
  182. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.d.ts.map +0 -1
  183. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput.types.d.ts +0 -76
  184. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput.types.d.ts.map +0 -1
  185. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts +0 -169
  186. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +0 -1
  187. package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.d.ts +0 -16
  188. package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.d.ts.map +0 -1
  189. package/out/zero-cache/src/services/change-source/pg/replication-slot-health.d.ts +0 -15
  190. package/out/zero-cache/src/services/change-source/pg/replication-slot-health.d.ts.map +0 -1
  191. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts +0 -127
  192. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts.map +0 -1
  193. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts +0 -9
  194. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts.map +0 -1
  195. package/out/zero-cache/src/services/change-source/protocol/backfill-progress.d.ts +0 -68
  196. package/out/zero-cache/src/services/change-source/protocol/backfill-progress.d.ts.map +0 -1
  197. package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.d.ts +0 -72
  198. package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.d.ts.map +0 -1
  199. package/out/zero-cache/src/services/change-streamer/backfill-state.d.ts +0 -50
  200. package/out/zero-cache/src/services/change-streamer/backfill-state.d.ts.map +0 -1
  201. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts +0 -14
  202. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts.map +0 -1
  203. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts +0 -18
  204. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts.map +0 -1
  205. package/out/zero-cache/src/services/change-streamer/broadcast.d.ts +0 -98
  206. package/out/zero-cache/src/services/change-streamer/broadcast.d.ts.map +0 -1
  207. package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts +0 -34
  208. package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts.map +0 -1
  209. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts +0 -34
  210. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts.map +0 -1
  211. package/out/zero-cache/src/services/change-streamer/change-log-initializer.d.ts +0 -158
  212. package/out/zero-cache/src/services/change-streamer/change-log-initializer.d.ts.map +0 -1
  213. package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.d.ts +0 -19
  214. package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.d.ts.map +0 -1
  215. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +0 -78
  216. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +0 -1
  217. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +0 -143
  218. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +0 -1
  219. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +0 -586
  220. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.map +0 -1
  221. package/out/zero-cache/src/services/change-streamer/drain-tracker.d.ts +0 -24
  222. package/out/zero-cache/src/services/change-streamer/drain-tracker.d.ts.map +0 -1
  223. package/out/zero-cache/src/services/change-streamer/error-type-enum.d.ts +0 -15
  224. package/out/zero-cache/src/services/change-streamer/error-type-enum.d.ts.map +0 -1
  225. package/out/zero-cache/src/services/change-streamer/forwarder.d.ts +0 -49
  226. package/out/zero-cache/src/services/change-streamer/forwarder.d.ts.map +0 -1
  227. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.d.ts +0 -53
  228. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.d.ts.map +0 -1
  229. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.d.ts +0 -88
  230. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.d.ts.map +0 -1
  231. package/out/zero-cache/src/services/change-streamer/replica-poller.d.ts +0 -15
  232. package/out/zero-cache/src/services/change-streamer/replica-poller.d.ts.map +0 -1
  233. package/out/zero-cache/src/services/change-streamer/restore-admission.d.ts +0 -243
  234. package/out/zero-cache/src/services/change-streamer/restore-admission.d.ts.map +0 -1
  235. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts +0 -6
  236. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts.map +0 -1
  237. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts +0 -152
  238. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts.map +0 -1
  239. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts +0 -11
  240. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts.map +0 -1
  241. package/out/zero-cache/src/services/change-streamer/snapshot-message.d.ts +0 -92
  242. package/out/zero-cache/src/services/change-streamer/snapshot-message.d.ts.map +0 -1
  243. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts +0 -36
  244. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts.map +0 -1
  245. package/out/zero-cache/src/services/change-streamer/snapshot.d.ts +0 -22
  246. package/out/zero-cache/src/services/change-streamer/snapshot.d.ts.map +0 -1
  247. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts +0 -99
  248. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts.map +0 -1
  249. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts +0 -83
  250. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts.map +0 -1
  251. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.d.ts +0 -121
  252. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.d.ts.map +0 -1
  253. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts +0 -73
  254. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts.map +0 -1
  255. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts +0 -62
  256. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts.map +0 -1
  257. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.d.ts +0 -114
  258. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.d.ts.map +0 -1
  259. package/out/zero-cache/src/services/change-streamer/storer.d.ts +0 -276
  260. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +0 -1
  261. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts +0 -485
  262. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts.map +0 -1
  263. package/out/zero-cache/src/services/change-streamer/subscriber.d.ts +0 -194
  264. package/out/zero-cache/src/services/change-streamer/subscriber.d.ts.map +0 -1
  265. package/out/zero-cache/src/services/change-streamer/upstream-acker.d.ts +0 -52
  266. package/out/zero-cache/src/services/change-streamer/upstream-acker.d.ts.map +0 -1
  267. package/out/zero-cache/src/services/limiter/sliding-window-limiter.d.ts +0 -57
  268. package/out/zero-cache/src/services/limiter/sliding-window-limiter.d.ts.map +0 -1
  269. package/out/zero-cache/src/services/litestream/commands.d.ts +0 -77
  270. package/out/zero-cache/src/services/litestream/commands.d.ts.map +0 -1
  271. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts +0 -78
  272. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts.map +0 -1
  273. package/out/zero-cache/src/services/litestream/metrics.d.ts +0 -31
  274. package/out/zero-cache/src/services/litestream/metrics.d.ts.map +0 -1
  275. package/out/zero-cache/src/services/litestream/restore-progress.d.ts +0 -24
  276. package/out/zero-cache/src/services/litestream/restore-progress.d.ts.map +0 -1
  277. package/out/zero-cache/src/services/mutagen/mutagen.d.ts +0 -40
  278. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +0 -1
  279. package/out/zero-cache/src/services/mutagen/pusher.d.ts +0 -63
  280. package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +0 -1
  281. package/out/zero-cache/src/services/replicator/change-log-db.d.ts +0 -368
  282. package/out/zero-cache/src/services/replicator/change-log-db.d.ts.map +0 -1
  283. package/out/zero-cache/src/services/replicator/change-log-stream-writer.d.ts +0 -56
  284. package/out/zero-cache/src/services/replicator/change-log-stream-writer.d.ts.map +0 -1
  285. package/out/zero-cache/src/services/replicator/change-processor.d.ts +0 -37
  286. package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +0 -1
  287. package/out/zero-cache/src/services/replicator/drain-handler.d.ts +0 -82
  288. package/out/zero-cache/src/services/replicator/drain-handler.d.ts.map +0 -1
  289. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts +0 -25
  290. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +0 -1
  291. package/out/zero-cache/src/services/replicator/notifier.d.ts +0 -9
  292. package/out/zero-cache/src/services/replicator/notifier.d.ts.map +0 -1
  293. package/out/zero-cache/src/services/replicator/replication-status.d.ts +0 -71
  294. package/out/zero-cache/src/services/replicator/replication-status.d.ts.map +0 -1
  295. package/out/zero-cache/src/services/replicator/replicator.d.ts +0 -86
  296. package/out/zero-cache/src/services/replicator/replicator.d.ts.map +0 -1
  297. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts +0 -55
  298. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts.map +0 -1
  299. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts +0 -132
  300. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts.map +0 -1
  301. package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.d.ts +0 -120
  302. package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.d.ts.map +0 -1
  303. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts +0 -111
  304. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts.map +0 -1
  305. package/out/zero-cache/src/services/run-ast.d.ts +0 -39
  306. package/out/zero-cache/src/services/run-ast.d.ts.map +0 -1
  307. package/out/zero-cache/src/services/runner.d.ts +0 -19
  308. package/out/zero-cache/src/services/runner.d.ts.map +0 -1
  309. package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts +0 -17
  310. package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts.map +0 -1
  311. package/out/zero-cache/src/services/view-syncer/advancement-metrics.d.ts +0 -26
  312. package/out/zero-cache/src/services/view-syncer/advancement-metrics.d.ts.map +0 -1
  313. package/out/zero-cache/src/services/view-syncer/batch-pacer.d.ts +0 -79
  314. package/out/zero-cache/src/services/view-syncer/batch-pacer.d.ts.map +0 -1
  315. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts +0 -97
  316. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +0 -1
  317. package/out/zero-cache/src/services/view-syncer/client-schema.d.ts +0 -18
  318. package/out/zero-cache/src/services/view-syncer/client-schema.d.ts.map +0 -1
  319. package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts +0 -184
  320. package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts.map +0 -1
  321. package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts +0 -22
  322. package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts.map +0 -1
  323. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +0 -128
  324. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +0 -1
  325. package/out/zero-cache/src/services/view-syncer/cvr.d.ts +0 -294
  326. package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +0 -1
  327. package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.d.ts +0 -81
  328. package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.d.ts.map +0 -1
  329. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts +0 -45
  330. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts.map +0 -1
  331. package/out/zero-cache/src/services/view-syncer/e2e-serving-lag.d.ts +0 -53
  332. package/out/zero-cache/src/services/view-syncer/e2e-serving-lag.d.ts.map +0 -1
  333. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts +0 -33
  334. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts.map +0 -1
  335. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts +0 -51
  336. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts.map +0 -1
  337. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts +0 -34
  338. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts.map +0 -1
  339. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +0 -296
  340. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +0 -1
  341. package/out/zero-cache/src/services/view-syncer/plan-warnings.d.ts +0 -7
  342. package/out/zero-cache/src/services/view-syncer/plan-warnings.d.ts.map +0 -1
  343. package/out/zero-cache/src/services/view-syncer/push-cost.d.ts +0 -132
  344. package/out/zero-cache/src/services/view-syncer/push-cost.d.ts.map +0 -1
  345. package/out/zero-cache/src/services/view-syncer/push-cutoff.d.ts +0 -55
  346. package/out/zero-cache/src/services/view-syncer/push-cutoff.d.ts.map +0 -1
  347. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts +0 -28
  348. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts.map +0 -1
  349. package/out/zero-cache/src/services/view-syncer/query-shape.d.ts +0 -25
  350. package/out/zero-cache/src/services/view-syncer/query-shape.d.ts.map +0 -1
  351. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts +0 -89
  352. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts.map +0 -1
  353. package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts +0 -90
  354. package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts.map +0 -1
  355. package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts +0 -17
  356. package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts.map +0 -1
  357. package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts +0 -86
  358. package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts.map +0 -1
  359. package/out/zero-cache/src/services/view-syncer/schema/init.d.ts +0 -5
  360. package/out/zero-cache/src/services/view-syncer/schema/init.d.ts.map +0 -1
  361. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +0 -563
  362. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +0 -1
  363. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts +0 -95
  364. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts.map +0 -1
  365. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +0 -420
  366. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +0 -1
  367. package/out/zero-cache/src/services/view-syncer/tracer.d.ts +0 -2
  368. package/out/zero-cache/src/services/view-syncer/tracer.d.ts.map +0 -1
  369. package/out/zero-cache/src/services/view-syncer/ttl-clock.d.ts +0 -10
  370. package/out/zero-cache/src/services/view-syncer/ttl-clock.d.ts.map +0 -1
  371. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +0 -133
  372. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +0 -1
  373. package/out/zero-cache/src/types/downstream.d.ts +0 -11
  374. package/out/zero-cache/src/types/downstream.d.ts.map +0 -1
  375. package/out/zero-cache/src/types/error-with-level.d.ts +0 -9
  376. package/out/zero-cache/src/types/error-with-level.d.ts.map +0 -1
  377. package/out/zero-cache/src/types/pg-patch.d.ts +0 -21
  378. package/out/zero-cache/src/types/pg-patch.d.ts.map +0 -1
  379. package/out/zero-cache/src/types/pg-versions.d.ts +0 -3
  380. package/out/zero-cache/src/types/pg-versions.d.ts.map +0 -1
  381. package/out/zero-cache/src/types/poke-chunk.d.ts +0 -18
  382. package/out/zero-cache/src/types/poke-chunk.d.ts.map +0 -1
  383. package/out/zero-cache/src/types/streams.d.ts +0 -115
  384. package/out/zero-cache/src/types/streams.d.ts.map +0 -1
  385. package/out/zero-cache/src/types/subscription.d.ts +0 -197
  386. package/out/zero-cache/src/types/subscription.d.ts.map +0 -1
  387. package/out/zero-cache/src/workers/connect-params.d.ts +0 -28
  388. package/out/zero-cache/src/workers/connect-params.d.ts.map +0 -1
  389. package/out/zero-cache/src/workers/connection.d.ts +0 -77
  390. package/out/zero-cache/src/workers/connection.d.ts.map +0 -1
  391. package/out/zero-cache/src/workers/replicator.d.ts +0 -57
  392. package/out/zero-cache/src/workers/replicator.d.ts.map +0 -1
  393. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts +0 -14
  394. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +0 -1
  395. package/out/zero-cache/src/workers/syncer.d.ts +0 -67
  396. package/out/zero-cache/src/workers/syncer.d.ts.map +0 -1
  397. package/out/zero-events/src/index.d.ts +0 -27
  398. package/out/zero-events/src/index.d.ts.map +0 -1
  399. package/out/zero-events/src/json.d.ts +0 -20
  400. package/out/zero-events/src/json.d.ts.map +0 -1
  401. package/out/zero-events/src/status.d.ts +0 -144
  402. package/out/zero-events/src/status.d.ts.map +0 -1
  403. package/out/zqlite/src/database-storage.d.ts +0 -43
  404. package/out/zqlite/src/database-storage.d.ts.map +0 -1
  405. package/out/zqlite/src/explain-queries.d.ts +0 -4
  406. package/out/zqlite/src/explain-queries.d.ts.map +0 -1
  407. package/out/zqlite/src/internal/sql-inline.d.ts +0 -13
  408. package/out/zqlite/src/internal/sql-inline.d.ts.map +0 -1
  409. package/out/zqlite/src/resolve-scalar-subqueries.d.ts +0 -72
  410. package/out/zqlite/src/resolve-scalar-subqueries.d.ts.map +0 -1
  411. package/out/zqlite/src/sqlite-cost-model.d.ts +0 -17
  412. package/out/zqlite/src/sqlite-cost-model.d.ts.map +0 -1
  413. package/out/zqlite/src/sqlite-stat-fanout.d.ts +0 -121
  414. package/out/zqlite/src/sqlite-stat-fanout.d.ts.map +0 -1
@@ -1,33 +0,0 @@
1
- export type MonotonicClock = () => number;
2
- /**
3
- * A soft wall-clock budget for one view-syncer hydration pass.
4
- *
5
- * Callers check the budget only at query boundaries. Consequently, a query
6
- * that starts before the limit is reached is always allowed to finish.
7
- *
8
- * The budget measures hydration work. Intervals that are not hydration --
9
- * notably the remote custom-query transform round trips -- are discounted via
10
- * {@link excluding}, so that endpoint latency cannot spend a budget that only
11
- * evicting queries could recover.
12
- */
13
- export declare class HydrationBudget {
14
- #private;
15
- readonly limitMs: number;
16
- constructor(limitMs: number, now?: MonotonicClock);
17
- /**
18
- * Runs `fn`, discounting the time it takes as non-hydration work. The
19
- * interval is measured with this budget's own clock, so an injected clock
20
- * governs both the elapsed time and what is excluded from it.
21
- */
22
- excluding<T>(fn: () => Promise<T>): Promise<T>;
23
- elapsedMs(): number;
24
- /**
25
- * Whether the budget is spent. A disabled budget (`limitMs === 0`) is never
26
- * exhausted. The elapsed time at the first exhausted check is retained in
27
- * {@link exhaustedAtMs} so that reporting does not re-read the clock.
28
- */
29
- exhausted(): boolean;
30
- /** The elapsed time at which {@link exhausted} first returned true. */
31
- get exhaustedAtMs(): number | undefined;
32
- }
33
- //# sourceMappingURL=hydration-budget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hydration-budget.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/hydration-budget.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAMzB,YACE,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,cAAkD,EASxD;IAED;;;;OAIG;IACG,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOnD;IAED,SAAS,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAUnB;IAED,uEAAuE;IACvE,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
@@ -1,51 +0,0 @@
1
- import type { MonotonicClock } from './hydration-budget.ts';
2
- /**
3
- * How long a tripped query stays rejected before a retry is allowed.
4
- *
5
- * A query that blows the timeout is almost always slow because of the shape
6
- * of its data rather than because of transient load, so retrying it on every
7
- * reconnect would burn a full timeout each time. The cooldown keeps that cost
8
- * to at most one timeout per cooldown period per query.
9
- */
10
- export declare const DEFAULT_CIRCUIT_BREAKER_OPEN_MS: number;
11
- /**
12
- * A per-query circuit breaker for view-syncer hydration.
13
- *
14
- * Hydration of a single query is aborted once its processing time exceeds
15
- * {@link timeoutMs}. Callers check {@link exceeded} at the yield points of a
16
- * hydration, so a query is only ever aborted between time slices.
17
- *
18
- * Once a query has been aborted the breaker is "open" for its transformation
19
- * hash: {@link isOpen} reports true for {@link openMs}, and callers reject the
20
- * query up front instead of hydrating it again. After that the breaker is
21
- * implicitly half-open: the next hydration attempt runs, and either succeeds
22
- * or trips the breaker again.
23
- *
24
- * The breaker is keyed by transformation hash rather than query hash because
25
- * the transformation (permissions, auth context) determines the pipeline that
26
- * runs, and a different transformation of the same query may well be fast.
27
- */
28
- export declare class HydrationCircuitBreaker {
29
- #private;
30
- readonly timeoutMs: number;
31
- readonly openMs: number;
32
- constructor(timeoutMs: number, openMs?: number, now?: MonotonicClock);
33
- /** Whether the breaker does anything at all. */
34
- get enabled(): boolean;
35
- /**
36
- * Whether a hydration that has consumed `elapsedMs` of processing time must
37
- * be aborted. Always false when the breaker is disabled.
38
- */
39
- exceeded(elapsedMs: number): boolean;
40
- /**
41
- * Records that hydrating `transformationHash` was aborted.
42
- *
43
- * Trips are rare, so this is also when expired entries are swept, which
44
- * keeps the map bounded by the number of hashes tripped within one cooldown
45
- * rather than by every hash ever tripped.
46
- */
47
- trip(transformationHash: string): void;
48
- /** Whether `transformationHash` is currently rejected. */
49
- isOpen(transformationHash: string): boolean;
50
- }
51
- //# sourceMappingURL=hydration-circuit-breaker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hydration-circuit-breaker.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/hydration-circuit-breaker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,QAAa,CAAC;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,uBAAuB;;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxB,YACE,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,MAAwC,EAChD,GAAG,GAAE,cAAkD,EAUxD;IAED,gDAAgD;IAChD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEnC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAQrC;IAED,0DAA0D;IAC1D,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAU1C;CACF"}
@@ -1,34 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { AnalyzeQueryResult } from '../../../../zero-protocol/src/analyze-query-result.ts';
3
- import type { QueryServerMetrics } from '../../../../zero-protocol/src/inspect-down.ts';
4
- import { type UnparsedInspectUpMessage } from '../../../../zero-protocol/src/inspect-up.ts';
5
- import type { NormalizedZeroConfig } from '../../config/normalize.ts';
6
- import type { InspectorDelegate } from '../../server/inspector-delegate.ts';
7
- import type { ClientHandler } from './client-handler.ts';
8
- import type { ConnectionContext } from './connection-context-manager.ts';
9
- import type { CVRStore } from './cvr-store.ts';
10
- import type { CVRSnapshot } from './cvr.ts';
11
- export declare function handleInspect(lc: LogContext, body: UnparsedInspectUpMessage[1], cvr: CVRSnapshot, client: ClientHandler, inspectorDelegate: InspectorDelegate, clientGroupID: string, authOwner: object, cvrStore: CVRStore, config: NormalizedZeroConfig, ctx: ConnectionContext): Promise<void>;
12
- /**
13
- * Removes the planner's `filter` nodes from `joinPlans` for clients before
14
- * protocol 53, which added that node type. 1.9 and 1.10 clients fail to parse
15
- * a node type they don't know, and the failed parse puts the client in its
16
- * error state.
17
- *
18
- * @visibleForTesting
19
- */
20
- export declare function analyzeResultForProtocol(result: AnalyzeQueryResult, protocolVersion: number): AnalyzeQueryResult;
21
- /**
22
- * Converts per-query server metrics to the appropriate wire format based on the
23
- * client's protocol version.
24
- *
25
- * Protocol >= 51: new format — `query-hydration-server-ms` (plain number) +
26
- * `query-update-server` (TDigest).
27
- * Protocol < 51: old format — `query-materialization-server` (TDigest) +
28
- * `query-update-server` (TDigest). The scalar hydration time is wrapped into a
29
- * one-point TDigest for backward compatibility.
30
- *
31
- * @visibleForTesting
32
- */
33
- export declare function metricsForProtocol(metrics: QueryServerMetrics | null, protocolVersion: number): QueryServerMetrics | null;
34
- //# sourceMappingURL=inspect-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inspect-handler.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/inspect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAKjD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,uDAAuD,CAAC;AAC9F,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAMpE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AAE1E,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAE1C,wBAAsB,aAAa,CACjC,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACjC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,MAAM,EAGrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,oBAAoB,EAC5B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,IAAI,CAAC,CA+Jf;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,EAC1B,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAUpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,GAAG,IAAI,EAClC,eAAe,EAAE,MAAM,GACtB,kBAAkB,GAAG,IAAI,CAmB3B"}
@@ -1,296 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { AST, LiteralValue } from '../../../../zero-protocol/src/ast.ts';
3
- import type { ClientSchema } from '../../../../zero-protocol/src/client-schema.ts';
4
- import type { Row } from '../../../../zero-protocol/src/data.ts';
5
- import { ChangeType } from '../../../../zql/src/ivm/change-type.ts';
6
- import { type Input } from '../../../../zql/src/ivm/operator.ts';
7
- import type { PlanWarning } from '../../../../zql/src/planner/planner-warnings.ts';
8
- import type { ClientGroupStorage } from '../../../../zqlite/src/database-storage.ts';
9
- import { type LoadedPermissions } from '../../auth/load-permissions.ts';
10
- import type { LogConfig, ZeroConfig } from '../../config/zero-config.ts';
11
- import type { LiteAndZqlSpec } from '../../db/specs.ts';
12
- import type { InspectorDelegate } from '../../server/inspector-delegate.ts';
13
- import { type RowKey } from '../../types/row-key.ts';
14
- import { type ShardID } from '../../types/shards.ts';
15
- import type { DeferredWritesBudget } from './deferred-writes-budget.ts';
16
- import { type QueryPushProgress, type ShouldCutOffPush } from './push-cutoff.ts';
17
- import { type QueryShape } from './query-shape.ts';
18
- import type { QueryStats } from './query-stats.ts';
19
- import type { Snapshotter } from './snapshotter.ts';
20
- type RowOp<Op extends Omit<ChangeType, ChangeType.CHILD>> = {
21
- readonly type: Op;
22
- readonly queryID: string;
23
- readonly table: string;
24
- readonly rowKey: Row;
25
- readonly row: Row;
26
- };
27
- export type RowAdd = RowOp<ChangeType.ADD>;
28
- export type RowRemove = RowOp<ChangeType.REMOVE>;
29
- export type RowEdit = RowOp<ChangeType.EDIT>;
30
- export type RowChange = RowAdd | RowRemove | RowEdit;
31
- export type QueryInfo = {
32
- readonly transformedAst: AST;
33
- readonly originalAst?: AST | undefined;
34
- readonly transformationHash: string;
35
- readonly queryName?: string | undefined;
36
- };
37
- export type HydrationStats = {
38
- /** The rows the hydration output. */
39
- readonly rowCount: number;
40
- /**
41
- * The rows the hydration read from the replica, including rows that were
42
- * then filtered out, e.g. by a filter that could not be pushed to SQLite or
43
- * by an EXISTS that did not match. Much greater than {@link rowCount} means
44
- * the query does a lot of work for the rows it returns.
45
- */
46
- readonly rowsRead: number;
47
- /** What the planner warned about the plan it chose for the query. */
48
- readonly planWarnings: readonly PlanWarning[];
49
- /** The {@link queryShape} of the query, computed when it was hydrated. */
50
- readonly shape: QueryShape;
51
- };
52
- export type PipelineHydrationReason = 'query-set-sync' | 'unchanged-query-rehydrate';
53
- type PipelineStopReason = 'replace-query' | 'remove-query' | 'abandon-advance' | 'reset' | 'destroy';
54
- export type AdvancementProgress = {
55
- /** Raw ChangeLog entries read, including skipped entries and the current change. */
56
- readonly changesScanned: number;
57
- /** Yielded source changes whose push processing completed. */
58
- readonly changesProcessed: number;
59
- /** Raw entries omitted by the snapshot diff. */
60
- readonly changesSkipped: number;
61
- };
62
- /**
63
- * A query whose pipeline was removed by a {@link CostBasedAdvance}, either
64
- * before the advancement's changes were pushed or partway through them
65
- * (`'cutoff'`). Before, it is because pushing them to the query was
66
- * estimated to cost more than hydrating it again (`'estimate'`), or because
67
- * reading them was, for the queries that were left to push them to
68
- * (`'read'`). The row changes it output before then have been returned by
69
- * the advancement. To bring the query to the advancement's
70
- * version, hydrate it again with {@link PipelineDriver.addQuery}, passing its
71
- * `originalAst`, once the advancement's changes have been iterated over in
72
- * their entirety.
73
- */
74
- export type AbandonedQuery = QueryPushProgress & {
75
- readonly reason: 'estimate' | 'read' | 'cutoff';
76
- /** What pushing the advancement's changes to it was estimated to cost. */
77
- readonly estimatedPushMs?: number | undefined;
78
- readonly transformationHash: string;
79
- readonly transformedAst: AST;
80
- /** The AST the query was added with. */
81
- readonly originalAst: AST;
82
- readonly queryName?: string | undefined;
83
- };
84
- /**
85
- * Bounds the cost of an advancement query by query, by hydrating a query
86
- * again when that is cheaper than pushing the advancement's changes through
87
- * its pipeline. This is an alternative to the client group's advancement
88
- * time limit, which does not apply to an advancement that is given this.
89
- * Such an advancement is never aborted for taking too long.
90
- */
91
- export type CostBasedAdvance = {
92
- /**
93
- * Between changes, the pipeline of each query that this says to stop
94
- * pushing to is removed (see {@link PushCutoff}).
95
- */
96
- readonly shouldCutOff: ShouldCutOffPush;
97
- /**
98
- * Before any change is pushed, the pipelines of the queries that are
99
- * estimated to be cheaper to hydrate again than to push the advancement's
100
- * changes to are removed (see {@link shouldStartOnRebuild}). This is how
101
- * many times cheaper.
102
- */
103
- readonly rebuildMargin: number;
104
- };
105
- /** How an estimate of a query's push time compared with the actual time. */
106
- export type PushEstimate = {
107
- readonly queryID: string;
108
- readonly estimatedPushMs: number;
109
- readonly pushTimeMs: number;
110
- };
111
- export type Timer = {
112
- elapsedLap: () => number;
113
- totalElapsed: () => number;
114
- };
115
- /**
116
- * Manages the state of IVM pipelines for a given ViewSyncer (i.e. client group).
117
- */
118
- export declare class PipelineDriver {
119
- #private;
120
- constructor(lc: LogContext, logConfig: LogConfig, snapshotter: Snapshotter, shardID: ShardID, storage: ClientGroupStorage, clientGroupID: string, inspectorDelegate: InspectorDelegate, yieldThresholdMs: () => number, enablePlanner?: boolean, config?: ZeroConfig, deferredWrites?: DeferredWritesBudget, queryStats?: QueryStats | undefined);
121
- /**
122
- * Initializes the PipelineDriver to the current head of the database.
123
- * Queries can then be added (i.e. hydrated) with {@link addQuery()}.
124
- *
125
- * Must only be called once.
126
- */
127
- init(clientSchema: ClientSchema): void;
128
- /**
129
- * @returns Whether the PipelineDriver has been initialized.
130
- */
131
- initialized(): boolean;
132
- /**
133
- * Clears the current pipelines and TableSources, returning the PipelineDriver
134
- * to its initial state. This should be called in response to a schema change,
135
- * as TableSources need to be recomputed.
136
- */
137
- reset(clientSchema: ClientSchema): void;
138
- /** @returns The replica version. The PipelineDriver must have been initialized. */
139
- get replicaVersion(): string;
140
- /**
141
- * Returns the current version of the database. This will reflect the
142
- * latest version change when calling {@link advance()} once the
143
- * iteration has begun.
144
- */
145
- currentVersion(): string;
146
- /**
147
- * Returns the current upstream {app}.permissions, or `null` if none are defined.
148
- */
149
- currentPermissions(): LoadedPermissions | null;
150
- /**
151
- * Advances the snapshot to the head of the database without diffing the
152
- * change log, in preparation for hydrating queries at head.
153
- *
154
- * Throws a {@link ResetPipelinesSignal} if the change log records a
155
- * schema change since the previous snapshot. The table specs (and any
156
- * TableSources built from them) were computed at or before that snapshot
157
- * and are stale with respect to the new head, so the caller must
158
- * {@link reset()} before hydrating. ({@link advance()} detects this when
159
- * the diff encounters the RESET op; this path skips the diff and so must
160
- * check explicitly.)
161
- *
162
- * @param releasePreviousSnapshot Whether to release the snapshot that the
163
- * driver was at, which is otherwise left open until the next
164
- * advance (see `Snapshotter.releasePrevious()`).
165
- */
166
- advanceWithoutDiff(releasePreviousSnapshot?: boolean): string;
167
- /**
168
- * Clears storage used for the pipelines. Call this when the
169
- * PipelineDriver will no longer be used.
170
- */
171
- destroy(): void;
172
- /** @return Map from query ID to PipelineInfo for all added queries. */
173
- queries(): ReadonlyMap<string, QueryInfo>;
174
- /**
175
- * The queries whose pipelines a {@link CostBasedAdvance} removed and that
176
- * have not been hydrated again since, by query ID. They are not in
177
- * {@link queries()}. A query whose hydration is started but does not
178
- * finish is still one of them.
179
- */
180
- abandonedQueries(): ReadonlyMap<string, AbandonedQuery>;
181
- /**
182
- * Stats from the hydration of the pipeline for `queryID`, or `undefined` if
183
- * the query has no pipeline.
184
- */
185
- hydrationStats(queryID: string): HydrationStats | undefined;
186
- totalHydrationTimeMs(): number;
187
- /**
188
- * The rows the sources hold in memory for the advancement in progress.
189
- * The advancement's reservation from the {@link DeferredWritesBudget}
190
- * bounds this.
191
- */
192
- get pendingRows(): number;
193
- /**
194
- * The estimated bytes of {@link pendingRows}, which are added to the
195
- * {@link DeferredWritesBudget}'s held bytes as the advancement goes.
196
- */
197
- get pendingBytes(): number;
198
- /**
199
- * Adds a pipeline for the query. The method will hydrate the query using the
200
- * driver's current snapshot of the database and return a stream of results.
201
- * Henceforth, updates to the query will be returned when the driver is
202
- * {@link advance}d. The query and its pipeline can be removed with
203
- * {@link removeQuery()}.
204
- *
205
- * If a query with the same queryID is already added, the existing pipeline
206
- * will be removed and destroyed before adding the new pipeline.
207
- *
208
- * @param timer The caller-controlled {@link Timer} used to determine the
209
- * final hydration time. (The caller may pause and resume the timer
210
- * when yielding the thread for time-slicing).
211
- * @return The rows from the initial hydration of the query.
212
- */
213
- addQuery(transformationHash: string, queryID: string, query: AST, timer: Timer, queryName?: string, hydrationReason?: PipelineHydrationReason): Iterable<RowChange | 'yield'>;
214
- /**
215
- * Removes the pipeline for the query. This is a no-op if the query
216
- * was not added.
217
- */
218
- removeQuery(queryID: string, stopReason?: PipelineStopReason): void;
219
- /**
220
- * Current XOR signature of the row-set attached to `queryID`, or
221
- * `undefined` if no pipeline for the query is currently active.
222
- * Maintained incrementally by {@link addQuery} and {@link advance}.
223
- */
224
- rowSetSignature(queryID: string): bigint | undefined;
225
- /**
226
- * IDs of the queries whose {@link rowSetSignature} changed (by an ADD or
227
- * REMOVE from {@link addQuery} or {@link advance}) since the last call to
228
- * {@link clearChangedRowSetSignatures}.
229
- */
230
- changedRowSetSignatures(): ReadonlySet<string>;
231
- /**
232
- * Called once the {@link changedRowSetSignatures} have been persisted.
233
- */
234
- clearChangedRowSetSignatures(): void;
235
- /**
236
- * Returns the value of the row with the given primary key `pk`,
237
- * or `undefined` if there is no such row. The pipeline must have been
238
- * initialized.
239
- */
240
- getRow(table: string, pk: RowKey): Row | undefined;
241
- /**
242
- * Advances to the new head of the database.
243
- *
244
- * @param timer The caller-controlled {@link Timer} that will be used to
245
- * measure the progress of the advancement and abort with a
246
- * {@link ResetPipelinesSignal} if it is estimated to take longer
247
- * than a hydration.
248
- * @param costBased If given, the advancement is bounded query by query
249
- * instead (see {@link CostBasedAdvance}).
250
- * @return The resulting row changes for all added queries. Note that the
251
- * `changes` must be iterated over in their entirety in order to
252
- * advance the database snapshot.
253
- * @throws A {@link ResetPipelinesSignal} if `costBased` is given and the
254
- * changes include a schema change, a truncation or a change of
255
- * the permissions. It is thrown before any change is pushed or
256
- * any pipeline is removed, as the caller resets the pipelines
257
- * either way. Without `costBased`, it is iterating over the
258
- * `changes` that throws it, on getting to that change.
259
- */
260
- advance(timer: Timer, costBased?: CostBasedAdvance): {
261
- version: string;
262
- numChanges: number;
263
- changes: Iterable<RowChange | 'yield'>;
264
- /** Available throughout iteration and after completion or an abort. */
265
- progress: () => AdvancementProgress;
266
- /**
267
- * The queries whose pipelines the {@link CostBasedAdvance} has removed
268
- * so far. They can be hydrated again once `changes` has been iterated
269
- * over.
270
- */
271
- abandoned: () => readonly AbandonedQuery[];
272
- /**
273
- * How the estimates of the {@link CostBasedAdvance} compared with the
274
- * actual push times, for the queries that had an estimate and were
275
- * pushed all of the changes. Available once `changes` has been iterated
276
- * over.
277
- */
278
- estimates: () => readonly PushEstimate[];
279
- };
280
- }
281
- /**
282
- * Core hydration logic used by {@link PipelineDriver#addQuery}, extracted to a
283
- * function for reuse by the analyze-query RPC path so that analysis hydrates
284
- * queries the same way the view-syncer does in production. As there, the rows
285
- * of a table outside `clientSchema` are keyed by its key in the replica.
286
- */
287
- export declare function hydrate(input: Input, hash: string, clientSchema: ClientSchema, tableSpecs: Map<string, LiteAndZqlSpec>): Iterable<RowChange | 'yield'>;
288
- /**
289
- * Returns the value of `childField` in the row of `input`, the pipeline of a
290
- * scalar subquery: `null` if the field is `NULL`, or `undefined` if there is
291
- * no row. Used by {@link PipelineDriver#addQuery} and the analyze-query RPC
292
- * path to resolve scalar subqueries the same way.
293
- */
294
- export declare function fetchScalarValue(input: Input, childField: string): LiteralValue | null | undefined;
295
- export {};
296
- //# sourceMappingURL=pipeline-driver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline-driver.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/pipeline-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAQjD,OAAO,KAAK,EAAC,GAAG,EAAE,YAAY,EAAC,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gDAAgD,CAAC;AACjF,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uCAAuC,CAAC;AAQ/D,OAAO,EAAC,UAAU,EAAC,MAAM,wCAAwC,CAAC;AAGlE,O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,WAAW,CAAC,MAAM,CAAC,CAE7C;IAED;;OAEG;IACH,4BAA4B,IAAI,IAAI,CAEnC;IA0BD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAIjD;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CACL,KAAK,EAAE,KAAK,EACZ,SAAS,CAAC,EAAE,gBAAgB,GAC3B;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC;QACvC,uEAAuE;QACvE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;QACpC;;;;WAIG;QACH,SAAS,EAAE,MAAM,SAAS,cAAc,EAAE,CAAC;QAC3C;;;;;WAKG;QACH,SAAS,EAAE,MAAM,SAAS,YAAY,EAAE,CAAC;KAC1C,CAsEA;CAkjCF;AA2OD;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GACtC,QAAQ,CAAC,SAAS,GAAG,OAAO,CAAC,CAK/B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,MAAM,GACjB,YAAY,GAAG,IAAI,GAAG,SAAS,CAYjC"}
@@ -1,7 +0,0 @@
1
- import type { PlanWarning } from '../../../../zql/src/planner/planner-warnings.ts';
2
- /**
3
- * Explains a {@link PlanWarning} for a zero-cache operator, in terms of the
4
- * SQLite replica, whose indexes come from the upstream database.
5
- */
6
- export declare function planWarningMessage(warning: PlanWarning): string;
7
- //# sourceMappingURL=plan-warnings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan-warnings.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/plan-warnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iDAAiD,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA+B/D"}
@@ -1,132 +0,0 @@
1
- /**
2
- * Learns what it costs to push a change of each table through each query of
3
- * a client group, and estimates from it what pushing a batch of changes
4
- * would cost.
5
- *
6
- * The estimates only decide whether a query skips pushing and starts an
7
- * advancement on rebuild (see {@link shouldStartOnRebuild}). Nothing depends
8
- * on their accuracy: a query that starts on push when it should not have is
9
- * cut off (see `PushCutoff`), and one that starts on rebuild costs its
10
- * hydration time, as it would have at the cutoff.
11
- */
12
- export declare class PushCostEstimator {
13
- #private;
14
- /**
15
- * Records what an advancement cost a query.
16
- *
17
- * @param tables The tables the query reads.
18
- * @param timeMsByTable The time spent pushing the changes of each table
19
- * to the query. Absent for a table whose changes cost it nothing,
20
- * e.g. because the rows did not match its filters.
21
- * @param changesByTable The entries of each table that the advancement
22
- * read from the change log, whether or not they reached the query,
23
- * or changed anything at all (a row that is inserted and deleted
24
- * between two snapshots is an entry that changes nothing). These
25
- * are the entries that {@link estimate} is given the count of.
26
- */
27
- record(queryID: string, tables: Iterable<string>, timeMsByTable: ReadonlyMap<string, number> | undefined, changesByTable: ReadonlyMap<string, number>): void;
28
- /**
29
- * The estimated time to push `changes` to the query, or `undefined` if it
30
- * has never been pushed any change. A table that the query has never been
31
- * pushed a change of is estimated to cost nothing.
32
- *
33
- * @param tables The tables the query reads.
34
- * @param changes The number of changes to push, by table.
35
- */
36
- estimate(queryID: string, tables: Iterable<string>, changes: ReadonlyMap<string, number>): number | undefined;
37
- /** Forgets what was learned about a query. */
38
- forget(queryID: string): void;
39
- }
40
- /**
41
- * Learns what it costs a client group to read a batch of changes, apart from
42
- * pushing them through its queries, and estimates from it what reading the
43
- * next one would cost.
44
- *
45
- * Reading has three parts, which do not cost the same entries (see
46
- * {@link ReadParts}): walking the change log, parsing the entries that
47
- * the walk returns, and looking up the rows of the entries of the tables
48
- * that are read. What each costs is learned per entry that it was done for.
49
- * A cost learned per entry of some other count is only right for a batch
50
- * with the same mix of entries: charged to the entries that are pushed, for
51
- * instance, the parsing of a batch that is mostly of tables that no query
52
- * reads makes the next batch that is not look many times as expensive as it
53
- * is.
54
- *
55
- * No query can be cut off for what this costs, as it is not a cost of any
56
- * one query. It is what pushing costs all of them together, on top of what
57
- * it costs each (see {@link shouldRebuildInsteadOfReading}).
58
- */
59
- export declare class ReadCostEstimator {
60
- #private;
61
- /**
62
- * Records what reading a batch cost. Only for a batch that was read to
63
- * its end.
64
- *
65
- * @param timeMs The time spent on each part of reading the batch.
66
- * @param entries The entries that each part was done for.
67
- */
68
- record(timeMs: ReadParts, entries: ReadParts): void;
69
- /**
70
- * The estimated time to read a batch, or `undefined` if none has been
71
- * read yet.
72
- *
73
- * @param entries The entries that each part of reading the batch would be
74
- * done for.
75
- */
76
- estimate(entries: ReadParts): number | undefined;
77
- }
78
- /**
79
- * A number for each part of reading a batch of changes: the entries of the
80
- * change log that the part is done for, or the time that it takes.
81
- */
82
- export type ReadParts = {
83
- /**
84
- * Walking the change log, which is done for every entry since the
85
- * previous snapshot, whether or not the entry is of a table that is read:
86
- * the entries are in the order they were committed in, not grouped by
87
- * table.
88
- */
89
- readonly walk: number;
90
- /**
91
- * Parsing, which is done for every entry that the walk returns. That is
92
- * all of them, unless the walk is told which tables are read.
93
- */
94
- readonly parse: number;
95
- /**
96
- * Looking up the row in both snapshots, which is done for every entry of
97
- * a table that is read. This includes the entries that then turn out to
98
- * change nothing (e.g. a row inserted and deleted since the previous
99
- * snapshot).
100
- */
101
- readonly lookup: number;
102
- };
103
- /**
104
- * Whether the queries that are left to push a batch to should all be
105
- * hydrated again instead, without the batch being read: when reading it and
106
- * pushing it to them is estimated to cost at least `margin` times what
107
- * hydrating them does.
108
- *
109
- * This is {@link shouldStartOnRebuild} for the queries together, with what
110
- * reading the batch costs added to what pushing it costs each of them. A
111
- * query that few of the batch's changes reach is cheap to push to, but the
112
- * whole batch still has to be walked to find those changes.
113
- *
114
- * @param estimatedReadMs `undefined` if there is no estimate, in which case
115
- * the batch is read.
116
- * @param queries What pushing the batch is estimated to cost each query
117
- * (nothing, if it has no estimate), and what hydrating it took.
118
- */
119
- export declare function shouldRebuildInsteadOfReading(estimatedReadMs: number | undefined, queries: Iterable<{
120
- readonly estimatedPushMs: number | undefined;
121
- readonly hydrationTimeMs: number;
122
- }>, margin: number): boolean;
123
- /**
124
- * Whether a query should start an advancement on rebuild, i.e. be hydrated
125
- * again without being pushed any of the advancement's changes: when pushing
126
- * them is estimated to cost at least `margin` times what hydrating it does.
127
- *
128
- * The margin is for the imprecision of the estimate. A query without one
129
- * starts on push.
130
- */
131
- export declare function shouldStartOnRebuild(estimatedPushMs: number | undefined, hydrationTimeMs: number, margin: number): boolean;
132
- //# sourceMappingURL=push-cost.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"push-cost.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/push-cost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB;;IAI5B;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACtD,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1C,IAAI,CAmBN;IAED;;;;;;;OAOG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,GAAG,SAAS,CAUpB;IAED,8CAA8C;IAC9C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE5B;CACF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,iBAAiB;;IAK5B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAgBlD;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAS/C;CACF;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAgBF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,CAAC,EACF,MAAM,EAAE,MAAM,GACb,OAAO,CAWT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,OAAO,CAKT"}
@@ -1,55 +0,0 @@
1
- /** What an advancement has pushed to a query so far. */
2
- export type QueryPushProgress = {
3
- readonly queryID: string;
4
- /** The time spent processing pushes to the query in this advancement. */
5
- readonly pushTimeMs: number;
6
- /** The number of changes pushed to the query in this advancement. */
7
- readonly changes: number;
8
- /** The query's hydration time, i.e. what rebuilding it is expected to cost. */
9
- readonly hydrationTimeMs: number;
10
- };
11
- /** Whether to stop pushing an advancement's changes to a query. */
12
- export type ShouldCutOffPush = (progress: QueryPushProgress) => boolean;
13
- /**
14
- * The least a query's hydration is taken to cost when deciding whether to
15
- * stop pushing to it. Small queries hydrate in well under a millisecond,
16
- * where one push can take longer than the hydration did on timer noise alone,
17
- * and hydrating again saves too little to be worth its fixed costs.
18
- */
19
- export declare const MIN_PUSH_CUTOFF_MS = 2;
20
- /**
21
- * Whether to stop pushing an advancement's changes to a query and hydrate it
22
- * again instead: once the pushes have taken as long as the hydration is
23
- * expected to.
24
- *
25
- * This is the ski-rental strategy (rent until the rent paid equals the
26
- * purchase price, then buy). Whatever the actual costs turn out to be, the
27
- * query costs at most about twice the cheaper of pushing every change and
28
- * hydrating from the start, plus the one change that crossed the line. It
29
- * needs no estimate of what the remaining changes will cost.
30
- */
31
- export declare function shouldCutOffPush({ pushTimeMs, hydrationTimeMs, }: Pick<QueryPushProgress, 'pushTimeMs' | 'hydrationTimeMs'>): boolean;
32
- /**
33
- * Bounds the cost of one advancement query by query: each query is pushed
34
- * changes until {@link ShouldCutOffPush} says to stop, and is then hydrated
35
- * again once the advancement is done.
36
- *
37
- * An advancement with a cutoff is not subject to the client group's
38
- * advancement time limit, which resets every pipeline of the client group.
39
- * The two are alternatives and are never applied together.
40
- */
41
- export declare class PushCutoff {
42
- #private;
43
- constructor(shouldCutOff?: ShouldCutOffPush);
44
- /** Called for each push to a query. */
45
- recordPush(queryID: string): void;
46
- /**
47
- * Called between changes, when no push is in progress. Returns the queries
48
- * to stop pushing to, of those pushed to since the last call.
49
- *
50
- * @param progressOf The progress of a query, or `undefined` if it is no
51
- * longer being pushed to.
52
- */
53
- takeCutOff(progressOf: (queryID: string) => QueryPushProgress | undefined): QueryPushProgress[];
54
- }
55
- //# sourceMappingURL=push-cutoff.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"push-cutoff.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/push-cutoff.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,KAAK,OAAO,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,eAAe,GAChB,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,iBAAiB,CAAC,GAAG,OAAO,CAErE;AAED;;;;;;;;GAQG;AACH,qBAAa,UAAU;;IAKrB,YAAY,YAAY,GAAE,gBAAmC,EAE5D;IAED,uCAAuC;IACvC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED;;;;;;OAMG;IACH,UAAU,CACR,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,GAC7D,iBAAiB,EAAE,CAarB;CACF"}