@serve.zone/interfaces 20.0.0 → 20.1.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/changelog.md +14 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/isolatedrestore.js +7 -82
- package/dist_ts/platform/index.d.ts +3 -1
- package/dist_ts/platform/index.js +4 -2
- package/dist_ts/platform/storagemigration.d.ts +346 -0
- package/dist_ts/platform/storagemigration.golden.d.ts +49 -0
- package/dist_ts/platform/storagemigration.golden.js +207 -0
- package/dist_ts/platform/storagemigration.js +1554 -0
- package/dist_ts/private/canonicaljson.d.ts +14 -0
- package/dist_ts/private/canonicaljson.js +154 -0
- package/package.json +1 -1
- package/readme.md +126 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/isolatedrestore.ts +12 -93
- package/ts/platform/index.ts +3 -0
- package/ts/platform/storagemigration.golden.ts +241 -0
- package/ts/platform/storagemigration.ts +3082 -0
- package/ts/private/canonicaljson.ts +221 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { deepFreezeValue } from '../private/canonicaljson.js';
|
|
2
|
+
import type {
|
|
3
|
+
IObjectStorageMigrationPrepareRequest,
|
|
4
|
+
IUnfencedObjectStorageBindingControlSnapshot,
|
|
5
|
+
TActiveObjectStorageBinding,
|
|
6
|
+
TStagedObjectStorageBinding,
|
|
7
|
+
TUnfencedObjectStorageBindingControlSnapshotDigestPayload,
|
|
8
|
+
} from './storagemigration.js';
|
|
9
|
+
|
|
10
|
+
export interface IStorageMigrationCanonicalDigestGoldenVector<TInput> {
|
|
11
|
+
input: TInput;
|
|
12
|
+
canonicalJson: string;
|
|
13
|
+
sha256: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const capabilities = {
|
|
17
|
+
performanceTier: 'capacity',
|
|
18
|
+
durability: 'persistent',
|
|
19
|
+
topology: 'singleNode',
|
|
20
|
+
hardQuota: true,
|
|
21
|
+
snapshots: 'none',
|
|
22
|
+
backup: true,
|
|
23
|
+
encryptedInTransit: true,
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
const delivery = {
|
|
27
|
+
type: 'environment',
|
|
28
|
+
keys: {
|
|
29
|
+
endpoint: 'APP_S3_ENDPOINT',
|
|
30
|
+
bucket: 'APP_S3_BUCKET',
|
|
31
|
+
region: 'APP_S3_REGION',
|
|
32
|
+
accessKeyId: 'APP_S3_ACCESS_KEY',
|
|
33
|
+
secretAccessKey: 'APP_S3_SECRET_KEY',
|
|
34
|
+
},
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
const credentials = {
|
|
38
|
+
secretBundleId: 'service-storage',
|
|
39
|
+
accessKeyIdKey: 'object.accessKeyId',
|
|
40
|
+
secretAccessKeyKey: 'object.secretAccessKey',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const sourceBinding: TActiveObjectStorageBinding = {
|
|
44
|
+
schemaVersion: 1,
|
|
45
|
+
id: 'binding-object',
|
|
46
|
+
serviceId: 'service-app',
|
|
47
|
+
requestId: 'object-data',
|
|
48
|
+
requestDigest:
|
|
49
|
+
'1111111111111111111111111111111111111111111111111111111111111111',
|
|
50
|
+
kind: 'objectStorage',
|
|
51
|
+
generation: 3,
|
|
52
|
+
observedGeneration: 3,
|
|
53
|
+
status: 'ready',
|
|
54
|
+
policy: {
|
|
55
|
+
classId: 'source-object',
|
|
56
|
+
revision: '1',
|
|
57
|
+
},
|
|
58
|
+
capabilities,
|
|
59
|
+
resourceRef: 'source-resource',
|
|
60
|
+
accessMode: 'readWrite',
|
|
61
|
+
connection: {
|
|
62
|
+
endpoint: 'https://source.example.test',
|
|
63
|
+
bucket: 'source-bucket',
|
|
64
|
+
region: 'local',
|
|
65
|
+
},
|
|
66
|
+
credentials,
|
|
67
|
+
delivery,
|
|
68
|
+
versioning: false,
|
|
69
|
+
createdAt: 1_700_000_000_000,
|
|
70
|
+
updatedAt: 1_700_000_000_001,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const target = {
|
|
74
|
+
policy: {
|
|
75
|
+
classId: 'capacity-object',
|
|
76
|
+
revision: '4',
|
|
77
|
+
},
|
|
78
|
+
storageClass: {
|
|
79
|
+
kind: 'objectStorage',
|
|
80
|
+
purpose: 'backup',
|
|
81
|
+
required: {
|
|
82
|
+
performanceTier: 'capacity',
|
|
83
|
+
durability: 'persistent',
|
|
84
|
+
backup: true,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
request: {
|
|
88
|
+
id: 'object-data',
|
|
89
|
+
kind: 'objectStorage',
|
|
90
|
+
storageClass: 'backupCapacity',
|
|
91
|
+
capacity: {
|
|
92
|
+
request: '500GiB',
|
|
93
|
+
limit: '1TiB',
|
|
94
|
+
},
|
|
95
|
+
reclaimPolicy: 'retain',
|
|
96
|
+
accessMode: 'readWrite',
|
|
97
|
+
delivery,
|
|
98
|
+
},
|
|
99
|
+
credentials,
|
|
100
|
+
} as const;
|
|
101
|
+
|
|
102
|
+
const preparationSnapshotPayload:
|
|
103
|
+
TUnfencedObjectStorageBindingControlSnapshotDigestPayload = {
|
|
104
|
+
schemaVersion: 1,
|
|
105
|
+
binding: sourceBinding,
|
|
106
|
+
recordRevision: 12,
|
|
107
|
+
capturedAt: 1_700_000_000_010,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const preparationSnapshot: IUnfencedObjectStorageBindingControlSnapshot = {
|
|
111
|
+
...preparationSnapshotPayload,
|
|
112
|
+
snapshotDigest:
|
|
113
|
+
'35870a0c3ca7f2ee70d0ae7f83109bec23a8ce59bf8efef1c94221a496210439',
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const prepareRequest: IObjectStorageMigrationPrepareRequest = {
|
|
117
|
+
schemaVersion: 1,
|
|
118
|
+
migrationId: 'migration-object-capacity',
|
|
119
|
+
sourceControlSnapshot: preparationSnapshot,
|
|
120
|
+
workloadGeneration: 8,
|
|
121
|
+
target,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const candidateBinding: TStagedObjectStorageBinding = {
|
|
125
|
+
...sourceBinding,
|
|
126
|
+
requestDigest:
|
|
127
|
+
'2096dfa1f6db50d670cbb4d6436f38c2eec383435c99346e31d0d1a9e0b1beba',
|
|
128
|
+
generation: 4,
|
|
129
|
+
observedGeneration: 3,
|
|
130
|
+
status: 'provisioning',
|
|
131
|
+
policy: target.policy,
|
|
132
|
+
resourceRef: 'destination-resource',
|
|
133
|
+
capacity: {
|
|
134
|
+
requested: '500GiB',
|
|
135
|
+
granted: '500GiB',
|
|
136
|
+
limit: '1TiB',
|
|
137
|
+
},
|
|
138
|
+
connection: {
|
|
139
|
+
endpoint: 'https://destination.example.test',
|
|
140
|
+
bucket: 'destination-bucket',
|
|
141
|
+
region: 'local',
|
|
142
|
+
},
|
|
143
|
+
updatedAt: 1_700_000_000_020,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const storageMigrationCanonicalDigestGoldenVectors = deepFreezeValue({
|
|
147
|
+
version: 1 as const,
|
|
148
|
+
targetRequest: {
|
|
149
|
+
input: target.request,
|
|
150
|
+
canonicalJson:
|
|
151
|
+
'{"accessMode":"readWrite","capacity":{"limit":"1TiB","request":"500GiB"},' +
|
|
152
|
+
'"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
|
|
153
|
+
'"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
|
|
154
|
+
'"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
|
|
155
|
+
'"id":"object-data","kind":"objectStorage","reclaimPolicy":"retain",' +
|
|
156
|
+
'"storageClass":"backupCapacity"}',
|
|
157
|
+
sha256:
|
|
158
|
+
'2096dfa1f6db50d670cbb4d6436f38c2eec383435c99346e31d0d1a9e0b1beba',
|
|
159
|
+
},
|
|
160
|
+
preparationSnapshot: {
|
|
161
|
+
input: preparationSnapshotPayload,
|
|
162
|
+
canonicalJson:
|
|
163
|
+
'{"binding":{"accessMode":"readWrite","capabilities":{"backup":true,' +
|
|
164
|
+
'"durability":"persistent","encryptedInTransit":true,"hardQuota":true,' +
|
|
165
|
+
'"performanceTier":"capacity","snapshots":"none","topology":"singleNode"},' +
|
|
166
|
+
'"connection":{"bucket":"source-bucket","endpoint":"https://source.example.test",' +
|
|
167
|
+
'"region":"local"},"createdAt":1700000000000,"credentials":' +
|
|
168
|
+
'{"accessKeyIdKey":"object.accessKeyId","secretAccessKeyKey":"object.secretAccessKey",' +
|
|
169
|
+
'"secretBundleId":"service-storage"},"delivery":{"keys":' +
|
|
170
|
+
'{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
|
|
171
|
+
'"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
|
|
172
|
+
'"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
|
|
173
|
+
'"generation":3,"id":"binding-object","kind":"objectStorage",' +
|
|
174
|
+
'"observedGeneration":3,"policy":{"classId":"source-object","revision":"1"},' +
|
|
175
|
+
'"requestDigest":"1111111111111111111111111111111111111111111111111111111111111111",' +
|
|
176
|
+
'"requestId":"object-data","resourceRef":"source-resource","schemaVersion":1,' +
|
|
177
|
+
'"serviceId":"service-app","status":"ready","updatedAt":1700000000001,' +
|
|
178
|
+
'"versioning":false},"capturedAt":1700000000010,"recordRevision":12,"schemaVersion":1}',
|
|
179
|
+
sha256:
|
|
180
|
+
'35870a0c3ca7f2ee70d0ae7f83109bec23a8ce59bf8efef1c94221a496210439',
|
|
181
|
+
},
|
|
182
|
+
prepareRequest: {
|
|
183
|
+
input: prepareRequest,
|
|
184
|
+
canonicalJson:
|
|
185
|
+
'{"migrationId":"migration-object-capacity","schemaVersion":1,' +
|
|
186
|
+
'"sourceControlSnapshot":{"binding":{"accessMode":"readWrite",' +
|
|
187
|
+
'"capabilities":{"backup":true,"durability":"persistent",' +
|
|
188
|
+
'"encryptedInTransit":true,"hardQuota":true,"performanceTier":"capacity",' +
|
|
189
|
+
'"snapshots":"none","topology":"singleNode"},"connection":' +
|
|
190
|
+
'{"bucket":"source-bucket","endpoint":"https://source.example.test","region":"local"},' +
|
|
191
|
+
'"createdAt":1700000000000,"credentials":{"accessKeyIdKey":"object.accessKeyId",' +
|
|
192
|
+
'"secretAccessKeyKey":"object.secretAccessKey","secretBundleId":"service-storage"},' +
|
|
193
|
+
'"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
|
|
194
|
+
'"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
|
|
195
|
+
'"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
|
|
196
|
+
'"generation":3,"id":"binding-object","kind":"objectStorage",' +
|
|
197
|
+
'"observedGeneration":3,"policy":{"classId":"source-object","revision":"1"},' +
|
|
198
|
+
'"requestDigest":"1111111111111111111111111111111111111111111111111111111111111111",' +
|
|
199
|
+
'"requestId":"object-data","resourceRef":"source-resource","schemaVersion":1,' +
|
|
200
|
+
'"serviceId":"service-app","status":"ready","updatedAt":1700000000001,' +
|
|
201
|
+
'"versioning":false},"capturedAt":1700000000010,"recordRevision":12,' +
|
|
202
|
+
'"schemaVersion":1,"snapshotDigest":' +
|
|
203
|
+
'"35870a0c3ca7f2ee70d0ae7f83109bec23a8ce59bf8efef1c94221a496210439"},' +
|
|
204
|
+
'"target":{"credentials":{"accessKeyIdKey":"object.accessKeyId",' +
|
|
205
|
+
'"secretAccessKeyKey":"object.secretAccessKey","secretBundleId":"service-storage"},' +
|
|
206
|
+
'"policy":{"classId":"capacity-object","revision":"4"},"request":' +
|
|
207
|
+
'{"accessMode":"readWrite","capacity":{"limit":"1TiB","request":"500GiB"},' +
|
|
208
|
+
'"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
|
|
209
|
+
'"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
|
|
210
|
+
'"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
|
|
211
|
+
'"id":"object-data","kind":"objectStorage","reclaimPolicy":"retain",' +
|
|
212
|
+
'"storageClass":"backupCapacity"},"storageClass":{"kind":"objectStorage",' +
|
|
213
|
+
'"purpose":"backup","required":{"backup":true,"durability":"persistent",' +
|
|
214
|
+
'"performanceTier":"capacity"}}},"workloadGeneration":8}',
|
|
215
|
+
sha256:
|
|
216
|
+
'ecbb40ec9bfa20b9f4372eb0d00eaf79c3e84dd3132c5bde7e65ba3fec55e595',
|
|
217
|
+
},
|
|
218
|
+
candidateBinding: {
|
|
219
|
+
input: candidateBinding,
|
|
220
|
+
canonicalJson:
|
|
221
|
+
'{"accessMode":"readWrite","capabilities":{"backup":true,' +
|
|
222
|
+
'"durability":"persistent","encryptedInTransit":true,"hardQuota":true,' +
|
|
223
|
+
'"performanceTier":"capacity","snapshots":"none","topology":"singleNode"},' +
|
|
224
|
+
'"capacity":{"granted":"500GiB","limit":"1TiB","requested":"500GiB"},' +
|
|
225
|
+
'"connection":{"bucket":"destination-bucket",' +
|
|
226
|
+
'"endpoint":"https://destination.example.test","region":"local"},' +
|
|
227
|
+
'"createdAt":1700000000000,"credentials":{"accessKeyIdKey":"object.accessKeyId",' +
|
|
228
|
+
'"secretAccessKeyKey":"object.secretAccessKey","secretBundleId":"service-storage"},' +
|
|
229
|
+
'"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
|
|
230
|
+
'"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
|
|
231
|
+
'"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
|
|
232
|
+
'"generation":4,"id":"binding-object","kind":"objectStorage",' +
|
|
233
|
+
'"observedGeneration":3,"policy":{"classId":"capacity-object","revision":"4"},' +
|
|
234
|
+
'"requestDigest":"2096dfa1f6db50d670cbb4d6436f38c2eec383435c99346e31d0d1a9e0b1beba",' +
|
|
235
|
+
'"requestId":"object-data","resourceRef":"destination-resource",' +
|
|
236
|
+
'"schemaVersion":1,"serviceId":"service-app","status":"provisioning",' +
|
|
237
|
+
'"updatedAt":1700000000020,"versioning":false}',
|
|
238
|
+
sha256:
|
|
239
|
+
'b49017f41cd86626ccb05ffa5fb591994a5e20fad9856182b1a1d4c964c6177c',
|
|
240
|
+
},
|
|
241
|
+
});
|