@serve.zone/interfaces 32.90.0 → 32.92.0

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.
@@ -11,7 +11,12 @@ import type {
11
11
  IRegisterGatewaySessionRequest,
12
12
  TGatewayConfigArea,
13
13
  } from '../data/gatewayconnector.js';
14
- import type { IGatewayTakeoverState, TGatewayDryRunReport } from '../data/gatewayintent.js';
14
+ import type {
15
+ IGatewayTakeoverExportDigest,
16
+ IGatewayTakeoverState,
17
+ TGatewayDryRunReport,
18
+ TGatewayTakeoverReport,
19
+ } from '../data/gatewayintent.js';
15
20
  import type { IGatewayRouteDnsResult } from '../data/gateway.js';
16
21
  import type { ILocationScope } from '../data/location.js';
17
22
  import type { IIdentityCredential } from '../data/user.js';
@@ -257,3 +262,65 @@ export interface IReq_Admin_Cloudly_GetGatewayDryRun extends plugins.typedreques
257
262
  report: TGatewayDryRunReport;
258
263
  };
259
264
  }
265
+
266
+ /**
267
+ * An administrator takes a gateway over (Linus rulings 30, 117 §1 and §4, 121 §6 item 7, 166 point
268
+ * 1): the running controller reads the five tables the gateway's socket exports now, refuses unless
269
+ * they are exactly the tables of the dry run the administrator read (`exportDigests`: every area's
270
+ * `exportDigest`) and unless that dry run of them passes, then imports them byte for byte as its
271
+ * intent in one transaction that appends one `import` revision naming the administrator, and pushes
272
+ * them. The takeover changes no table the gateway serves, only their owner. A gateway is taken over
273
+ * once: a repeated request, after a lost answer too, is answered
274
+ * `{ ok: false, code: 'gateway-taken-over' }` and writes nothing; the takeover state answers who
275
+ * took it over and when. Which administrators may call it is the controller's decision.
276
+ *
277
+ * `exportDigests` answers, by what it holds:
278
+ * - not a list, or an entry that is not exactly `{ area, digest }` with a configuration area and a
279
+ * `sha256:` digest: the connector refusal `request-invalid`, thrown, never a report;
280
+ * - well-formed entries but not exactly one per configuration area (one missing, one twice), or one
281
+ * whose digest is not the table the gateway exports now:
282
+ * `{ ok: false, code: 'takeover-exports-moved' }`;
283
+ * - one entry per area, in any order: matched by `area`; the order is never a refusal.
284
+ */
285
+ export interface IReq_Admin_Cloudly_TakeOverGateway extends plugins.typedrequestInterfaces.implementsTR<
286
+ plugins.typedrequestInterfaces.ITypedRequest,
287
+ IReq_Admin_Cloudly_TakeOverGateway
288
+ > {
289
+ method: 'takeOverGateway';
290
+ request: {
291
+ identity: IIdentityCredential;
292
+ gatewayId: string;
293
+ /** One per configuration area, matched by `area` (the order is free); five in all. */
294
+ exportDigests: IGatewayTakeoverExportDigest[];
295
+ };
296
+ response: {
297
+ report: TGatewayTakeoverReport;
298
+ };
299
+ }
300
+
301
+ /**
302
+ * An administrator exports the document the running controller pushes a gateway now (Linus ruling
303
+ * 162 point 6), so the operator can carry it to the gateway's host control socket
304
+ * (`dcrouter apply-desired-state --file`) when no session carries it: the controller's document as
305
+ * its push builds it, judged by `data.validateGatewayDesiredState` (a gateway that was not taken
306
+ * over is pushed no area). It reads only: no revision, table or claim is written, nothing is pushed
307
+ * and the gateway is not called, so it answers while the gateway is unreachable. A gateway the
308
+ * controller does not record is refused `gateway-not-found` (a connector refusal).
309
+ *
310
+ * Exclude bodies from logs: the document carries the tables' values, secrets included, in plain
311
+ * text. The caller writes it to an owner-only file and states only its tuple (gateway, controller,
312
+ * epoch, revision and per-area digests), which the gateway's apply line states too.
313
+ */
314
+ export interface IReq_Admin_Cloudly_ExportGatewayDesiredState extends plugins.typedrequestInterfaces.implementsTR<
315
+ plugins.typedrequestInterfaces.ITypedRequest,
316
+ IReq_Admin_Cloudly_ExportGatewayDesiredState
317
+ > {
318
+ method: 'exportGatewayDesiredState';
319
+ request: {
320
+ identity: IIdentityCredential;
321
+ gatewayId: string;
322
+ };
323
+ response: {
324
+ desired: IGatewayDesiredState;
325
+ };
326
+ }