@restatedev/sessions 0.10.3 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -118,6 +118,7 @@ interface SessionContext {
118
118
  readonly rpc: Rpc;
119
119
  readonly send: Send;
120
120
  readonly cancel: Cancel; // cancel an invocation, by its id
121
+ working<T>(fn: () => T | Promise<T>): Promise<T>; // keep the attempt alive while fn runs
121
122
  }
122
123
 
123
124
  interface ViewContext {
@@ -133,6 +134,27 @@ Neither has key/value state, `run`, `sleep`, awakeables, promises or
133
134
  signals: the database is a session's only state. You can await their
134
135
  operations concurrently, with `Promise.all` or `Promise.race`.
135
136
 
137
+ ### Long work outside Restate
138
+
139
+ Restate shuts an attempt down once it has heard nothing from it for its
140
+ inactivity timeout, a minute by default. That is the default on purpose: the
141
+ attempt suspends on the calls it waits for, and a new attempt starts when
142
+ one answers, so a wait of hours or days holds no process. An attempt that
143
+ waits for nothing starts again at once.
144
+
145
+ Work of the handler's own that may take longer than that, such as a model's
146
+ request, runs in `ctx.working`. While it runs, the attempt sends Restate a
147
+ heartbeat every 20 seconds, whatever else it waits for:
148
+
149
+ ```ts
150
+ const reply = await ctx.working(() => model.generate(prompt));
151
+ ```
152
+
153
+ Keep long waits on Restate (a call, a signal) out of it, or the attempt
154
+ holds its process for as long as they take. Work cut off outside it is done
155
+ again by the next attempt, which runs from the start. The database's own
156
+ calls keep the attempt alive by themselves.
157
+
136
158
  ### Views
137
159
 
138
160
  A view reads the session's database as committed, while handlers may be
@@ -203,6 +225,14 @@ you await them together, and so do a transaction's statements. A
203
225
  transaction holds `ctx.db` until it ends: inside its body, use `tx`, since a
204
226
  call to `ctx.db` is refused.
205
227
 
228
+ A body that holds its transaction open for more work (a library that batches
229
+ the commits of what it does) can ask whether another call is waiting:
230
+ `tx.queued` is a promise that settles once a call to `ctx.db` has queued
231
+ behind the transaction. A body that returns on it commits, and the waiting
232
+ call runs after that commit and sees it, so that call waits for one commit
233
+ and no more. A call made before the transaction began does not settle it, and
234
+ a body that ignores it behaves as before.
235
+
206
236
  If a crash happens between two commits, the first one stays. Statements that
207
237
  must succeed or fail together belong in one transaction.
208
238
 
@@ -550,15 +580,12 @@ storage in the session's database.
550
580
  each attempt adds its own.
551
581
  - **A shutdown is a restart.** Restate shuts an attempt down once its
552
582
  inactivity timeout passes with nothing heard from it, and the next attempt
553
- runs from the start. While the handler works outside Restate (a model
554
- request, say), the attempt sends a heartbeat every 20 seconds
555
- (`RESTATE_SESSIONS_HEARTBEAT`, in milliseconds), so a long handler keeps
556
- its attempt. A deployment that shortens Restate's inactivity timeout must
557
- shorten this with it. No heartbeat is sent while an answer of Restate's is
558
- outstanding (a call's result or invocation id, a send's invocation id, an
559
- attachment), even one nobody awaits: Restate then shuts the attempt down
560
- after the timeout, and starts the next one when the answer comes. The
561
- database's own reads and acks don't stop a heartbeat.
583
+ runs from the start: when a call it waits for answers, or at once if it
584
+ waits for none. Only work in `ctx.working`
585
+ ([long work outside Restate](#long-work-outside-restate)) and the
586
+ database's own calls keep an attempt alive, with a heartbeat every 20
587
+ seconds (`RESTATE_SESSIONS_HEARTBEAT`, in milliseconds). A deployment that
588
+ shortens Restate's inactivity timeout must shorten this with it.
562
589
  - **One acked write per commit.** Every commit waits for Restate to ack its
563
590
  head's write, a round trip to the runtime. Statements that commit one by
564
591
  one pay it each time, so group them in a transaction.
@@ -45,9 +45,11 @@ export interface DatabaseWriter extends DatabaseReader {
45
45
  /**
46
46
  * {@link DatabaseWriter} over `run`, which runs one call's SQL and returns
47
47
  * its rows with their columns, failing as `failure` makes its errors (as
48
- * `run` makes the engine's).
48
+ * `run` makes the engine's). `run` answers with the value itself when the
49
+ * call was ready at once, which only this package sees: each call returns a
50
+ * promise.
49
51
  */
50
- export declare function sqlOver(run: (sql: string, params?: SqlParam[]) => Promise<SqlQueryResult>, failure?: (error: unknown) => unknown): DatabaseWriter;
52
+ export declare function sqlOver(run: (sql: string, params?: SqlParam[]) => Answer<SqlQueryResult>, failure?: (error: unknown) => unknown): DatabaseWriter;
51
53
  /**
52
54
  * A key/value store, the object's state: `set` and `clear` return at once,
53
55
  * and `sync` resolves once every write before it is stored. Writes are
@@ -74,8 +76,11 @@ export interface Store {
74
76
  */
75
77
  interface NativeSession {
76
78
  queryColumns(sql: string, params?: SqlParam[]): Answer<SqlQueryResult>;
79
+ /** `queryColumns`, after `before`'s statements in the same call; absent in an addon without it. */
80
+ queryColumnsAfter?(before: string[], sql: string, params?: SqlParam[]): Answer<SqlQueryResult>;
77
81
  begin(): Answer<void>;
78
- commit(records: Record<string, Buffer>): Answer<void>;
82
+ /** `withCommit`: whether the transaction has work to run at the commit's sync (see `Boundary.sync`). */
83
+ commit(records: Record<string, Buffer>, withCommit?: boolean): Answer<void>;
79
84
  rollback(): Answer<void>;
80
85
  record(name: string): Answer<Buffer>;
81
86
  isUsable(): boolean;
@@ -84,6 +89,12 @@ interface NativeSession {
84
89
  }
85
90
  /** A value, or a promise of it: `await` takes either. */
86
91
  type Answer<T> = T | Promise<T>;
92
+ /**
93
+ * Run `fn`, keeping the attempt alive meanwhile: the attempt's `working`
94
+ * (see `driver.ts`). The database's calls run in it, being local work that
95
+ * never waits on Restate for long.
96
+ */
97
+ export type Working = <T>(fn: () => T | Promise<T>) => Promise<T>;
87
98
  /**
88
99
  * Open the database of `namespace` over `store`. One process-wide page cache
89
100
  * serves every namespace. A `reader` reads beside the namespace's owner (a
@@ -100,9 +111,10 @@ export declare function open(namespace: string, store: Store, { reader }?: {
100
111
  * {@link ConnectionTransaction.withCommit} — so its `get`, `set` and `clear`
101
112
  * are never reached. `name` names a database beside the object's own.
102
113
  */
103
- export declare function openOnVm(namespace: string, store: Store, vm: Vm, { name, reader }?: {
114
+ export declare function openOnVm(namespace: string, store: Store, vm: Vm, { name, reader, working }?: {
104
115
  name?: string;
105
116
  reader?: boolean;
117
+ working?: Working;
106
118
  }): Promise<Connection>;
107
119
  /**
108
120
  * The store as the addon calls it. An error of the store's crosses the addon
@@ -121,27 +133,45 @@ declare class Boundary implements Store {
121
133
  withSync: (() => void) | undefined;
122
134
  readonly keys?: () => Promise<string[]>;
123
135
  private readonly store;
124
- constructor(store: Store);
136
+ private readonly working;
137
+ constructor(store: Store, working?: Working);
125
138
  get(key: string): Promise<Uint8Array<ArrayBufferLike> | null | undefined>;
126
139
  set(key: string, value: Uint8Array): void;
127
140
  clear(key: string): void;
128
141
  sync(): Promise<void>;
142
+ /**
143
+ * `call`'s value if it is ready (the addon answers at once): then no scope
144
+ * is opened, as nothing waited; a promise runs on in the attempt's `working`
145
+ * scope, which opens as the call returns it.
146
+ */
147
+ aliveNow<T>(call: () => Answer<T>): Answer<T>;
148
+ /** `call`, in the attempt's `working` scope if the database has one. */
149
+ alive<T>(call: () => T | Promise<T>): Promise<T>;
129
150
  /** `request`'s result, keeping its error, thrown at once or rejected. */
130
151
  private kept;
131
152
  }
132
153
  /**
133
154
  * SQL on a session of the addon: {@link DatabaseWriter}'s `query` and `execute`
134
- * by way of its `queryColumns`.
155
+ * by way of its `queryColumnsNow`.
135
156
  */
136
157
  declare abstract class Sql implements DatabaseWriter {
137
158
  protected readonly native: NativeSession;
138
159
  protected readonly boundary: Boundary;
160
+ private readonly over;
139
161
  constructor(native: NativeSession, boundary: Boundary);
140
- abstract queryColumns(sql: string, params?: SqlParam[]): Promise<SqlQueryResult>;
162
+ /**
163
+ * The rows of one statement with their column names: the value itself if
164
+ * the addon answered at once (only the package's own code takes it so), else
165
+ * a promise of it. A failure is a rejection.
166
+ */
167
+ abstract queryColumnsNow(sql: string, params?: SqlParam[]): Answer<SqlQueryResult>;
168
+ queryColumns(sql: string, params?: SqlParam[]): Promise<SqlQueryResult>;
141
169
  query<T = Row>(sql: string, params?: SqlParam[]): Promise<T[]>;
142
170
  get<T = Row>(sql: string, params?: SqlParam[]): Promise<T | undefined>;
143
171
  values(sql: string, params?: SqlParam[]): Promise<SqlValue[][]>;
144
172
  execute(sql: string, params?: SqlParam[]): Promise<void>;
173
+ /** {@link request}, but the value itself if it is ready, and then without a scope or a promise. */
174
+ protected requestNow<T>(call: () => Answer<T>): Answer<T>;
145
175
  /**
146
176
  * `call`'s result, or its {@link failure}: `call` makes the request, as the
147
177
  * addon throws as it is called (arguments it cannot convert, and the error
@@ -165,7 +195,12 @@ export declare class Connection extends Sql {
165
195
  private readonly running;
166
196
  /** Settles once the last call queued so far has: the next call runs after it. */
167
197
  private queue;
168
- queryColumns(sql: string, params?: SqlParam[]): Promise<SqlQueryResult>;
198
+ /** The last transaction queued, until it has committed or rolled back: a call queued behind it fires it. */
199
+ private tail;
200
+ /** Calls queued and not settled: with none, a call that is ready runs at once, in order. */
201
+ private inflight;
202
+ private readonly release;
203
+ queryColumnsNow(sql: string, params?: SqlParam[]): Answer<SqlQueryResult>;
169
204
  /**
170
205
  * Run `body` as one SQL transaction: it commits when `body` resolves, with
171
206
  * the records it set, and rolls back when it rejects, with the body's own
@@ -174,6 +209,7 @@ export declare class Connection extends Sql {
174
209
  * COMMIT rolls back.
175
210
  */
176
211
  transaction<T>(body: (tx: ConnectionTransaction) => Promise<T>): Promise<T>;
212
+ private run;
177
213
  /**
178
214
  * The record `name`, as the last commit that set it left it (see
179
215
  * {@link ConnectionTransaction.setRecord}); empty if none did.
@@ -198,6 +234,8 @@ export declare class Connection extends Sql {
198
234
  export interface ConnectionTransaction extends DatabaseWriter {
199
235
  /** The rows of one statement, with their column names. */
200
236
  queryColumns(sql: string, params?: SqlParam[]): Promise<SqlQueryResult>;
237
+ /** {@link queryColumns} for the package's own code: the value itself if the addon answered at once. */
238
+ queryColumnsNow(sql: string, params?: SqlParam[]): Answer<SqlQueryResult>;
201
239
  /**
202
240
  * Set the record `name` to `value` with this transaction, in the same
203
241
  * write: a whole value kept beside the SQL, in no table, stored exactly
@@ -216,6 +254,31 @@ export interface ConnectionTransaction extends DatabaseWriter {
216
254
  * transaction rolls back.
217
255
  */
218
256
  withCommit(run: () => void): void;
257
+ /**
258
+ * Have `sql` (one statement, no parameters) run just before the next call
259
+ * of this transaction, in the same call to the addon: the statements are
260
+ * the ones a call of their own would run, in the order the calls are made,
261
+ * and the call fails with the error of the first that fails. It spares
262
+ * the crossing of a call. Returns false, and queues nothing, where the
263
+ * addon cannot (an addon without `queryColumnsAfter`): run the statement
264
+ * with {@link queryColumns}. One still queued as the body settles runs
265
+ * then, before the commit, and its failure fails the transaction.
266
+ */
267
+ defer(sql: string): boolean;
268
+ /**
269
+ * Take back the last `sql` that {@link defer} queued if no call has taken
270
+ * it yet: it never runs. Whether it did.
271
+ */
272
+ undefer(sql: string): boolean;
273
+ /**
274
+ * Settles, and never rejects, once another call to the connection has
275
+ * queued behind this transaction: it is waiting for the body to settle.
276
+ * A body that holds the transaction open for more work can return on it,
277
+ * so that the call costs one commit rather than a stall. A call made
278
+ * before the transaction began does not settle it, and neither does one
279
+ * made from the body, which is refused.
280
+ */
281
+ readonly queued: Promise<void>;
219
282
  }
220
283
  export {};
221
284
  //# sourceMappingURL=database.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAmB,KAAK,EAAE,EAAE,MAAM,SAAS,CAAC;AAGnD,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpE,uEAAuE;AACvE,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1C,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACxB,IAAI,SAAc;CAC5B;AAED,0CAA0C;AAC1C,MAAM,MAAM,GAAG,GA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