@inflatable-cookie/longhorn 0.5.0 → 0.7.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.
- package/README.md +2 -2
- package/package.json +1 -7
- package/src/agent-control/generated/protocol.ts +228 -0
- package/src/agent-control/index.ts +1 -5
- package/src/agent-control/inject.ts +4 -1
- package/src/agent-control/selection.ts +42 -25
- package/src/agent-control/shim.ts +428 -198
- package/src/bridge/direct.ts +1 -1
- package/src/bridge/generated/fields.ts +4 -3
- package/src/bridge/generated/protocol.ts +62 -7
- package/src/bridge/generated/variant-fields.ts +1 -1
- package/src/bridge/job.ts +49 -12
- package/src/bridge/loopback.ts +7 -25
- package/src/bridge/operation.ts +13 -43
- package/src/bridge/router.ts +10 -23
- package/src/bridge/runtime/connection.ts +78 -109
- package/src/bridge/runtime/policy.ts +8 -28
- package/src/bridge/runtime/retry.ts +6 -18
- package/src/bridge/session.ts +4 -14
- package/src/bridge/stream/connection.ts +24 -55
- package/src/bridge/stream/source.ts +2 -6
- package/src/bridge/stream/tracker.ts +12 -12
- package/src/bridge/supervision.ts +104 -97
- package/src/bridge/validation/base.ts +21 -63
- package/src/bridge/validation/jobs.ts +11 -25
- package/src/bridge/validation/negotiation.ts +28 -43
- package/src/bridge/validation/operations.ts +29 -65
- package/src/bridge/validation/streams.ts +3 -10
- package/src/commands/client.ts +37 -28
- package/src/commands/controller.ts +119 -96
- package/src/commands/generated/fields.ts +7 -6
- package/src/commands/generated/protocol.ts +28 -1
- package/src/commands/generated/variant-fields.ts +1 -1
- package/src/commands/keyboard.ts +94 -100
- package/src/commands/physical-code.ts +11 -0
- package/src/commands/ports.ts +8 -13
- package/src/commands/projectors.ts +100 -75
- package/src/commands/validation.ts +434 -241
- package/src/config/client.ts +9 -22
- package/src/config/generated/base.ts +22 -6
- package/src/config/generated/fields.ts +4 -3
- package/src/config/generated/label-template.ts +1 -1
- package/src/config/generated/labels.ts +1 -1
- package/src/config/generated/protocol.ts +1 -1
- package/src/config/generated/restore.ts +35 -12
- package/src/config/generated/variant-fields.ts +1 -1
- package/src/config/names.ts +6 -12
- package/src/config/validation/commands.ts +11 -25
- package/src/config/validation/outcomes.ts +163 -70
- package/src/config/validation/primitives.ts +35 -80
- package/src/config/validation/projection.ts +100 -128
- package/src/core/connection.ts +187 -83
- package/src/core/controller-lifecycle.ts +144 -0
- package/src/core/generated/identifiers.ts +4 -0
- package/src/core/identifiers.ts +40 -0
- package/src/core/index.ts +10 -1
- package/src/core/json-value.ts +58 -0
- package/src/core/listeners.ts +35 -0
- package/src/core/record.ts +80 -0
- package/src/core/transport.ts +9 -11
- package/src/core/wire-copy.ts +7 -0
- package/src/history/client.ts +11 -13
- package/src/history/controller.ts +106 -108
- package/src/history/direct.ts +1 -3
- package/src/history/generated/fields.ts +4 -3
- package/src/history/generated/protocol.ts +8 -5
- package/src/history/generated/variant-fields.ts +1 -1
- package/src/history/ports.ts +7 -4
- package/src/history/serialized.ts +9 -13
- package/src/history/validation.ts +69 -75
- package/src/history-tree/client.ts +89 -11
- package/src/history-tree/controller.ts +380 -96
- package/src/history-tree/direct.ts +3 -1
- package/src/history-tree/generated/fields.ts +5 -3
- package/src/history-tree/generated/protocol.ts +43 -7
- package/src/history-tree/generated/variant-fields.ts +7 -1
- package/src/history-tree/ports.ts +12 -5
- package/src/history-tree/serialized.ts +39 -11
- package/src/history-tree/validation.ts +286 -78
- package/src/layout/generated/protocol.ts +4 -3
- package/src/layout/generated/variant-fields.ts +47 -0
- package/src/layout/index.ts +1 -1
- package/src/layout/ratio.ts +10 -9
- package/src/layout/validation.ts +98 -32
- package/src/layout/visibility.ts +1 -2
- package/src/licence/client.ts +48 -7
- package/src/licence/controller.ts +127 -70
- package/src/licence/direct.ts +3 -1
- package/src/licence/generated/fields.ts +4 -3
- package/src/licence/generated/key-conformance.json +28 -0
- package/src/licence/generated/protocol.ts +9 -5
- package/src/licence/generated/variant-fields.ts +1 -1
- package/src/licence/key.ts +42 -18
- package/src/licence/ports.ts +10 -3
- package/src/licence/serialized.ts +32 -9
- package/src/licence/validation.ts +134 -43
- package/src/native-content/client.ts +207 -234
- package/src/native-content/generated/fields.ts +6 -6
- package/src/native-content/generated/protocol.ts +16 -5
- package/src/native-content/generated/variant-fields.ts +1 -1
- package/src/native-content/ports.ts +11 -16
- package/src/native-content/serialized.ts +12 -19
- package/src/native-content/validation/base.ts +57 -80
- package/src/native-content/validation/messages.ts +24 -35
- package/src/native-content/validation/state.ts +31 -33
- package/src/notifications/client.ts +85 -51
- package/src/notifications/controller.ts +400 -145
- package/src/notifications/direct.ts +3 -1
- package/src/notifications/generated/fields.ts +4 -3
- package/src/notifications/generated/labels.ts +1 -1
- package/src/notifications/generated/protocol.ts +5 -1
- package/src/notifications/generated/variant-fields.ts +1 -1
- package/src/notifications/ports.ts +9 -4
- package/src/notifications/serialized.ts +11 -9
- package/src/notifications/tone.ts +1 -1
- package/src/notifications/validation.ts +165 -71
- package/src/operation/bridge.ts +187 -60
- package/src/operation/client.ts +48 -62
- package/src/operation/controller.ts +67 -97
- package/src/operation/direct.ts +1 -3
- package/src/operation/generated/fields.ts +4 -3
- package/src/operation/generated/labels.ts +1 -1
- package/src/operation/generated/protocol.ts +5 -1
- package/src/operation/generated/variant-fields.ts +1 -1
- package/src/operation/ports.ts +12 -10
- package/src/operation/serialized.ts +8 -9
- package/src/operation/validation.ts +189 -104
- package/src/settings/client.ts +11 -44
- package/src/settings/connection.ts +35 -53
- package/src/settings/generated/fields.ts +5 -4
- package/src/settings/generated/protocol.ts +14 -5
- package/src/settings/generated/variant-fields.ts +1 -1
- package/src/settings/names.ts +2 -4
- package/src/settings/registry.ts +23 -25
- package/src/settings/validation/authority.ts +21 -19
- package/src/settings/validation/command.ts +22 -41
- package/src/settings/validation/error.ts +2 -8
- package/src/settings/validation/primitives.ts +46 -97
- package/src/settings/validation/projection.ts +8 -24
- package/src/settings/validation/registry.ts +33 -79
- package/src/surface-transfer/client.ts +6 -18
- package/src/surface-transfer/generated/fields.ts +3 -3
- package/src/surface-transfer/generated/protocol.ts +3 -3
- package/src/surface-transfer/generated/variant-fields.ts +1 -1
- package/src/surface-transfer/validation.ts +91 -86
- package/src/surfaces/client.ts +33 -55
- package/src/surfaces/generated/fields.ts +3 -3
- package/src/surfaces/generated/protocol.ts +1 -1
- package/src/surfaces/generated/variant-fields.ts +1 -1
- package/src/surfaces/validation.ts +227 -99
- package/src/transfer/client.ts +26 -60
- package/src/transfer/connection.ts +29 -51
- package/src/transfer/generated/fields.ts +7 -6
- package/src/transfer/generated/protocol.ts +13 -5
- package/src/transfer/generated/variant-fields.ts +1 -1
- package/src/transfer/index.ts +8 -1
- package/src/transfer/payload.ts +20 -35
- package/src/transfer/validation.ts +169 -119
- package/src/update/client.ts +86 -9
- package/src/update/controller.ts +264 -116
- package/src/update/direct.ts +3 -1
- package/src/update/generated/fields.ts +5 -4
- package/src/update/generated/protocol.ts +25 -9
- package/src/update/generated/variant-fields.ts +4 -2
- package/src/update/ports.ts +14 -6
- package/src/update/serialized.ts +36 -10
- package/src/update/validation.ts +118 -48
package/src/config/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InvokeTransport } from "@inflatable-cookie/longhorn/core";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
BackupCreateCommand,
|
|
@@ -73,9 +73,9 @@ import {
|
|
|
73
73
|
} from "./names.ts";
|
|
74
74
|
|
|
75
75
|
export class ConfigOperationsClient {
|
|
76
|
-
readonly #transport:
|
|
76
|
+
readonly #transport: InvokeTransport;
|
|
77
77
|
|
|
78
|
-
constructor(transport:
|
|
78
|
+
constructor(transport: InvokeTransport) {
|
|
79
79
|
this.#transport = transport;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -108,9 +108,7 @@ export class ConfigOperationsClient {
|
|
|
108
108
|
return value;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async recoverStorage(
|
|
112
|
-
command: StorageRecoveryCommand,
|
|
113
|
-
): Promise<StorageRecoveryOutcome> {
|
|
111
|
+
async recoverStorage(command: StorageRecoveryCommand): Promise<StorageRecoveryOutcome> {
|
|
114
112
|
assertValidStorageRecoveryCommand(command);
|
|
115
113
|
const value = await this.#transport.invoke(CONFIG_STORAGE_RECOVER_COMMAND, {
|
|
116
114
|
command,
|
|
@@ -119,9 +117,7 @@ export class ConfigOperationsClient {
|
|
|
119
117
|
return value;
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
async cleanupStorage(
|
|
123
|
-
command: StorageCleanupCommand,
|
|
124
|
-
): Promise<StorageCleanupOutcome> {
|
|
120
|
+
async cleanupStorage(command: StorageCleanupCommand): Promise<StorageCleanupOutcome> {
|
|
125
121
|
assertValidStorageCleanupCommand(command);
|
|
126
122
|
const value = await this.#transport.invoke(CONFIG_STORAGE_CLEANUP_COMMAND, {
|
|
127
123
|
command,
|
|
@@ -159,9 +155,7 @@ export class ConfigOperationsClient {
|
|
|
159
155
|
return value;
|
|
160
156
|
}
|
|
161
157
|
|
|
162
|
-
async inspectRestore(
|
|
163
|
-
command: RestoreInspectCommand,
|
|
164
|
-
): Promise<RestoreInspectOutcome> {
|
|
158
|
+
async inspectRestore(command: RestoreInspectCommand): Promise<RestoreInspectOutcome> {
|
|
165
159
|
assertValidRestoreInspectCommand(command);
|
|
166
160
|
const value = await this.#transport.invoke(CONFIG_RESTORE_INSPECT_COMMAND, {
|
|
167
161
|
command,
|
|
@@ -179,9 +173,7 @@ export class ConfigOperationsClient {
|
|
|
179
173
|
return value;
|
|
180
174
|
}
|
|
181
175
|
|
|
182
|
-
async executeRestore(
|
|
183
|
-
command: RestoreExecuteCommand,
|
|
184
|
-
): Promise<RestoreExecuteOutcome> {
|
|
176
|
+
async executeRestore(command: RestoreExecuteCommand): Promise<RestoreExecuteOutcome> {
|
|
185
177
|
assertValidRestoreExecuteCommand(command);
|
|
186
178
|
const value = await this.#transport.invoke(CONFIG_RESTORE_EXECUTE_COMMAND, {
|
|
187
179
|
command,
|
|
@@ -194,17 +186,12 @@ export class ConfigOperationsClient {
|
|
|
194
186
|
command: RestoreAdapterExecuteCommand,
|
|
195
187
|
): Promise<RestoreAdapterExecuteOutcome> {
|
|
196
188
|
assertValidRestoreAdapterExecuteCommand(command);
|
|
197
|
-
const value = await this.#transport.invoke(
|
|
198
|
-
CONFIG_RESTORE_ADAPTER_EXECUTE_COMMAND,
|
|
199
|
-
{ command },
|
|
200
|
-
);
|
|
189
|
+
const value = await this.#transport.invoke(CONFIG_RESTORE_ADAPTER_EXECUTE_COMMAND, { command });
|
|
201
190
|
assertValidRestoreAdapterExecuteOutcome(value);
|
|
202
191
|
return value;
|
|
203
192
|
}
|
|
204
193
|
|
|
205
|
-
async recoverRestore(
|
|
206
|
-
command: RestoreRecoveryCommand,
|
|
207
|
-
): Promise<RestoreRecoveryOutcomeProjection> {
|
|
194
|
+
async recoverRestore(command: RestoreRecoveryCommand): Promise<RestoreRecoveryOutcomeProjection> {
|
|
208
195
|
assertValidRestoreRecoveryCommand(command);
|
|
209
196
|
const value = await this.#transport.invoke(CONFIG_RESTORE_RECOVER_COMMAND, {
|
|
210
197
|
command,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
// @generated by `effigy generate:
|
|
1
|
+
// @generated by `effigy generate:bindings`; do not edit.
|
|
2
2
|
// Rust serde types are the wire authority.
|
|
3
3
|
import type { RestoreOperationsProjection } from "./restore.ts";
|
|
4
4
|
|
|
5
5
|
export const CONFIG_OPERATIONS_PROTOCOL_VERSION = 1 as const;
|
|
6
|
-
export const CONFIG_MAXIMUM_OPAQUE_ID_BYTES = 128 as const;
|
|
7
6
|
export const CONFIG_OPERATION_CAPABILITIES = ["storageDiagnostics","storageTransition","backupInventory","backupCreate","backupExport","backupRetention","backupEncryption","restoreInspection","restoreExecution","restoreAdapterExecution","restoreRecovery"] as const;
|
|
8
7
|
export const CONFIG_OPERATION_REJECTION_CODES = ["unauthorized","unsupported","authorityChanged","confirmationMismatch","transitionActive","recoveryRequired","conflicts","pendingPublication","selectionCancelled","archiveChanged","archiveCorrupt","archiveFutureVersion","identityMismatch","restorePlanStale","restoreActive","restoreAdapterChanged","incompleteInventory","encryptionInteractionRequired","policyBlocked"] as const;
|
|
8
|
+
export const STORAGE_PROFILE_IDS = ["platform-native-v1","unified-app-root-v1","shared-product-root-v1","portable-v1"] as const;
|
|
9
|
+
export const STORAGE_LEAF_PROVENANCES = ["canonicalApplicationId","stableStorageName"] as const;
|
|
10
|
+
export const BACKUP_KINDS = ["operational","user-export","pre-migration","pre-restore"] as const;
|
|
11
|
+
export const STORAGE_CLASSES = ["defaults","policy","user-config","machine-state","workspace-local","project-shared","secret","cache","runtime","log"] as const;
|
|
12
|
+
export const BACKUP_INVENTORY_ENTRY_STATES = ["valid","locked","corrupt","foreign","unknown","unreadable","unmanaged"] as const;
|
|
13
|
+
export const BACKUP_PENDING_POLICIES = ["refuse","flush"] as const;
|
|
9
14
|
export const STORAGE_BOOTSTRAP_STATES = ["selected","recoveryRequired"] as const;
|
|
10
15
|
export const BACKUP_PENDING_STATES = ["clear","pending"] as const;
|
|
11
16
|
export const BACKUP_ENCRYPTION_STATES = ["unavailable","available","interactionRequired","failed"] as const;
|
|
@@ -15,6 +20,7 @@ export const STORAGE_RECOVERY_STATUSES = ["recovered","rejected"] as const;
|
|
|
15
20
|
export const STORAGE_CLEANUP_STATUSES = ["applied","rejected"] as const;
|
|
16
21
|
export const BACKUP_CREATE_STATUSES = ["published","rejected"] as const;
|
|
17
22
|
export const BACKUP_EXPORT_STATUSES = ["published","rejected"] as const;
|
|
23
|
+
export const BACKUP_PUBLICATION_DURABILITIES = ["fileSynced","fileAndDirectorySynced","portableFileAndDirectorySynced"] as const;
|
|
18
24
|
export const BACKUP_RETENTION_APPLY_STATUSES = ["applied","rejected"] as const;
|
|
19
25
|
|
|
20
26
|
export type ConfigProtocolVersion = number;
|
|
@@ -125,6 +131,8 @@ bootstrap: StorageBootstrapProjection,
|
|
|
125
131
|
*/
|
|
126
132
|
availableProfiles: Array<StorageProfileId>, };
|
|
127
133
|
|
|
134
|
+
export type StorageClass = "defaults" | "policy" | "user-config" | "machine-state" | "workspace-local" | "project-shared" | "secret" | "cache" | "runtime" | "log";
|
|
135
|
+
|
|
128
136
|
export type StorageTransitionDomainProjection = {
|
|
129
137
|
/**
|
|
130
138
|
* Stable configuration domain id.
|
|
@@ -133,7 +141,7 @@ domainId: string,
|
|
|
133
141
|
/**
|
|
134
142
|
* Storage lifecycle class.
|
|
135
143
|
*/
|
|
136
|
-
storageClass:
|
|
144
|
+
storageClass: StorageClass,
|
|
137
145
|
/**
|
|
138
146
|
* Planned action.
|
|
139
147
|
*/
|
|
@@ -261,6 +269,8 @@ transitionReceiptDigest: string,
|
|
|
261
269
|
*/
|
|
262
270
|
removedPaths: Array<string>, };
|
|
263
271
|
|
|
272
|
+
export type BackupKind = "operational" | "user-export" | "pre-migration" | "pre-restore";
|
|
273
|
+
|
|
264
274
|
export type BackupArchiveProjection = {
|
|
265
275
|
/**
|
|
266
276
|
* Exact root-level archive path.
|
|
@@ -277,7 +287,7 @@ createdAt: string,
|
|
|
277
287
|
/**
|
|
278
288
|
* Backup kind.
|
|
279
289
|
*/
|
|
280
|
-
kind:
|
|
290
|
+
kind: BackupKind,
|
|
281
291
|
/**
|
|
282
292
|
* Digest over exact published archive bytes.
|
|
283
293
|
*/
|
|
@@ -645,6 +655,8 @@ totalPayloadBytes: number,
|
|
|
645
655
|
*/
|
|
646
656
|
flushedPendingPublication: boolean, };
|
|
647
657
|
|
|
658
|
+
export type BackupPublicationDurability = "fileSynced" | "fileAndDirectorySynced" | "portableFileAndDirectorySynced";
|
|
659
|
+
|
|
648
660
|
export type BackupPublicationReceiptProjection = {
|
|
649
661
|
/**
|
|
650
662
|
* Exact published path.
|
|
@@ -659,9 +671,9 @@ destination: string,
|
|
|
659
671
|
*/
|
|
660
672
|
archiveSha256: string,
|
|
661
673
|
/**
|
|
662
|
-
* Established durability
|
|
674
|
+
* Established visibility and filesystem durability.
|
|
663
675
|
*/
|
|
664
|
-
durability:
|
|
676
|
+
durability: BackupPublicationDurability,
|
|
665
677
|
/**
|
|
666
678
|
* Whether an authorized export was replaced.
|
|
667
679
|
*/
|
|
@@ -712,3 +724,7 @@ snapshot: ConfigOperationsSnapshot, } | { "status": "rejected",
|
|
|
712
724
|
* Typed refusal.
|
|
713
725
|
*/
|
|
714
726
|
rejection: ConfigOperationRejection, };
|
|
727
|
+
|
|
728
|
+
export type ConfigOperationsHostErrorCode = "authorityUnavailable" | "stateUnavailable" | "hostInteraction";
|
|
729
|
+
|
|
730
|
+
export type ConfigOperationsHostError = { "code": ConfigOperationsHostErrorCode, "message": string, "retryable": boolean, };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// @generated by `effigy generate:
|
|
1
|
+
// @generated by `effigy generate:bindings`; do not edit.
|
|
2
2
|
// Allowed field names per protocol type, from the Rust structs.
|
|
3
3
|
// A `record()` given one of these rejects unknown and missing keys —
|
|
4
4
|
// contract 010's Boundary Validation Target.
|
|
5
5
|
|
|
6
|
-
export const CONFIG_FIELDS
|
|
6
|
+
export const CONFIG_FIELDS = {
|
|
7
7
|
"StorageRootProjection": ["kind", "path", "provenance"],
|
|
8
8
|
"StorageLayoutProjection": ["profile", "platform", "canonicalApplicationId", "effectiveLeaf", "leafProvenance", "roots", "warnings", "layoutDigest"],
|
|
9
9
|
"StorageOperationsProjection": ["layout", "bootstrap", "availableProfiles"],
|
|
@@ -30,6 +30,7 @@ export const CONFIG_FIELDS: Record<string, readonly string[]> = {
|
|
|
30
30
|
"ConfigOperationRejection": ["code", "detail", "snapshot"],
|
|
31
31
|
"BackupCaptureReceiptProjection": ["selectedDomains", "capturedDomains", "absentDomains", "sourcePreservedDomains", "excludedDomains", "customDomains", "externalConsistencyGroups", "totalPayloadBytes", "flushedPendingPublication"],
|
|
32
32
|
"BackupPublicationReceiptProjection": ["path", "destination", "archiveSha256", "durability", "replacedExisting"],
|
|
33
|
+
"ConfigOperationsHostError": ["code", "message", "retryable"],
|
|
33
34
|
"RestoreOperationsProjection": ["state", "safetyBackupSha256"],
|
|
34
35
|
"RestoreIdentityProjection": ["application", "producer"],
|
|
35
36
|
"RestoreConsistencyGroupProjection": ["id", "mode", "authority"],
|
|
@@ -51,4 +52,4 @@ export const CONFIG_FIELDS: Record<string, readonly string[]> = {
|
|
|
51
52
|
"RestoreAdapterReceiptProjection": ["domainId", "adapter", "participation", "confirmationDigest", "outcome", "evidence"],
|
|
52
53
|
"RestoreRecoveryCommand": ["protocolVersion", "requestId"],
|
|
53
54
|
"RestoreRecoveryReceiptProjection": ["outcome", "domainIds"],
|
|
54
|
-
};
|
|
55
|
+
} as const;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by `effigy generate:
|
|
1
|
+
// @generated by `effigy generate:bindings`; do not edit.
|
|
2
2
|
// Mirrors `longhorn_config::render_label_template`. One substitution rule: a
|
|
3
3
|
// placeholder is a name in braces, and anything else is literal. An unknown
|
|
4
4
|
// placeholder is left as written, so a mistake shows as `{typo}` on screen
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
// @generated by `effigy generate:
|
|
1
|
+
// @generated by `effigy generate:bindings`; do not edit.
|
|
2
2
|
// Rust serde types are the wire authority.
|
|
3
|
-
import type { BackupPublicationReceiptProjection, ConfigGeneration, ConfigOperationRejection, ConfigOperationsSnapshot, ConfigProtocolVersion, ConfigRequestId } from "./base.ts";
|
|
4
|
-
|
|
3
|
+
import type { BackupPublicationReceiptProjection, ConfigGeneration, ConfigOperationRejection, ConfigOperationsSnapshot, ConfigProtocolVersion, ConfigRequestId, BackupKind, StorageClass } from "./base.ts";
|
|
4
|
+
|
|
5
|
+
export const BACKUP_CONSISTENCY_MODES = ["coordinated-bounded","external-snapshot"] as const;
|
|
6
|
+
export const BACKUP_SOURCE_STATES = ["present","absent","source-preserved"] as const;
|
|
7
|
+
export const RESTORE_INTEGRITY_VALUES = ["verified"] as const;
|
|
8
|
+
export const RESTORE_AUTHENTICITY_VALUES = ["unauthenticated","authenticated"] as const;
|
|
9
|
+
export const RESTORE_CONFLICT_CHOICES = ["useArchive","keepCurrent"] as const;
|
|
10
|
+
export const RESTORE_OPERATION_STATES = ["inactive","active","recoveryRequired"] as const;
|
|
11
|
+
export const RESTORE_ADAPTER_REQUIREMENTS = ["failureAtomic","allowSeparate"] as const;
|
|
5
12
|
export const RESTORE_ARCHIVE_SELECTION_SOURCES = ["inventory","hostPicker"] as const;
|
|
6
13
|
export const RESTORE_IDENTITY_STATUSES = ["compatible","mismatch"] as const;
|
|
7
14
|
export const RESTORE_DOMAIN_COMPATIBILITY_STATUSES = ["ready","migrationRequired","unknownDomain","descriptorMismatch","domainCodeUnavailable","policyExcluded","customAdapterUnavailable","customAdapterReady","customAdapterRejected","targetUnavailable","sourcePreserved","sourceRejected","targetPreparationFailed"] as const;
|
|
@@ -9,6 +16,10 @@ export const RESTORE_ADAPTER_PARTICIPATION_KINDS = ["excluded","separate","failu
|
|
|
9
16
|
export const RESTORE_CURRENT_EVIDENCE_STATES = ["absent","present"] as const;
|
|
10
17
|
export const RESTORE_INSPECT_STATUSES = ["ready","locked","rejected"] as const;
|
|
11
18
|
export const RESTORE_PLAN_STATUSES = ["ready","rejected"] as const;
|
|
19
|
+
export const RESTORE_EXECUTION_STAGES = ["validateSafetyBackup","recoverPrevious","recheckCurrent","captureRollback","captureSafetyBackup","encodeSafetyBackup","publishSafetyBackup","publishJournal","publishTarget","verifyTarget","rollback","cleanup"] as const;
|
|
20
|
+
export const RESTORE_FAILURE_TERMINALS = ["noLiveMutation","rolledBack","recoveryRequired"] as const;
|
|
21
|
+
export const RESTORE_ADAPTER_OUTCOMES = ["verified","rolledBack","recoveryRequired"] as const;
|
|
22
|
+
export const RESTORE_RECOVERY_RESULTS = ["noRecoveryNeeded","rolledBack","terminalCleanup"] as const;
|
|
12
23
|
export const RESTORE_EXECUTE_STATUSES = ["succeeded","rolledBack","recoveryRequired","rejected"] as const;
|
|
13
24
|
export const RESTORE_ADAPTER_EXECUTE_STATUSES = ["completed","rejected"] as const;
|
|
14
25
|
export const RESTORE_RECOVERY_STATUSES = ["recovered","recoveryRequired","rejected"] as const;
|
|
@@ -55,6 +66,8 @@ application: RestoreIdentityStatusProjection,
|
|
|
55
66
|
*/
|
|
56
67
|
producer: RestoreIdentityStatusProjection, };
|
|
57
68
|
|
|
69
|
+
export type BackupConsistencyMode = "coordinated-bounded" | "external-snapshot";
|
|
70
|
+
|
|
58
71
|
export type RestoreConsistencyGroupProjection = {
|
|
59
72
|
/**
|
|
60
73
|
* Stable group id.
|
|
@@ -63,7 +76,7 @@ id: string,
|
|
|
63
76
|
/**
|
|
64
77
|
* Coordinated-bounded or external-snapshot mode.
|
|
65
78
|
*/
|
|
66
|
-
mode:
|
|
79
|
+
mode: BackupConsistencyMode,
|
|
67
80
|
/**
|
|
68
81
|
* Declared transaction authority.
|
|
69
82
|
*/
|
|
@@ -129,6 +142,8 @@ export type RestoreAdapterParticipationProjection = { "kind": "excluded",
|
|
|
129
142
|
*/
|
|
130
143
|
reason: string, } | { "kind": "separate" } | { "kind": "failureAtomic" } | { "kind": "groupedFailureAtomic" };
|
|
131
144
|
|
|
145
|
+
export type BackupSourceState = "present" | "absent" | "source-preserved";
|
|
146
|
+
|
|
132
147
|
export type RestoreDomainInspectionProjection = {
|
|
133
148
|
/**
|
|
134
149
|
* Stable domain id.
|
|
@@ -137,7 +152,7 @@ domainId: string,
|
|
|
137
152
|
/**
|
|
138
153
|
* Manifest storage class.
|
|
139
154
|
*/
|
|
140
|
-
storageClass:
|
|
155
|
+
storageClass: StorageClass,
|
|
141
156
|
/**
|
|
142
157
|
* Manifest consistency group.
|
|
143
158
|
*/
|
|
@@ -149,7 +164,7 @@ adapter: string,
|
|
|
149
164
|
/**
|
|
150
165
|
* Present, absent, or source-preserved state.
|
|
151
166
|
*/
|
|
152
|
-
sourceState:
|
|
167
|
+
sourceState: BackupSourceState,
|
|
153
168
|
/**
|
|
154
169
|
* Archive source schema when readable.
|
|
155
170
|
*/
|
|
@@ -171,7 +186,7 @@ domainId: string,
|
|
|
171
186
|
/**
|
|
172
187
|
* Manifest storage class.
|
|
173
188
|
*/
|
|
174
|
-
storageClass:
|
|
189
|
+
storageClass: StorageClass,
|
|
175
190
|
/**
|
|
176
191
|
* Stable manifest reason.
|
|
177
192
|
*/
|
|
@@ -223,7 +238,7 @@ createdAt: string,
|
|
|
223
238
|
/**
|
|
224
239
|
* Archive purpose.
|
|
225
240
|
*/
|
|
226
|
-
kind:
|
|
241
|
+
kind: BackupKind,
|
|
227
242
|
/**
|
|
228
243
|
* Producing application version.
|
|
229
244
|
*/
|
|
@@ -495,11 +510,15 @@ skippedDomainIds: Array<string>,
|
|
|
495
510
|
*/
|
|
496
511
|
excludedDomainIds: Array<string>, };
|
|
497
512
|
|
|
513
|
+
export type RestoreExecutionStageProjection = "validateSafetyBackup" | "recoverPrevious" | "recheckCurrent" | "captureRollback" | "captureSafetyBackup" | "encodeSafetyBackup" | "publishSafetyBackup" | "publishJournal" | "publishTarget" | "verifyTarget" | "rollback" | "cleanup";
|
|
514
|
+
|
|
515
|
+
export type RestoreFailureTerminalProjection = "noLiveMutation" | "rolledBack" | "recoveryRequired";
|
|
516
|
+
|
|
498
517
|
export type RestoreExecutionFailureProjection = {
|
|
499
518
|
/**
|
|
500
519
|
* Failed journaled transaction phase.
|
|
501
520
|
*/
|
|
502
|
-
stage:
|
|
521
|
+
stage: RestoreExecutionStageProjection,
|
|
503
522
|
/**
|
|
504
523
|
* First affected domain when known.
|
|
505
524
|
*/
|
|
@@ -507,7 +526,7 @@ domainId: string | null,
|
|
|
507
526
|
/**
|
|
508
527
|
* Exact terminal guarantee established before return.
|
|
509
528
|
*/
|
|
510
|
-
terminal:
|
|
529
|
+
terminal: RestoreFailureTerminalProjection,
|
|
511
530
|
/**
|
|
512
531
|
* Safe failure detail.
|
|
513
532
|
*/
|
|
@@ -575,6 +594,8 @@ confirmationDigest: string,
|
|
|
575
594
|
*/
|
|
576
595
|
requirement: RestoreAdapterRequirementProjection, };
|
|
577
596
|
|
|
597
|
+
export type RestoreAdapterOutcomeProjection = "verified" | "rolledBack" | "recoveryRequired";
|
|
598
|
+
|
|
578
599
|
export type RestoreAdapterReceiptProjection = {
|
|
579
600
|
/**
|
|
580
601
|
* Restored custom domain.
|
|
@@ -595,7 +616,7 @@ confirmationDigest: string,
|
|
|
595
616
|
/**
|
|
596
617
|
* Verified, rolled-back, or recovery-required terminal.
|
|
597
618
|
*/
|
|
598
|
-
outcome:
|
|
619
|
+
outcome: RestoreAdapterOutcomeProjection,
|
|
599
620
|
/**
|
|
600
621
|
* Exact semantic evidence when supplied.
|
|
601
622
|
*/
|
|
@@ -625,11 +646,13 @@ protocolVersion: ConfigProtocolVersion,
|
|
|
625
646
|
*/
|
|
626
647
|
requestId: ConfigRequestId, };
|
|
627
648
|
|
|
649
|
+
export type RestoreRecoveryResultProjection = "noRecoveryNeeded" | "rolledBack" | "terminalCleanup";
|
|
650
|
+
|
|
628
651
|
export type RestoreRecoveryReceiptProjection = {
|
|
629
652
|
/**
|
|
630
653
|
* No-op, verified rollback, or terminal cleanup.
|
|
631
654
|
*/
|
|
632
|
-
outcome:
|
|
655
|
+
outcome: RestoreRecoveryResultProjection,
|
|
633
656
|
/**
|
|
634
657
|
* Journal domains considered by recovery.
|
|
635
658
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by `effigy generate:
|
|
1
|
+
// @generated by `effigy generate:bindings`; do not edit.
|
|
2
2
|
// Allowed field names per tagged-union variant, from the Rust enums.
|
|
3
3
|
// Keyed by type, then by discriminant. The discriminant itself is in
|
|
4
4
|
// each list, because `exact()` compares every key.
|
package/src/config/names.ts
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
export const CONFIG_SNAPSHOT_COMMAND = "longhorn_config_snapshot";
|
|
2
|
-
export const CONFIG_STORAGE_INSPECT_COMMAND =
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
export const CONFIG_STORAGE_RECOVER_COMMAND =
|
|
7
|
-
"longhorn_config_storage_recover";
|
|
8
|
-
export const CONFIG_STORAGE_CLEANUP_COMMAND =
|
|
9
|
-
"longhorn_config_storage_cleanup";
|
|
2
|
+
export const CONFIG_STORAGE_INSPECT_COMMAND = "longhorn_config_storage_inspect";
|
|
3
|
+
export const CONFIG_STORAGE_EXECUTE_COMMAND = "longhorn_config_storage_execute";
|
|
4
|
+
export const CONFIG_STORAGE_RECOVER_COMMAND = "longhorn_config_storage_recover";
|
|
5
|
+
export const CONFIG_STORAGE_CLEANUP_COMMAND = "longhorn_config_storage_cleanup";
|
|
10
6
|
export const CONFIG_BACKUP_CREATE_COMMAND = "longhorn_config_backup_create";
|
|
11
7
|
export const CONFIG_BACKUP_EXPORT_COMMAND = "longhorn_config_backup_export";
|
|
12
|
-
export const CONFIG_BACKUP_RETENTION_COMMAND =
|
|
13
|
-
"longhorn_config_backup_retention";
|
|
8
|
+
export const CONFIG_BACKUP_RETENTION_COMMAND = "longhorn_config_backup_retention";
|
|
14
9
|
export const CONFIG_RESTORE_INSPECT_COMMAND = "longhorn_config_restore_inspect";
|
|
15
10
|
export const CONFIG_RESTORE_PLAN_COMMAND = "longhorn_config_restore_plan";
|
|
16
11
|
export const CONFIG_RESTORE_EXECUTE_COMMAND = "longhorn_config_restore_execute";
|
|
17
|
-
export const CONFIG_RESTORE_ADAPTER_EXECUTE_COMMAND =
|
|
18
|
-
"longhorn_config_restore_adapter_execute";
|
|
12
|
+
export const CONFIG_RESTORE_ADAPTER_EXECUTE_COMMAND = "longhorn_config_restore_adapter_execute";
|
|
19
13
|
export const CONFIG_RESTORE_RECOVER_COMMAND = "longhorn_config_restore_recover";
|
|
@@ -15,7 +15,11 @@ import type {
|
|
|
15
15
|
StorageTransitionInspectCommand,
|
|
16
16
|
} from "../generated/protocol.ts";
|
|
17
17
|
import {
|
|
18
|
+
BACKUP_PENDING_POLICIES,
|
|
19
|
+
RESTORE_ADAPTER_REQUIREMENTS,
|
|
18
20
|
RESTORE_ARCHIVE_SELECTION_SOURCES,
|
|
21
|
+
RESTORE_CONFLICT_CHOICES,
|
|
22
|
+
STORAGE_PROFILE_IDS,
|
|
19
23
|
} from "../generated/protocol.ts";
|
|
20
24
|
import {
|
|
21
25
|
array,
|
|
@@ -28,14 +32,6 @@ import {
|
|
|
28
32
|
record,
|
|
29
33
|
} from "./primitives.ts";
|
|
30
34
|
|
|
31
|
-
const STORAGE_PROFILES = [
|
|
32
|
-
"platform-native-v1",
|
|
33
|
-
"unified-app-root-v1",
|
|
34
|
-
"shared-product-root-v1",
|
|
35
|
-
"portable-v1",
|
|
36
|
-
] as const;
|
|
37
|
-
const RESTORE_CHOICES = ["useArchive", "keepCurrent"] as const;
|
|
38
|
-
|
|
39
35
|
export function assertValidConfigSnapshotCommand(
|
|
40
36
|
value: unknown,
|
|
41
37
|
): asserts value is ConfigSnapshotCommand {
|
|
@@ -46,7 +42,7 @@ export function assertValidStorageTransitionInspectCommand(
|
|
|
46
42
|
value: unknown,
|
|
47
43
|
): asserts value is StorageTransitionInspectCommand {
|
|
48
44
|
const command = baseCommand(value, "$", CONFIG_FIELDS.StorageTransitionInspectCommand);
|
|
49
|
-
discriminant(command.targetProfile,
|
|
45
|
+
discriminant(command.targetProfile, STORAGE_PROFILE_IDS, "$.targetProfile");
|
|
50
46
|
boolean(command.includeLogs, "$.includeLogs");
|
|
51
47
|
}
|
|
52
48
|
|
|
@@ -74,7 +70,7 @@ export function assertValidBackupCreateCommand(
|
|
|
74
70
|
value: unknown,
|
|
75
71
|
): asserts value is BackupCreateCommand {
|
|
76
72
|
const command = baseCommand(value, "$", CONFIG_FIELDS.BackupCreateCommand);
|
|
77
|
-
discriminant(command.pendingPolicy,
|
|
73
|
+
discriminant(command.pendingPolicy, BACKUP_PENDING_POLICIES, "$.pendingPolicy");
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
export function assertValidBackupExportCommand(
|
|
@@ -95,19 +91,13 @@ export function assertValidRestoreInspectCommand(
|
|
|
95
91
|
): asserts value is RestoreInspectCommand {
|
|
96
92
|
const command = baseCommand(value, "$", CONFIG_FIELDS.RestoreInspectCommand);
|
|
97
93
|
const selection = record(command.selection, "$.selection");
|
|
98
|
-
discriminant(
|
|
99
|
-
selection.source,
|
|
100
|
-
RESTORE_ARCHIVE_SELECTION_SOURCES,
|
|
101
|
-
"$.selection.source",
|
|
102
|
-
);
|
|
94
|
+
discriminant(selection.source, RESTORE_ARCHIVE_SELECTION_SOURCES, "$.selection.source");
|
|
103
95
|
if (selection.source === "inventory") {
|
|
104
96
|
digest(selection.archiveSha256, "$.selection.archiveSha256");
|
|
105
97
|
}
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
export function assertValidRestorePlanCommand(
|
|
109
|
-
value: unknown,
|
|
110
|
-
): asserts value is RestorePlanCommand {
|
|
100
|
+
export function assertValidRestorePlanCommand(value: unknown): asserts value is RestorePlanCommand {
|
|
111
101
|
const command = baseCommand(value, "$", CONFIG_FIELDS.RestorePlanCommand);
|
|
112
102
|
finiteNumber(command.generation, "$.generation");
|
|
113
103
|
digest(command.archiveSha256, "$.archiveSha256");
|
|
@@ -115,7 +105,7 @@ export function assertValidRestorePlanCommand(
|
|
|
115
105
|
const path = `$.choices[${index}]`;
|
|
116
106
|
const choice = record(choiceValue, path, CONFIG_FIELDS.RestoreDomainChoice);
|
|
117
107
|
nonempty(choice.domainId, `${path}.domainId`);
|
|
118
|
-
discriminant(choice.choice,
|
|
108
|
+
discriminant(choice.choice, RESTORE_CONFLICT_CHOICES, `${path}.choice`);
|
|
119
109
|
});
|
|
120
110
|
}
|
|
121
111
|
|
|
@@ -131,11 +121,7 @@ export function assertValidRestoreAdapterExecuteCommand(
|
|
|
131
121
|
const command = generationConfirmationCommand(value, CONFIG_FIELDS.RestoreAdapterExecuteCommand);
|
|
132
122
|
digest(command.archiveSha256, "$.archiveSha256");
|
|
133
123
|
nonempty(command.domainId, "$.domainId");
|
|
134
|
-
discriminant(
|
|
135
|
-
command.requirement,
|
|
136
|
-
["failureAtomic", "allowSeparate"],
|
|
137
|
-
"$.requirement",
|
|
138
|
-
);
|
|
124
|
+
discriminant(command.requirement, RESTORE_ADAPTER_REQUIREMENTS, "$.requirement");
|
|
139
125
|
}
|
|
140
126
|
|
|
141
127
|
export function assertValidRestoreRecoveryCommand(
|
|
@@ -146,7 +132,7 @@ export function assertValidRestoreRecoveryCommand(
|
|
|
146
132
|
|
|
147
133
|
function generationConfirmationCommand(
|
|
148
134
|
value: unknown,
|
|
149
|
-
allowed?:
|
|
135
|
+
allowed?: ReadonlyArray<string>,
|
|
150
136
|
): Record<string, unknown> {
|
|
151
137
|
const command = baseCommand(value, "$", allowed);
|
|
152
138
|
finiteNumber(command.generation, "$.generation");
|