@serve.zone/interfaces 31.8.0 → 32.0.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/.smartconfig.json +1 -0
- package/changelog.md +512 -0
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/appstore/types.d.ts +4 -6
- package/dist_ts/appstore/types.js +5 -5
- package/dist_ts/data/backup.d.ts +3 -26
- package/dist_ts/data/cluster.d.ts +36 -11
- package/dist_ts/data/cluster.js +33 -22
- package/dist_ts/data/clusteringress.d.ts +8 -0
- package/dist_ts/data/clusteringress.js +13 -8
- package/dist_ts/data/clusternode.d.ts +121 -74
- package/dist_ts/data/clusternode.js +109 -132
- package/dist_ts/data/clusterruntime.d.ts +39 -0
- package/dist_ts/data/clusterruntime.js +11 -0
- package/dist_ts/data/coremail.d.ts +3 -7
- package/dist_ts/data/coremail.js +2 -2
- package/dist_ts/data/coremail.runtime.d.ts +0 -1
- package/dist_ts/data/coremail.runtime.js +5 -22
- package/dist_ts/data/deploymentadoption.d.ts +0 -2
- package/dist_ts/data/deploymentadoption.js +40 -6
- package/dist_ts/data/deploymentoperation.js +16 -3
- package/dist_ts/data/deploymentpreflight.d.ts +0 -2
- package/dist_ts/data/deploymentpreflight.js +1 -1
- package/dist_ts/data/immutableimage.d.ts +38 -21
- package/dist_ts/data/immutableimage.js +45 -5
- package/dist_ts/data/index.d.ts +5 -1
- package/dist_ts/data/index.js +5 -1
- package/dist_ts/data/isolatedrestore.d.ts +139 -21
- package/dist_ts/data/isolatedrestore.golden.d.ts +0 -1
- package/dist_ts/data/isolatedrestore.golden.js +6 -9
- package/dist_ts/data/isolatedrestore.js +176 -40
- package/dist_ts/data/mail.d.ts +1 -1
- package/dist_ts/data/networkaddressplan.d.ts +78 -0
- package/dist_ts/data/networkaddressplan.js +114 -0
- package/dist_ts/data/networkauthority.d.ts +20 -22
- package/dist_ts/data/networkauthority.js +29 -43
- package/dist_ts/data/networkcredential.d.ts +10 -10
- package/dist_ts/data/networkcredential.js +16 -16
- package/dist_ts/data/networkdelivery.d.ts +18 -18
- package/dist_ts/data/networkdelivery.js +16 -16
- package/dist_ts/data/networklease.d.ts +18 -7
- package/dist_ts/data/networklease.js +29 -7
- package/dist_ts/data/networknode.d.ts +37 -0
- package/dist_ts/data/networknode.js +6 -0
- package/dist_ts/data/networkprojection.d.ts +59 -60
- package/dist_ts/data/networkprojection.js +53 -57
- package/dist_ts/data/networkprotection.d.ts +27 -28
- package/dist_ts/data/networkprotection.js +36 -36
- package/dist_ts/data/networkrouter.d.ts +11 -11
- package/dist_ts/data/networkrouter.js +1 -1
- package/dist_ts/data/networksigning.d.ts +16 -18
- package/dist_ts/data/networksigning.js +20 -21
- package/dist_ts/data/nodecredential.d.ts +4 -6
- package/dist_ts/data/nodeenrollment.d.ts +35 -40
- package/dist_ts/data/nodeenrollment.js +57 -72
- package/dist_ts/data/privatenetwork.d.ts +21 -24
- package/dist_ts/data/privatenetwork.js +39 -54
- package/dist_ts/data/runtimeassignment.d.ts +50 -34
- package/dist_ts/data/runtimeassignment.js +79 -45
- package/dist_ts/data/runtimeconfig.d.ts +21 -22
- package/dist_ts/data/runtimeconfig.js +37 -100
- package/dist_ts/data/runtimesession.d.ts +100 -62
- package/dist_ts/data/runtimesession.js +98 -79
- package/dist_ts/data/runtimeterminalreceipt.d.ts +28 -29
- package/dist_ts/data/runtimeterminalreceipt.js +42 -42
- package/dist_ts/data/secret.d.ts +18 -25
- package/dist_ts/data/secret.js +12 -52
- package/dist_ts/data/servicecredential.d.ts +14 -16
- package/dist_ts/data/servicecredential.js +17 -28
- package/dist_ts/data/serviceruntime.d.ts +128 -0
- package/dist_ts/data/serviceruntime.js +92 -0
- package/dist_ts/data/sparknodereport.d.ts +27 -14
- package/dist_ts/data/sparknodereport.js +35 -28
- package/dist_ts/data/webpush.d.ts +0 -1
- package/dist_ts/index.d.ts +2 -1
- package/dist_ts/index.js +3 -2
- package/dist_ts/platform/objectstorageretention.d.ts +21 -24
- package/dist_ts/platform/objectstorageretention.js +6 -18
- package/dist_ts/platform/storage.d.ts +1 -3
- package/dist_ts/platform/storagemigration.d.ts +0 -7
- package/dist_ts/platform/storagemigration.golden.d.ts +0 -1
- package/dist_ts/platform/storagemigration.golden.js +8 -12
- package/dist_ts/platform/storagemigration.js +6 -51
- package/dist_ts/platform/types.d.ts +2 -2
- package/dist_ts/private/canonicaljson.d.ts +9 -1
- package/dist_ts/private/canonicaljson.js +14 -2
- package/dist_ts/private/dataproperties.d.ts +62 -0
- package/dist_ts/private/dataproperties.js +117 -0
- package/dist_ts/private/networkcontract.d.ts +14 -10
- package/dist_ts/private/networkcontract.js +15 -1
- package/dist_ts/private/producercontract.d.ts +11 -0
- package/dist_ts/private/producercontract.js +21 -0
- package/dist_ts/private/releaseversion.d.ts +37 -0
- package/dist_ts/private/releaseversion.js +48 -0
- package/dist_ts/private/runtimepolicy.d.ts +31 -0
- package/dist_ts/private/runtimepolicy.js +90 -0
- package/dist_ts/private/tokenlist.d.ts +9 -0
- package/dist_ts/private/tokenlist.js +23 -0
- package/dist_ts/protocol.d.ts +137 -0
- package/dist_ts/protocol.js +255 -0
- package/dist_ts/requests/admin.d.ts +8 -8
- package/dist_ts/requests/backup.d.ts +102 -112
- package/dist_ts/requests/cluster.d.ts +47 -10
- package/dist_ts/requests/cluster.js +1 -1
- package/dist_ts/requests/clusteringress.d.ts +9 -0
- package/dist_ts/requests/clusteringress.js +1 -1
- package/dist_ts/requests/config.d.ts +3 -3
- package/dist_ts/requests/corestore.d.ts +0 -3
- package/dist_ts/requests/corestore.js +5 -9
- package/dist_ts/requests/network.d.ts +87 -31
- package/dist_ts/requests/node.d.ts +15 -28
- package/dist_ts/requests/pallet.d.ts +13 -13
- package/dist_ts/requests/runtimesession.d.ts +53 -41
- package/dist_ts/requests/secret.d.ts +4 -5
- package/dist_ts/requests/secret.js +1 -5
- package/dist_ts/requests/service.d.ts +60 -0
- package/dist_ts/runtime.corestore.d.ts +56 -74
- package/dist_ts/runtime.corestore.databaseexportpackage.d.ts +30 -36
- package/dist_ts/runtime.corestore.databaseexportpackage.golden.d.ts +11 -12
- package/dist_ts/runtime.corestore.databaseexportpackage.golden.js +54 -71
- package/dist_ts/runtime.corestore.databaseexportpackage.js +9 -25
- package/dist_ts/runtime.corestore.js +35 -135
- package/dist_ts/runtime.corestore.relay.js +2 -7
- package/dist_ts/runtime.d.ts +38 -48
- package/dist_ts/runtime.js +20 -77
- package/dist_ts/runtime.networkprojection.d.ts +4 -4
- package/dist_ts/runtime.networkprojection.js +18 -18
- package/dist_ts/runtime.workloadinit.d.ts +23 -24
- package/dist_ts/runtime.workloadinit.js +6 -13
- package/package.json +2 -2
- package/readme.md +540 -269
- package/ts/00_commitinfo_data.ts +3 -3
- package/ts/appstore/types.ts +4 -6
- package/ts/data/backup.ts +3 -38
- package/ts/data/cluster.ts +51 -34
- package/ts/data/clusteringress.ts +12 -12
- package/ts/data/clusternode.ts +204 -232
- package/ts/data/clusterruntime.ts +45 -0
- package/ts/data/coremail.runtime.ts +4 -21
- package/ts/data/coremail.ts +3 -7
- package/ts/data/deploymentadoption.ts +46 -4
- package/ts/data/deploymentoperation.ts +16 -1
- package/ts/data/deploymentpreflight.ts +0 -2
- package/ts/data/immutableimage.ts +71 -24
- package/ts/data/index.ts +5 -1
- package/ts/data/isolatedrestore.golden.ts +5 -9
- package/ts/data/isolatedrestore.ts +339 -54
- package/ts/data/mail.ts +1 -1
- package/ts/data/networkaddressplan.ts +175 -0
- package/ts/data/networkauthority.ts +45 -61
- package/ts/data/networkcredential.ts +24 -24
- package/ts/data/networkdelivery.ts +27 -27
- package/ts/data/networklease.ts +40 -13
- package/ts/data/networknode.ts +37 -0
- package/ts/data/networkprojection.ts +119 -124
- package/ts/data/networkprotection.ts +54 -55
- package/ts/data/networkrouter.ts +14 -14
- package/ts/data/networksigning.ts +29 -32
- package/ts/data/nodecredential.ts +4 -6
- package/ts/data/nodeenrollment.ts +96 -114
- package/ts/data/privatenetwork.ts +58 -74
- package/ts/data/runtimeassignment.ts +143 -94
- package/ts/data/runtimeconfig.ts +62 -122
- package/ts/data/runtimesession.ts +185 -138
- package/ts/data/runtimeterminalreceipt.ts +72 -73
- package/ts/data/secret.ts +28 -76
- package/ts/data/servicecredential.ts +33 -43
- package/ts/data/serviceruntime.ts +208 -0
- package/ts/data/sparknodereport.ts +48 -36
- package/ts/data/webpush.ts +0 -1
- package/ts/index.ts +2 -0
- package/ts/platform/objectstorageretention.ts +36 -55
- package/ts/platform/storage.ts +1 -3
- package/ts/platform/storagemigration.golden.ts +7 -11
- package/ts/platform/storagemigration.ts +5 -55
- package/ts/platform/types.ts +2 -2
- package/ts/private/canonicaljson.ts +13 -1
- package/ts/private/dataproperties.ts +139 -0
- package/ts/private/networkcontract.ts +23 -9
- package/ts/private/producercontract.ts +19 -0
- package/ts/private/releaseversion.ts +70 -0
- package/ts/private/runtimepolicy.ts +105 -0
- package/ts/private/tokenlist.ts +30 -0
- package/ts/protocol.ts +364 -0
- package/ts/requests/admin.ts +11 -11
- package/ts/requests/backup.ts +112 -117
- package/ts/requests/cluster.ts +58 -13
- package/ts/requests/clusteringress.ts +9 -0
- package/ts/requests/config.ts +3 -3
- package/ts/requests/corestore.ts +4 -16
- package/ts/requests/network.ts +90 -41
- package/ts/requests/node.ts +21 -38
- package/ts/requests/pallet.ts +17 -17
- package/ts/requests/runtimesession.ts +63 -51
- package/ts/requests/secret.ts +5 -10
- package/ts/requests/service.ts +81 -0
- package/ts/runtime.corestore.databaseexportpackage.golden.ts +77 -95
- package/ts/runtime.corestore.databaseexportpackage.ts +51 -73
- package/ts/runtime.corestore.relay.ts +1 -10
- package/ts/runtime.corestore.ts +118 -268
- package/ts/runtime.networkprojection.ts +30 -30
- package/ts/runtime.ts +83 -158
- package/ts/runtime.workloadinit.ts +36 -48
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.d.ts +0 -902
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.d.ts +0 -35
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.js +0 -315
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.js +0 -3315
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.d.ts +0 -291
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.d.ts +0 -30
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.js +0 -408
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.js +0 -1126
- package/ts/runtime.cloudlylegacydeploymentsettlement.golden.ts +0 -421
- package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.ts +0 -510
- package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.ts +0 -2470
- package/ts/runtime.cloudlylegacydeploymentsettlement.ts +0 -6630
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { TSha256Digest } from './immutableimage.js';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import type {
|
|
2
|
+
import type { IRuntimeAssignmentReference, IRuntimeAuthorityReference, IRuntimeController } from './runtimeassignment.js';
|
|
3
|
+
import { snapshotRuntimeAssignment, validateRuntimeAssignment } from './runtimeassignment.js';
|
|
4
|
+
import type { IRuntimeNetworkHandoffLease, IRuntimeNetworkProtectedAuthority } from './networkauthority.js';
|
|
5
|
+
import { bindRuntimeNetworkHandoffLease, computeRuntimeNetworkProtectedAuthorityDigest,
|
|
6
|
+
snapshotRuntimeNetworkHandoffLease, snapshotRuntimeNetworkProtectedAuthority } from './networkauthority.js';
|
|
7
|
+
import type { IPrivateNetwork, IServicePrivateNetworks, IServicePrivateNetworkDnsPolicy } from './privatenetwork.js';
|
|
8
8
|
import { routerPacketGrantsOf, snapshotRouterProjection,
|
|
9
|
-
type
|
|
10
|
-
import {
|
|
11
|
-
|
|
9
|
+
type IRuntimeNetworkRouterPacketGrant, type IRuntimeNetworkRouterProjection } from './networkrouter.js';
|
|
10
|
+
import { buildPrivateNetworkFqdn, composeServicePrivateNetworkDnsPolicy,
|
|
11
|
+
snapshotPrivateNetwork, snapshotServicePrivateNetworks } from './privatenetwork.js';
|
|
12
12
|
import { captureNetwork, failNetwork, networkCanonical, networkContains, networkCounter, networkDigest,
|
|
13
13
|
networkDnsWindow, networkEqual, networkHash, networkId, networkIpv4, networkIpv4Number, networkList, networkMaximumDnsLeaseMs,
|
|
14
14
|
networkOverlaps, networkPrefixBounds, networkRecord, networkReference, networkReferenceOf, networkRevision, networkSafe,
|
|
15
15
|
networkSameScope, networkScope, networkSorted, requireNetwork } from '../private/networkcontract.js';
|
|
16
16
|
|
|
17
|
-
export interface
|
|
18
|
-
controller:
|
|
17
|
+
export interface IRuntimeNetworkNodeScope {
|
|
18
|
+
controller: IRuntimeController;
|
|
19
19
|
nodeId: string;
|
|
20
20
|
runtimeNamespace: string;
|
|
21
21
|
}
|
|
@@ -31,8 +31,7 @@ export interface IRuntimeNetworkDnsWindow {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** Immutable per-attempt address material. Membership and projection revisions are independent. */
|
|
34
|
-
export interface
|
|
35
|
-
schemaVersion: 1;
|
|
34
|
+
export interface IRuntimeNetworkWorkloadLease extends IRuntimeNetworkNodeScope {
|
|
36
35
|
id: string;
|
|
37
36
|
/** Allocation incarnation, not a mutable desired-state revision. */
|
|
38
37
|
generation: number;
|
|
@@ -41,7 +40,7 @@ export interface IRuntimeNetworkWorkloadLeaseV1 extends IRuntimeNetworkNodeScope
|
|
|
41
40
|
serviceId: string;
|
|
42
41
|
replicaId: string;
|
|
43
42
|
attemptId: string;
|
|
44
|
-
protectedAuthority:
|
|
43
|
+
protectedAuthority: IRuntimeAuthorityReference;
|
|
45
44
|
routerIncarnationId: string;
|
|
46
45
|
ipv4: {
|
|
47
46
|
poolId: string;
|
|
@@ -61,7 +60,7 @@ export interface IRuntimeNetworkWorkloadLeaseV1 extends IRuntimeNetworkNodeScope
|
|
|
61
60
|
* One node-level published port for a workload. Mirrors `IAppStorePublishedPort`
|
|
62
61
|
* without range fields: the runtime publishes exactly one host port per entry.
|
|
63
62
|
*/
|
|
64
|
-
export interface
|
|
63
|
+
export interface IRuntimeNetworkPublishedPort {
|
|
65
64
|
protocol: 'tcp' | 'udp';
|
|
66
65
|
/** 1..65535 and unique per node across the projection for its protocol. */
|
|
67
66
|
hostPort: number;
|
|
@@ -77,49 +76,47 @@ export interface IRuntimeNetworkPublishedPortV1 {
|
|
|
77
76
|
* The Cloudly decision that authorized this port. It is covered by the
|
|
78
77
|
* projection signature, and a published port without it cannot exist.
|
|
79
78
|
*/
|
|
80
|
-
authorization:
|
|
79
|
+
authorization: IRuntimeAuthorityReference;
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
/**
|
|
84
|
-
* Caller-authored published-port request.
|
|
83
|
+
* Caller-authored published-port request. It carries no `hostIp` (an omitted
|
|
85
84
|
* address means the node uplink) and no ranges: exactly one host port per entry.
|
|
86
85
|
* The `authorization` reference of the resulting projection entry is derived by
|
|
87
86
|
* Cloudly from the policy revision and digest, never supplied by the caller.
|
|
88
87
|
*/
|
|
89
|
-
export interface
|
|
88
|
+
export interface IRuntimeNetworkPublishedPortRequest {
|
|
90
89
|
protocol: 'tcp' | 'udp';
|
|
91
90
|
hostPort: number;
|
|
92
91
|
targetPort: number;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
/** Current authorized published-port policy for one service. */
|
|
96
|
-
export interface
|
|
97
|
-
schemaVersion: 1;
|
|
95
|
+
export interface IServicePublishedPorts {
|
|
98
96
|
organizationId: string;
|
|
99
97
|
serviceId: string;
|
|
100
98
|
revision: number;
|
|
101
99
|
/** Sorted by protocol and host port. Empty means the service publishes nothing. */
|
|
102
|
-
publishedPorts:
|
|
100
|
+
publishedPorts: IRuntimeNetworkPublishedPortRequest[];
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
/** Exact desired policy. Node-level host-port placement remains Cloudly's decision. */
|
|
106
|
-
export interface
|
|
107
|
-
schemaVersion: 1;
|
|
104
|
+
export interface ISetServicePublishedPorts {
|
|
108
105
|
organizationId: string;
|
|
109
106
|
serviceId: string;
|
|
110
107
|
/** Retain the exact body and this identifier across retries. */
|
|
111
108
|
mutationId: string;
|
|
112
109
|
/** null means the service has never had a published-port document; not an empty list. */
|
|
113
110
|
expectedRevision: number | null;
|
|
114
|
-
publishedPorts:
|
|
111
|
+
publishedPorts: IRuntimeNetworkPublishedPortRequest[];
|
|
115
112
|
}
|
|
116
113
|
|
|
117
114
|
/** Controller-owned readiness evidence. A signature does not prove this evidence's provenance. */
|
|
118
|
-
export interface
|
|
119
|
-
lease:
|
|
115
|
+
export interface IRuntimeNetworkEndpoint {
|
|
116
|
+
lease: IRuntimeNetworkWorkloadLease;
|
|
120
117
|
ready: boolean;
|
|
121
118
|
observation: {
|
|
122
|
-
assignment:
|
|
119
|
+
assignment: IRuntimeAssignmentReference;
|
|
123
120
|
reporterSessionId: string;
|
|
124
121
|
sequence: number;
|
|
125
122
|
digest: TSha256Digest;
|
|
@@ -128,53 +125,55 @@ export interface IRuntimeNetworkEndpointV1 {
|
|
|
128
125
|
publicEgress: boolean;
|
|
129
126
|
platformEndpointIds: string[];
|
|
130
127
|
/** Sorted by protocol and host port. Absent publishes nothing; a present member is never empty. */
|
|
131
|
-
publishedPorts?:
|
|
128
|
+
publishedPorts?: IRuntimeNetworkPublishedPort[];
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
/** Exact directed grant identity; receiver-owned realization resolves the lease to kernel facts. */
|
|
135
|
-
export interface
|
|
136
|
-
source:
|
|
132
|
+
export interface IRuntimeNetworkPacketGrant {
|
|
133
|
+
source: IRuntimeAuthorityReference;
|
|
137
134
|
destination:
|
|
138
|
-
| { kind: 'workload'; lease:
|
|
135
|
+
| { kind: 'workload'; lease: IRuntimeAuthorityReference }
|
|
139
136
|
| { kind: 'public' }
|
|
140
137
|
| { kind: 'platform'; id: string; address: string; protocol: 'tcp' | 'udp'; port: number };
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
export interface
|
|
144
|
-
schemaVersion: 1;
|
|
140
|
+
export interface IRuntimeNetworkProjection extends IRuntimeNetworkNodeScope {
|
|
145
141
|
id: string;
|
|
146
142
|
generation: number;
|
|
147
|
-
previous:
|
|
148
|
-
protectedAuthority:
|
|
143
|
+
previous: IRuntimeAuthorityReference | null;
|
|
144
|
+
protectedAuthority: IRuntimeNetworkProtectedAuthority;
|
|
149
145
|
/** Exact historical authorities needed to authenticate retained allocation material. */
|
|
150
|
-
allocationAuthorities:
|
|
151
|
-
handoff:
|
|
146
|
+
allocationAuthorities: IRuntimeNetworkProtectedAuthority[];
|
|
147
|
+
handoff: IRuntimeNetworkHandoffLease | null;
|
|
152
148
|
/** COMPLETE relevant definitions, including declared names with no ready replicas. */
|
|
153
|
-
networks:
|
|
154
|
-
memberships:
|
|
155
|
-
endpoints:
|
|
149
|
+
networks: IPrivateNetwork[];
|
|
150
|
+
memberships: IServicePrivateNetworks[];
|
|
151
|
+
endpoints: IRuntimeNetworkEndpoint[];
|
|
156
152
|
dns: IRuntimeNetworkDnsWindow;
|
|
157
153
|
/** Explicit denial intent. Carry until the exact predecessor's application is proven. */
|
|
158
|
-
withdrawals:
|
|
159
|
-
retiredLeases:
|
|
160
|
-
retiredHandoffs:
|
|
161
|
-
/**
|
|
162
|
-
|
|
154
|
+
withdrawals: IRuntimeNetworkPacketGrant[];
|
|
155
|
+
retiredLeases: IRuntimeAuthorityReference[];
|
|
156
|
+
retiredHandoffs: IRuntimeAuthorityReference[];
|
|
157
|
+
/**
|
|
158
|
+
* Omitted when the issuer selects no router-origin egress; its absence keeps the
|
|
159
|
+
* projection's canonical bytes and grants no router-origin flows.
|
|
160
|
+
*/
|
|
161
|
+
router?: IRuntimeNetworkRouterProjection;
|
|
163
162
|
digest: TSha256Digest;
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
export interface
|
|
167
|
-
source:
|
|
165
|
+
export interface IRuntimeNetworkDnsView {
|
|
166
|
+
source: IRuntimeAuthorityReference;
|
|
168
167
|
sourceAddress: string;
|
|
169
168
|
dnsServer: string;
|
|
170
|
-
policy:
|
|
169
|
+
policy: IServicePrivateNetworkDnsPolicy;
|
|
171
170
|
/** Sorted complete A sets; [] is declared NODATA, never an omitted name. AAAA is NODATA. */
|
|
172
171
|
records: Array<{ name: string; addresses: string[] }>;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
export const
|
|
176
|
-
workloadDigestDomain: 'serve.zone/runtime-network-workload-lease
|
|
177
|
-
projectionDigestDomain: 'serve.zone/runtime-network-projection
|
|
174
|
+
export const runtimeNetworkProjectionContract = Object.freeze({
|
|
175
|
+
workloadDigestDomain: 'serve.zone/runtime-network-workload-lease',
|
|
176
|
+
projectionDigestDomain: 'serve.zone/runtime-network-projection',
|
|
178
177
|
maximumCanonicalBytes: 917_504,
|
|
179
178
|
maximumAllocationAuthorities: 16,
|
|
180
179
|
maximumNetworks: 128,
|
|
@@ -193,19 +192,18 @@ export const runtimeNetworkProjectionV1Contract = Object.freeze({
|
|
|
193
192
|
} as const);
|
|
194
193
|
|
|
195
194
|
const ownerKey = (value: { organizationId: string; serviceId: string }): string => networkCanonical([value.organizationId, value.serviceId]);
|
|
196
|
-
const attemptKey = (value:
|
|
195
|
+
const attemptKey = (value: IRuntimeNetworkWorkloadLease): string =>
|
|
197
196
|
networkCanonical([value.organizationId, value.serviceId, value.replicaId, value.attemptId]);
|
|
198
|
-
const refKey = (value:
|
|
199
|
-
const sortedReferences = (value: unknown):
|
|
197
|
+
const refKey = (value: IRuntimeAuthorityReference): string => networkCanonical(networkReferenceOf(value));
|
|
198
|
+
const sortedReferences = (value: unknown): IRuntimeAuthorityReference[] =>
|
|
200
199
|
networkSorted(networkList(value, 256, networkReference), refKey);
|
|
201
200
|
|
|
202
|
-
export const
|
|
201
|
+
export const snapshotRuntimeNetworkNodeScope = (value: unknown): IRuntimeNetworkNodeScope => networkSafe(() =>
|
|
203
202
|
networkScope(networkRecord(captureNetwork(value), ['controller', 'nodeId', 'runtimeNamespace'])));
|
|
204
203
|
|
|
205
|
-
export const
|
|
206
|
-
const item = networkRecord(captureNetwork(value), ['
|
|
204
|
+
export const snapshotRuntimeNetworkWorkloadLease = (value: unknown): IRuntimeNetworkWorkloadLease => networkSafe(() => {
|
|
205
|
+
const item = networkRecord(captureNetwork(value), ['id', 'generation', 'controller', 'nodeId', 'runtimeNamespace',
|
|
207
206
|
'organizationId', 'assignmentId', 'serviceId', 'replicaId', 'attemptId', 'protectedAuthority', 'routerIncarnationId', 'ipv4', 'dnsServer', 'digest']);
|
|
208
|
-
requireNetwork(item.schemaVersion === 1);
|
|
209
207
|
const ip = networkRecord(item.ipv4, ['poolId', 'linkSubnet', 'address', 'sourcePrefix', 'gateway']);
|
|
210
208
|
requireNetwork(typeof ip.linkSubnet === 'string' && ip.linkSubnet.length <= 18);
|
|
211
209
|
const pieces = ip.linkSubnet.split('/');
|
|
@@ -220,17 +218,17 @@ export const snapshotRuntimeNetworkWorkloadLeaseV1 = (value: unknown): IRuntimeN
|
|
|
220
218
|
requireNetwork(number >= low && number <= high && (high - low === 1 || (number !== low && number !== high)));
|
|
221
219
|
}
|
|
222
220
|
requireNetwork(item.dnsServer === gateway);
|
|
223
|
-
return {
|
|
221
|
+
return { id: networkId(item.id), generation: networkCounter(item.generation), ...networkScope(item),
|
|
224
222
|
organizationId: networkId(item.organizationId), assignmentId: networkId(item.assignmentId), serviceId: networkId(item.serviceId),
|
|
225
223
|
replicaId: networkId(item.replicaId), attemptId: networkId(item.attemptId), protectedAuthority: networkReference(item.protectedAuthority),
|
|
226
224
|
routerIncarnationId: networkId(item.routerIncarnationId), ipv4: { poolId: networkId(ip.poolId), linkSubnet: ip.linkSubnet,
|
|
227
225
|
address, sourcePrefix: ip.sourcePrefix, gateway }, dnsServer: gateway, digest: networkDigest(item.digest) };
|
|
228
226
|
});
|
|
229
227
|
|
|
230
|
-
export const
|
|
231
|
-
networkHash(
|
|
228
|
+
export const computeRuntimeNetworkWorkloadLeaseDigest = (value: IRuntimeNetworkWorkloadLease): Promise<TSha256Digest> =>
|
|
229
|
+
networkHash(runtimeNetworkProjectionContract.workloadDigestDomain, snapshotRuntimeNetworkWorkloadLease(value));
|
|
232
230
|
|
|
233
|
-
const packetGrant = (value: unknown):
|
|
231
|
+
const packetGrant = (value: unknown): IRuntimeNetworkPacketGrant => {
|
|
234
232
|
const item = networkRecord(value, ['source', 'destination']);
|
|
235
233
|
requireNetwork(item.destination !== null && typeof item.destination === 'object');
|
|
236
234
|
const kind = (item.destination as Record<string, unknown>).kind;
|
|
@@ -251,7 +249,7 @@ const packetGrant = (value: unknown): IRuntimeNetworkPacketGrantV1 => {
|
|
|
251
249
|
};
|
|
252
250
|
const publishedPortKey = (value: { protocol: 'tcp' | 'udp'; hostPort: number }): string =>
|
|
253
251
|
`${value.protocol}/${String(value.hostPort).padStart(5, '0')}`;
|
|
254
|
-
const publishedPort = (value: unknown):
|
|
252
|
+
const publishedPort = (value: unknown): IRuntimeNetworkPublishedPort => {
|
|
255
253
|
const hasHostIp = value !== null && typeof value === 'object' && Object.hasOwn(value, 'hostIp');
|
|
256
254
|
const item = networkRecord(value, ['protocol', 'hostPort', 'targetPort', 'authorization', ...(hasHostIp ? ['hostIp'] : [])]);
|
|
257
255
|
requireNetwork(item.protocol === 'tcp' || item.protocol === 'udp');
|
|
@@ -260,41 +258,39 @@ const publishedPort = (value: unknown): IRuntimeNetworkPublishedPortV1 => {
|
|
|
260
258
|
return { protocol: item.protocol, hostPort: networkCounter(item.hostPort, 65535), targetPort: networkCounter(item.targetPort, 65535),
|
|
261
259
|
...(hostIp === null ? {} : { hostIp }), authorization: networkReference(item.authorization) };
|
|
262
260
|
};
|
|
263
|
-
const publishedPorts = (value: unknown):
|
|
261
|
+
const publishedPorts = (value: unknown): IRuntimeNetworkPublishedPort[] => {
|
|
264
262
|
const ports = networkSorted(networkList(value, 64, publishedPort), publishedPortKey);
|
|
265
263
|
requireNetwork(ports.length > 0); return ports;
|
|
266
264
|
};
|
|
267
|
-
const publishedPortRequest = (value: unknown):
|
|
265
|
+
const publishedPortRequest = (value: unknown): IRuntimeNetworkPublishedPortRequest => {
|
|
268
266
|
const item = networkRecord(value, ['protocol', 'hostPort', 'targetPort']);
|
|
269
267
|
requireNetwork(item.protocol === 'tcp' || item.protocol === 'udp');
|
|
270
268
|
return { protocol: item.protocol, hostPort: networkCounter(item.hostPort, 65535), targetPort: networkCounter(item.targetPort, 65535) };
|
|
271
269
|
};
|
|
272
|
-
const publishedPortRequests = (value: unknown):
|
|
270
|
+
const publishedPortRequests = (value: unknown): IRuntimeNetworkPublishedPortRequest[] =>
|
|
273
271
|
networkSorted(networkList(value, 64, publishedPortRequest), publishedPortKey);
|
|
274
272
|
|
|
275
273
|
/** Structural snapshot only; node placement, quota and authorization remain Cloudly's decision. */
|
|
276
|
-
export const
|
|
277
|
-
const item = networkRecord(value, ['
|
|
278
|
-
|
|
279
|
-
return { schemaVersion: 1, organizationId: networkId(item.organizationId), serviceId: networkId(item.serviceId),
|
|
274
|
+
export const snapshotServicePublishedPorts = (value: unknown): IServicePublishedPorts => networkSafe(() => {
|
|
275
|
+
const item = networkRecord(value, ['organizationId', 'serviceId', 'revision', 'publishedPorts']);
|
|
276
|
+
return { organizationId: networkId(item.organizationId), serviceId: networkId(item.serviceId),
|
|
280
277
|
revision: networkCounter(item.revision), publishedPorts: publishedPortRequests(item.publishedPorts) };
|
|
281
278
|
});
|
|
282
279
|
|
|
283
|
-
export const
|
|
284
|
-
const item = networkRecord(value, ['
|
|
285
|
-
|
|
286
|
-
return { schemaVersion: 1, organizationId: networkId(item.organizationId), serviceId: networkId(item.serviceId),
|
|
280
|
+
export const snapshotSetServicePublishedPorts = (value: unknown): ISetServicePublishedPorts => networkSafe(() => {
|
|
281
|
+
const item = networkRecord(value, ['organizationId', 'serviceId', 'mutationId', 'expectedRevision', 'publishedPorts']);
|
|
282
|
+
return { organizationId: networkId(item.organizationId), serviceId: networkId(item.serviceId),
|
|
287
283
|
mutationId: networkId(item.mutationId), expectedRevision: item.expectedRevision === null ? null : networkCounter(item.expectedRevision),
|
|
288
284
|
publishedPorts: publishedPortRequests(item.publishedPorts) };
|
|
289
285
|
});
|
|
290
286
|
|
|
291
|
-
const endpoint = (value: unknown):
|
|
287
|
+
const endpoint = (value: unknown): IRuntimeNetworkEndpoint => {
|
|
292
288
|
const hasPublishedPorts = value !== null && typeof value === 'object' && Object.hasOwn(value, 'publishedPorts');
|
|
293
289
|
const item = networkRecord(value, ['lease', 'ready', 'observation', 'publicEgress', 'platformEndpointIds',
|
|
294
290
|
...(hasPublishedPorts ? ['publishedPorts'] : [])]);
|
|
295
291
|
requireNetwork(typeof item.ready === 'boolean' && typeof item.publicEgress === 'boolean');
|
|
296
|
-
const lease =
|
|
297
|
-
let observation:
|
|
292
|
+
const lease = snapshotRuntimeNetworkWorkloadLease(item.lease);
|
|
293
|
+
let observation: IRuntimeNetworkEndpoint['observation'] = null;
|
|
298
294
|
if (item.observation !== null) {
|
|
299
295
|
const observed = networkRecord(item.observation, ['assignment', 'reporterSessionId', 'sequence', 'digest']);
|
|
300
296
|
const assignment = networkRecord(observed.assignment, ['assignmentId', 'generation', 'digest']);
|
|
@@ -309,30 +305,29 @@ const endpoint = (value: unknown): IRuntimeNetworkEndpointV1 => {
|
|
|
309
305
|
};
|
|
310
306
|
|
|
311
307
|
/** Structural snapshot only; use validate/signature/admission helpers before accepting authority. */
|
|
312
|
-
export const
|
|
308
|
+
export const snapshotRuntimeNetworkProjection = (value: unknown): IRuntimeNetworkProjection => networkSafe(() => {
|
|
313
309
|
const captured = captureNetwork(value);
|
|
314
|
-
requireNetwork(new TextEncoder().encode(networkCanonical(captured)).length <=
|
|
310
|
+
requireNetwork(new TextEncoder().encode(networkCanonical(captured)).length <= runtimeNetworkProjectionContract.maximumCanonicalBytes);
|
|
315
311
|
const hasRouter = captured !== null && typeof captured === 'object' && Object.hasOwn(captured, 'router');
|
|
316
|
-
const item = networkRecord(captured, ['
|
|
312
|
+
const item = networkRecord(captured, ['id', 'generation', 'previous', 'controller', 'nodeId', 'runtimeNamespace',
|
|
317
313
|
'protectedAuthority', 'allocationAuthorities', 'handoff', 'networks', 'memberships', 'endpoints', 'dns', 'withdrawals', 'retiredLeases', 'retiredHandoffs', 'digest',
|
|
318
314
|
...(hasRouter ? ['router'] : [])]);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
memberships: networkSorted(networkList(item.memberships, 256, snapshotServicePrivateNetworksV1), ownerKey),
|
|
315
|
+
return { ...networkRevision(item), ...networkScope(item),
|
|
316
|
+
protectedAuthority: snapshotRuntimeNetworkProtectedAuthority(item.protectedAuthority),
|
|
317
|
+
allocationAuthorities: networkSorted(networkList(item.allocationAuthorities, 16, snapshotRuntimeNetworkProtectedAuthority), refKey),
|
|
318
|
+
handoff: item.handoff === null ? null : snapshotRuntimeNetworkHandoffLease(item.handoff),
|
|
319
|
+
networks: networkSorted(networkList(item.networks, 128, snapshotPrivateNetwork), value => value.id),
|
|
320
|
+
memberships: networkSorted(networkList(item.memberships, 256, snapshotServicePrivateNetworks), ownerKey),
|
|
326
321
|
endpoints: networkSorted(networkList(item.endpoints, 256, endpoint), value => value.lease.id), dns: networkDnsWindow(item.dns),
|
|
327
322
|
withdrawals: networkSorted(networkList(item.withdrawals, 4096, packetGrant), networkCanonical),
|
|
328
323
|
...(hasRouter ? { router: snapshotRouterProjection(item.router) } : {}),
|
|
329
324
|
retiredLeases: sortedReferences(item.retiredLeases), retiredHandoffs: sortedReferences(item.retiredHandoffs), digest: networkDigest(item.digest) };
|
|
330
325
|
});
|
|
331
326
|
|
|
332
|
-
const grantsOf = (projection:
|
|
333
|
-
const result:
|
|
327
|
+
const grantsOf = (projection: IRuntimeNetworkProjection): IRuntimeNetworkPacketGrant[] => {
|
|
328
|
+
const result: IRuntimeNetworkPacketGrant[] = [];
|
|
334
329
|
const memberships = new Map(projection.memberships.map(member => [ownerKey(member), member]));
|
|
335
|
-
const append = (grant:
|
|
330
|
+
const append = (grant: IRuntimeNetworkPacketGrant) => {
|
|
336
331
|
requireNetwork(result.length < 4096); result.push(grant);
|
|
337
332
|
};
|
|
338
333
|
for (const source of projection.endpoints) {
|
|
@@ -355,26 +350,26 @@ const grantsOf = (projection: IRuntimeNetworkProjectionV1): IRuntimeNetworkPacke
|
|
|
355
350
|
return result.sort((left, right) => networkCanonical(left) < networkCanonical(right) ? -1 : 1);
|
|
356
351
|
};
|
|
357
352
|
|
|
358
|
-
export const
|
|
359
|
-
networkHash(
|
|
353
|
+
export const computeRuntimeNetworkProjectionDigest = (value: IRuntimeNetworkProjection): Promise<TSha256Digest> =>
|
|
354
|
+
networkHash(runtimeNetworkProjectionContract.projectionDigestDomain, snapshotRuntimeNetworkProjection(value));
|
|
360
355
|
|
|
361
356
|
/** Complete structural, digest, allocation and policy binding. Not an allocation/barrier/readiness proof. */
|
|
362
|
-
export const
|
|
357
|
+
export const validateRuntimeNetworkProjection = async (value: unknown): Promise<IRuntimeNetworkProjection> => {
|
|
363
358
|
try {
|
|
364
|
-
const projection =
|
|
359
|
+
const projection = snapshotRuntimeNetworkProjection(value), current = projection.protectedAuthority;
|
|
365
360
|
requireNetwork(networkEqual(current.controller, projection.controller) && current.egressAuthorities.some(owner =>
|
|
366
361
|
owner.nodeId === projection.nodeId && owner.runtimeNamespace === projection.runtimeNamespace));
|
|
367
362
|
const authorities = [current, ...projection.allocationAuthorities];
|
|
368
363
|
requireNetwork(new Set(authorities.map(refKey)).size === authorities.length);
|
|
369
364
|
for (const authority of authorities) {
|
|
370
365
|
requireNetwork(networkEqual(authority.controller, projection.controller)
|
|
371
|
-
&& authority.digest === await
|
|
366
|
+
&& authority.digest === await computeRuntimeNetworkProtectedAuthorityDigest(authority));
|
|
372
367
|
}
|
|
373
|
-
const allocationAuthority = (reference:
|
|
368
|
+
const allocationAuthority = (reference: IRuntimeAuthorityReference) => {
|
|
374
369
|
const result = authorities.find(authority => networkEqual(networkReferenceOf(authority), reference)); requireNetwork(result); return result;
|
|
375
370
|
};
|
|
376
371
|
if (projection.handoff !== null) {
|
|
377
|
-
await
|
|
372
|
+
await bindRuntimeNetworkHandoffLease(projection.handoff, allocationAuthority(projection.handoff.protectedAuthority));
|
|
378
373
|
requireNetwork(networkSameScope(projection.handoff, projection));
|
|
379
374
|
requireNetwork(current.pools.some(pool => pool.id === projection.handoff!.transit.poolId && pool.purpose === 'transit'
|
|
380
375
|
&& networkContains(pool.prefix, projection.handoff!.transit.prefix)));
|
|
@@ -394,9 +389,9 @@ export const validateRuntimeNetworkProjectionV1 = async (value: unknown): Promis
|
|
|
394
389
|
}
|
|
395
390
|
const members = new Map(projection.memberships.map(member => [ownerKey(member), member])), aliases = new Set<string>();
|
|
396
391
|
for (const member of projection.memberships) {
|
|
397
|
-
|
|
392
|
+
composeServicePrivateNetworkDnsPolicy(member, member.attachments.map(attachment => networks.get(attachment.networkId)));
|
|
398
393
|
for (const attachment of member.attachments) for (const alias of attachment.aliases) {
|
|
399
|
-
const name =
|
|
394
|
+
const name = buildPrivateNetworkFqdn(networks.get(attachment.networkId), alias);
|
|
400
395
|
requireNetwork(!aliases.has(name)); aliases.add(name);
|
|
401
396
|
}
|
|
402
397
|
}
|
|
@@ -410,7 +405,7 @@ export const validateRuntimeNetworkProjectionV1 = async (value: unknown): Promis
|
|
|
410
405
|
const replica = networkCanonical([lease.organizationId, lease.serviceId, lease.replicaId]);
|
|
411
406
|
requireNetwork(!readyReplicas.has(replica)); readyReplicas.add(replica);
|
|
412
407
|
}
|
|
413
|
-
requireNetwork(lease.digest === await
|
|
408
|
+
requireNetwork(lease.digest === await computeRuntimeNetworkWorkloadLeaseDigest(lease));
|
|
414
409
|
requireNetwork(authority.egressAuthorities.some(owner => owner.nodeId === lease.nodeId && owner.runtimeNamespace === lease.runtimeNamespace)
|
|
415
410
|
&& current.egressAuthorities.some(owner => owner.nodeId === lease.nodeId && owner.runtimeNamespace === lease.runtimeNamespace));
|
|
416
411
|
for (const protection of [authority, current]) requireNetwork(protection.pools.some(pool =>
|
|
@@ -431,27 +426,27 @@ export const validateRuntimeNetworkProjectionV1 = async (value: unknown): Promis
|
|
|
431
426
|
requireNetwork(projection.withdrawals.every(grant => !grants.has(networkCanonical(grant))));
|
|
432
427
|
const routerGrants = new Set(routerPacketGrantsOf(projection).map(networkCanonical));
|
|
433
428
|
requireNetwork((projection.router?.withdrawals ?? []).every(grant => !routerGrants.has(networkCanonical(grant))));
|
|
434
|
-
requireNetwork(projection.digest === await
|
|
429
|
+
requireNetwork(projection.digest === await computeRuntimeNetworkProjectionDigest(projection));
|
|
435
430
|
return projection;
|
|
436
431
|
} catch { return failNetwork(); }
|
|
437
432
|
};
|
|
438
433
|
|
|
439
434
|
/** Complete directed full-mesh and explicitly authorized egress; no DNS readiness dependency. */
|
|
440
|
-
export const
|
|
441
|
-
grantsOf(await
|
|
435
|
+
export const getRuntimeNetworkProjectionPacketGrants = async (value: unknown): Promise<IRuntimeNetworkPacketGrant[]> =>
|
|
436
|
+
grantsOf(await validateRuntimeNetworkProjection(value));
|
|
442
437
|
|
|
443
438
|
/** Router-origin authority comes only from explicit signed selections, never DNS names or workload grants. */
|
|
444
|
-
export const
|
|
445
|
-
routerPacketGrantsOf(await
|
|
439
|
+
export const getRuntimeNetworkProjectionRouterPacketGrants = async (value: unknown): Promise<IRuntimeNetworkRouterPacketGrant[]> =>
|
|
440
|
+
routerPacketGrantsOf(await validateRuntimeNetworkProjection(value));
|
|
446
441
|
|
|
447
442
|
/** Complete offline DNS material, including authorized names never previously queried. */
|
|
448
443
|
/** Select exact local receivers before expansion; all targets still come from
|
|
449
444
|
* the complete validated projection. Selection supplies no attachment authority. */
|
|
450
|
-
export const
|
|
451
|
-
value: unknown, sourcesValue?: readonly
|
|
452
|
-
): Promise<
|
|
445
|
+
export const composeRuntimeNetworkProjectionDnsViews = async (
|
|
446
|
+
value: unknown, sourcesValue?: readonly IRuntimeAuthorityReference[],
|
|
447
|
+
): Promise<IRuntimeNetworkDnsView[]> => {
|
|
453
448
|
const selected = sourcesValue === undefined ? null : networkList(captureNetwork(sourcesValue), 256, networkReference);
|
|
454
|
-
const projection = await
|
|
449
|
+
const projection = await validateRuntimeNetworkProjection(value);
|
|
455
450
|
const local = projection.endpoints.filter(endpoint => networkSameScope(endpoint.lease, projection));
|
|
456
451
|
if (selected !== null) {
|
|
457
452
|
requireNetwork(new Set(selected.map(source => source.id)).size === selected.length);
|
|
@@ -461,15 +456,15 @@ export const composeRuntimeNetworkProjectionDnsViewsV1 = async (
|
|
|
461
456
|
const members = new Map(projection.memberships.map(member => [ownerKey(member), member]));
|
|
462
457
|
return local.filter(endpoint => selected === null || selected.some(source => networkEqual(networkReferenceOf(endpoint.lease), source))).map(endpoint => {
|
|
463
458
|
const member = members.get(ownerKey(endpoint.lease))!;
|
|
464
|
-
const policy =
|
|
465
|
-
const records:
|
|
459
|
+
const policy = composeServicePrivateNetworkDnsPolicy(member, member.attachments.map(attachment => networks.get(attachment.networkId)));
|
|
460
|
+
const records: IRuntimeNetworkDnsView['records'] = [];
|
|
466
461
|
for (const target of projection.memberships) {
|
|
467
462
|
if (target.organizationId !== member.organizationId) continue;
|
|
468
463
|
const addresses = projection.endpoints.filter(candidate => candidate.ready && ownerKey(candidate.lease) === ownerKey(target))
|
|
469
464
|
.map(candidate => candidate.lease.ipv4.address).sort();
|
|
470
465
|
for (const attachment of target.attachments) {
|
|
471
466
|
if (!member.attachments.some(own => own.networkId === attachment.networkId)) continue;
|
|
472
|
-
for (const alias of attachment.aliases) records.push({ name:
|
|
467
|
+
for (const alias of attachment.aliases) records.push({ name: buildPrivateNetworkFqdn(networks.get(attachment.networkId), alias), addresses: [...addresses] });
|
|
473
468
|
}
|
|
474
469
|
}
|
|
475
470
|
records.sort((left, right) => left.name < right.name ? -1 : 1);
|
|
@@ -478,14 +473,14 @@ export const composeRuntimeNetworkProjectionDnsViewsV1 = async (
|
|
|
478
473
|
};
|
|
479
474
|
|
|
480
475
|
/** Bind immutable address material without a circular assignment-digest dependency. */
|
|
481
|
-
export const
|
|
476
|
+
export const bindRuntimeNetworkWorkloadLeaseToAssignment = async (leaseValue: unknown, assignmentValue: unknown): Promise<IRuntimeNetworkWorkloadLease> => {
|
|
482
477
|
try {
|
|
483
|
-
const lease =
|
|
484
|
-
requireNetwork((await
|
|
478
|
+
const lease = snapshotRuntimeNetworkWorkloadLease(leaseValue), assignment = snapshotRuntimeAssignment(assignmentValue);
|
|
479
|
+
requireNetwork((await validateRuntimeAssignment(assignment)).length === 0 && networkSameScope(lease, assignment)
|
|
485
480
|
&& lease.organizationId === assignment.organizationId && lease.assignmentId === assignment.assignmentId
|
|
486
481
|
&& lease.serviceId === assignment.serviceId && lease.replicaId === assignment.replicaId && lease.attemptId === assignment.attemptId
|
|
487
482
|
&& networkEqual(networkReferenceOf(lease), assignment.workload.network)
|
|
488
|
-
&& lease.digest === await
|
|
483
|
+
&& lease.digest === await computeRuntimeNetworkWorkloadLeaseDigest(lease));
|
|
489
484
|
return lease;
|
|
490
485
|
} catch { return failNetwork(); }
|
|
491
486
|
};
|
|
@@ -495,16 +490,16 @@ export const bindRuntimeNetworkWorkloadLeaseToAssignmentV1 = async (leaseValue:
|
|
|
495
490
|
* joined application receipt, never an incoming ACK field. All prior accepted
|
|
496
491
|
* material/apply journals survive until effects and DNS/allocation quarantine end.
|
|
497
492
|
*/
|
|
498
|
-
export const
|
|
493
|
+
export const admitRuntimeNetworkProjection = async (
|
|
499
494
|
value: unknown, previousValue: unknown | null, trustedScopeValue: unknown, appliedPreviousValue: unknown | null,
|
|
500
|
-
): Promise<{ status: 'accepted' | 'replay'; projection:
|
|
495
|
+
): Promise<{ status: 'accepted' | 'replay'; projection: IRuntimeNetworkProjection }> => {
|
|
501
496
|
try {
|
|
502
497
|
// Snapshot ALL caller-owned inputs before the first asynchronous operation.
|
|
503
|
-
const incoming =
|
|
504
|
-
const previousInput = previousValue === null ? null :
|
|
505
|
-
const trusted =
|
|
498
|
+
const incoming = snapshotRuntimeNetworkProjection(value);
|
|
499
|
+
const previousInput = previousValue === null ? null : snapshotRuntimeNetworkProjection(previousValue);
|
|
500
|
+
const trusted = snapshotRuntimeNetworkNodeScope(trustedScopeValue);
|
|
506
501
|
const applied = appliedPreviousValue === null ? null : networkReference(captureNetwork(appliedPreviousValue));
|
|
507
|
-
const projection = await
|
|
502
|
+
const projection = await validateRuntimeNetworkProjection(incoming);
|
|
508
503
|
requireNetwork(networkSameScope(projection, trusted));
|
|
509
504
|
if (previousInput === null) {
|
|
510
505
|
requireNetwork(projection.generation === 1 && applied === null && projection.withdrawals.length === 0
|
|
@@ -512,7 +507,7 @@ export const admitRuntimeNetworkProjectionV1 = async (
|
|
|
512
507
|
&& projection.retiredLeases.length === 0 && projection.retiredHandoffs.length === 0);
|
|
513
508
|
return { status: 'accepted', projection };
|
|
514
509
|
}
|
|
515
|
-
const previous = await
|
|
510
|
+
const previous = await validateRuntimeNetworkProjection(previousInput);
|
|
516
511
|
requireNetwork(networkSameScope(previous, trusted) && previous.id === projection.id);
|
|
517
512
|
requireNetwork(applied === null || networkEqual(applied, networkReferenceOf(previous)));
|
|
518
513
|
if (projection.generation === previous.generation) {
|
|
@@ -548,7 +543,7 @@ export const admitRuntimeNetworkProjectionV1 = async (
|
|
|
548
543
|
const knownHandoffs = [...(previous.handoff ? [networkReferenceOf(previous.handoff)] : []), ...previous.retiredHandoffs];
|
|
549
544
|
requireNetwork(projection.retiredLeases.every(retired => knownLeases.some(known => networkEqual(known, retired)))
|
|
550
545
|
&& projection.retiredHandoffs.every(retired => knownHandoffs.some(known => networkEqual(known, retired))));
|
|
551
|
-
const requireCarried = (old:
|
|
546
|
+
const requireCarried = (old: IRuntimeAuthorityReference[], next: IRuntimeAuthorityReference[]) => {
|
|
552
547
|
for (const reference of old) requireNetwork(next.some(item => networkEqual(item, reference)));
|
|
553
548
|
};
|
|
554
549
|
if (applied === null) {
|