Skip to main content

euv_cli/update_server/
const.rs

1/// Hyperlane route template serving protocol/ABI-negotiated signed release manifests.
2pub const UPDATE_ROUTE_MANIFEST: &str = "/v1/projects/{project}/channels/{channel}/manifest";
3
4/// Hyperlane route template serving immutable content-addressed SHA-256 blobs with Range support.
5pub const UPDATE_ROUTE_BLOB: &str = "/v1/blobs/{sha256}";
6
7/// Hyperlane route template streaming minimal `release.activated` SSE notifications with `Last-Event-ID` replay.
8pub const UPDATE_ROUTE_EVENTS: &str = "/v1/projects/{project}/channels/{channel}/events";
9
10/// Default bind host for `euv update serve`.
11pub const DEFAULT_UPDATE_SERVER_HOST: &str = "127.0.0.1";
12
13/// Default bind port for `euv update serve`.
14pub const DEFAULT_UPDATE_SERVER_PORT: u16 = 8787;
15
16/// Default SSE heartbeat interval in milliseconds for `euv update serve`.
17pub const DEFAULT_UPDATE_HEARTBEAT_MS: u64 = 15_000;
18
19/// Default background filesystem pointer watcher poll interval in milliseconds.
20pub const DEFAULT_UPDATE_WATCH_POLL_MS: u64 = 100;
21
22/// Default maximum retained events in each bounded channel event log (`state/events/`).
23pub const DEFAULT_UPDATE_EVENT_LOG_CAP: usize = 256;
24
25/// Subdirectory holding staged artifacts prior to atomic publish.
26pub const STORE_DIR_STAGING: &str = "staging";
27
28/// Subdirectory holding immutable SHA-256 content-addressed blobs (`blobs/sha256/`).
29pub const STORE_DIR_BLOBS: &str = "blobs";
30
31/// Hash algorithm subdirectory beneath `blobs/`.
32pub const STORE_DIR_SHA256: &str = "sha256";
33
34/// Subdirectory holding immutable signed release manifests (`releases/`).
35pub const STORE_DIR_RELEASES: &str = "releases";
36
37/// Subdirectory holding atomically swapped channel active pointers (`channels/`).
38pub const STORE_DIR_CHANNELS: &str = "channels";
39
40/// Subdirectory holding per-track active pointers under a channel directory.
41pub const STORE_DIR_TRACKS: &str = "tracks";
42
43/// Subdirectory holding writer lock and bounded event history (`state/`).
44pub const STORE_DIR_STATE: &str = "state";
45
46/// Subdirectory holding bounded per-channel JSONL event logs under `state/`.
47pub const STORE_DIR_EVENTS: &str = "events";
48
49/// Default target route path updated by `euv update push` when neither `--route` nor `--slot` is given.
50pub const DEFAULT_UPDATE_ROUTE: &str = "/dynamic-panel";
51
52/// Default target component slot identifier updated by `euv update push` when neither `--route` nor `--slot` is given.
53pub const DEFAULT_UPDATE_SLOT: &str = "promo_banner";
54
55/// Default RGB accent color used for inline `euv update push --title` hot-update cards.
56pub const DEFAULT_UPDATE_ACCENT_RGB: u32 = 0x16A34A;
57
58/// WebAssembly binary magic header (`\0asm`) used to auto-detect `.wasm` artifacts during `euv update push`.
59pub(crate) const WASM_BINARY_MAGIC: &[u8; 4] = b"\0asm";
60
61/// Placeholder asset module identifier used for slot-only route manifests.
62pub(crate) const SLOT_CONTAINER_MODULE_ID: &str = "slot-container";
63
64/// Placeholder asset bytes used for slot-only route manifests without overwriting the route page slot.
65pub(crate) const SLOT_CONTAINER_MARKER_BYTES: &[u8] = b"{}";
66
67/// Default artifact module identifier for directly pushed hot-update payloads.
68pub(crate) const PUSH_ARTIFACT_MODULE_ID: &str = "hot-update";
69
70/// Error string when neither `--file` nor `--title` is provided to `euv update push`.
71pub(crate) const ERR_PUSH_SOURCE_REQUIRED: &str =
72    "euv update push requires either --file <path> or --title <text>";
73
74/// Error string when a pushed JSON file is not a valid `DynamicNodeSpec`.
75pub(crate) const ERR_PUSH_INVALID_SPEC: &str =
76    "pushed JSON artifact is not a valid DynamicNodeSpec";
77
78/// Error string when a pushed `.wasm` artifact fails sandbox parsing or host ABI checks.
79pub(crate) const ERR_PUSH_INVALID_WASM: &str =
80    "pushed .wasm artifact failed sandbox or host ABI verification";
81
82/// Default body copy when `euv update push --title` omits `--body`.
83pub(crate) const DEFAULT_PUSH_INLINE_BODY: &str =
84    "Live hot-update delivered via euv update push + Hyperlane SSE (zero restart).";
85
86/// Local writer lock filename inside `state/`.
87pub(crate) const STORE_WRITER_LOCK_FILE: &str = "writer.lock";
88
89/// Active channel pointer filename inside `channels/<project>/<channel>/`.
90pub(crate) const STORE_ACTIVE_POINTER_FILE: &str = "active.json";
91
92/// Staged manifest filename inside `staging/<stage_id>/`.
93pub(crate) const STORE_STAGED_MANIFEST_FILE: &str = "manifest.json";
94
95/// Query parameter key carrying client protocol version.
96#[cfg(feature = "update-server")]
97pub(crate) const QUERY_KEY_PROTOCOL: &str = "protocol";
98
99/// Query parameter key carrying client host ABI version.
100#[cfg(feature = "update-server")]
101pub(crate) const QUERY_KEY_ABI: &str = "abi";
102
103/// Query parameter key carrying client delivery mode (`wasm_component` or `declarative_data`).
104#[cfg(feature = "update-server")]
105pub(crate) const QUERY_KEY_MODE: &str = "mode";
106
107/// Query parameter key carrying preferred compatibility track.
108#[cfg(feature = "update-server")]
109pub(crate) const QUERY_KEY_TRACK: &str = "track";
110
111/// Query parameter key carrying fallback `Last-Event-ID` cursor.
112#[cfg(feature = "update-server")]
113pub(crate) const QUERY_KEY_LAST_EVENT_ID: &str = "last_event_id";
114
115/// Route parameter key for project name.
116#[cfg(feature = "update-server")]
117pub(crate) const ROUTE_PARAM_PROJECT: &str = "project";
118
119/// Route parameter key for channel name.
120#[cfg(feature = "update-server")]
121pub(crate) const ROUTE_PARAM_CHANNEL: &str = "channel";
122
123/// Route parameter key for SHA-256 blob digest.
124#[cfg(feature = "update-server")]
125pub(crate) const ROUTE_PARAM_SHA256: &str = "sha256";
126
127/// Delivery mode wire token for Declarative Data delivery.
128#[cfg(feature = "update-server")]
129pub(crate) const MODE_TOKEN_DATA: &str = "declarative_data";
130
131/// HTTP header name for `ETag`.
132#[cfg(feature = "update-server")]
133pub(crate) const UPDATE_HDR_ETAG: &str = "etag";
134
135/// HTTP header name for `Accept-Ranges`.
136#[cfg(feature = "update-server")]
137pub(crate) const UPDATE_HDR_ACCEPT_RANGES: &str = "accept-ranges";
138
139/// HTTP header value indicating byte range support.
140#[cfg(feature = "update-server")]
141pub(crate) const UPDATE_HDR_BYTES: &str = "bytes";
142
143/// HTTP header name for `Content-Range`.
144#[cfg(feature = "update-server")]
145pub(crate) const UPDATE_HDR_CONTENT_RANGE: &str = "content-range";
146
147/// HTTP header name for incoming `Range` requests.
148#[cfg(feature = "update-server")]
149pub(crate) const UPDATE_HDR_RANGE_LOWER: &str = "range";
150
151/// HTTP header name for `Last-Event-ID`.
152#[cfg(feature = "update-server")]
153pub(crate) const UPDATE_HDR_LAST_EVENT_ID_LOWER: &str = "last-event-id";
154
155/// Immutable cache control directive for content-addressed SHA-256 blobs.
156#[cfg(feature = "update-server")]
157pub(crate) const UPDATE_CACHE_IMMUTABLE: &str = "public, max-age=31536000, immutable";
158
159/// No-cache directive for dynamic channel manifests.
160#[cfg(feature = "update-server")]
161pub(crate) const UPDATE_CACHE_NO_CACHE: &str = "no-cache";
162
163/// Proxy-safe no-cache directive disabling response buffering and transforms on SSE streams.
164#[cfg(feature = "update-server")]
165pub(crate) const UPDATE_SSE_CACHE_CONTROL: &str = "no-cache, no-transform";
166
167/// HTTP header name disabling reverse-proxy buffering on Nginx/Caddy/Cloudflare SSE streams.
168#[cfg(feature = "update-server")]
169pub(crate) const UPDATE_HDR_ACCEL_BUFFERING: &str = "x-accel-buffering";
170
171/// Header value disabling Nginx/proxy SSE response buffering.
172#[cfg(feature = "update-server")]
173pub(crate) const UPDATE_VAL_NO_BUFFER: &str = "no";
174
175/// HTTP CORS allow-origin header name.
176#[cfg(feature = "update-server")]
177pub(crate) const UPDATE_HDR_CORS_ORIGIN: &str = "access-control-allow-origin";
178
179/// HTTP CORS allow-methods header name.
180#[cfg(feature = "update-server")]
181pub(crate) const UPDATE_HDR_CORS_METHODS: &str = "access-control-allow-methods";
182
183/// HTTP CORS allow-headers header name.
184#[cfg(feature = "update-server")]
185pub(crate) const UPDATE_HDR_CORS_HEADERS: &str = "access-control-allow-headers";
186
187/// HTTP CORS expose-headers header name.
188#[cfg(feature = "update-server")]
189pub(crate) const UPDATE_HDR_CORS_EXPOSE: &str = "access-control-expose-headers";
190
191/// HTTP CORS wildcard origin value.
192#[cfg(feature = "update-server")]
193pub(crate) const UPDATE_VAL_CORS_ANY: &str = "*";
194
195/// HTTP CORS allowed methods list.
196#[cfg(feature = "update-server")]
197pub(crate) const UPDATE_VAL_CORS_METHODS: &str = "GET, HEAD, OPTIONS";
198
199/// HTTP CORS allowed request headers list.
200#[cfg(feature = "update-server")]
201pub(crate) const UPDATE_VAL_CORS_HEADERS: &str = "Range, Last-Event-ID, Authorization, Proxy-Authorization, X-Forwarded-Prefix, X-Forwarded-Host, X-Forwarded-Proto";
202
203/// HTTP CORS exposed response headers list.
204#[cfg(feature = "update-server")]
205pub(crate) const UPDATE_VAL_CORS_EXPOSE: &str =
206    "ETag, Content-Range, Accept-Ranges, X-Euv-Proxy-Base";
207
208/// Incoming reverse-proxy prefix header name.
209#[cfg(feature = "update-server")]
210pub(crate) const UPDATE_HDR_X_FWD_PREFIX: &str = "x-forwarded-prefix";
211
212/// Incoming reverse-proxy host header name.
213#[cfg(feature = "update-server")]
214pub(crate) const UPDATE_HDR_X_FWD_HOST: &str = "x-forwarded-host";
215
216/// Incoming reverse-proxy protocol header name.
217#[cfg(feature = "update-server")]
218pub(crate) const UPDATE_HDR_X_FWD_PROTO: &str = "x-forwarded-proto";
219
220/// Response header advertising the resolved proxy-aware base URL for manifest/blob consumers.
221#[cfg(feature = "update-server")]
222pub(crate) const UPDATE_HDR_X_PROXY_BASE: &str = "x-euv-proxy-base";
223
224/// MIME type for JSON responses.
225#[cfg(feature = "update-server")]
226pub(crate) const UPDATE_MIME_JSON: &str = "application/json; charset=utf-8";
227
228/// MIME type for immutable binary blobs.
229#[cfg(feature = "update-server")]
230pub(crate) const UPDATE_MIME_OCTET: &str = "application/octet-stream";
231
232/// Prefix expected on HTTP `Range` byte headers.
233pub(crate) const RANGE_BYTES_PREFIX: &str = "bytes=";
234
235/// File extension for JSON manifest and pointer files.
236pub(crate) const EXT_JSON_DOT: &str = ".json";
237
238/// File extension for JSONL event history files.
239pub(crate) const EXT_JSONL_DOT: &str = ".jsonl";
240
241/// Allowed ASCII hyphen byte in store identifiers.
242pub(crate) const ASCII_HYPHEN: u8 = b'-';
243
244/// Allowed ASCII underscore byte in store identifiers.
245pub(crate) const ASCII_UNDERSCORE: u8 = b'_';
246
247/// Allowed ASCII period byte in store identifiers.
248pub(crate) const ASCII_DOT: u8 = b'.';
249
250/// Error string when an identifier contains unsafe path characters.
251pub(crate) const ERR_INVALID_STORE_IDENT: &str =
252    "store identifier must contain only ASCII alphanumerics, '-', '_', or '.' without traversal";
253
254/// Error string when a writer lock cannot be acquired within the bounded wait budget.
255pub(crate) const ERR_WRITER_LOCK_TIMEOUT: &str = "timed out acquiring update store writer lock";
256
257/// Error string when a signing key is empty during publish or rollback.
258pub(crate) const ERR_EMPTY_SIGNING_KEY: &str =
259    "signing key cannot be empty for publish or rollback";
260
261/// Error string when a staged release directory does not exist.
262pub(crate) const ERR_STAGE_NOT_FOUND: &str = "staged release directory not found";
263
264/// Error string when a target rollback release does not exist.
265pub(crate) const ERR_ROLLBACK_TARGET_MISSING: &str = "rollback target release manifest not found";
266
267/// Error string when a blob referenced by a manifest is missing or corrupted.
268pub(crate) const ERR_BLOB_INTEGRITY: &str = "blob missing or SHA-256 digest mismatch";
269
270/// Error string when no compatible release exists for the client's protocol, ABI, or delivery mode.
271pub(crate) const ERR_NO_COMPATIBLE_RELEASE: &str =
272    "no compatible release available for client protocol, ABI, or delivery mode";
273
274/// Error string when `euv update serve` is invoked without the `update-server` Cargo feature.
275#[cfg(not(feature = "update-server"))]
276pub(crate) const ERR_UPDATE_SERVER_FEATURE_DISABLED: &str =
277    "euv-cli was built without the `update-server` Cargo feature";
278
279/// Error response payload returned for HTTP 404.
280#[cfg(feature = "update-server")]
281pub(crate) const ERR_BODY_NOT_FOUND: &str = "{\"error\":\"not_found\"}";
282
283/// Error response payload returned for HTTP 405.
284#[cfg(feature = "update-server")]
285pub(crate) const ERR_BODY_METHOD_NOT_ALLOWED: &str = "{\"error\":\"method_not_allowed\"}";
286
287/// Error response payload returned for HTTP 400.
288#[cfg(feature = "update-server")]
289pub(crate) const ERR_BODY_BAD_REQUEST: &str = "{\"error\":\"bad_request\"}";
290
291/// Error response payload returned for HTTP 416.
292#[cfg(feature = "update-server")]
293pub(crate) const ERR_BODY_RANGE_INVALID: &str = "{\"error\":\"range_not_satisfiable\"}";
294
295/// Error response payload returned when update server state is not registered.
296#[cfg(feature = "update-server")]
297pub(crate) const ERR_BODY_UNCONFIGURED: &str = "{\"error\":\"update_server_unconfigured\"}";
298
299/// SSE initial connection comment line payload.
300#[cfg(feature = "update-server")]
301pub(crate) const UPDATE_SSE_CONNECTED_COMMENT: &str = "connected";
302
303/// SSE periodic keep-alive heartbeat comment payload.
304#[cfg(feature = "update-server")]
305pub(crate) const UPDATE_SSE_HEARTBEAT_COMMENT: &str = "keep-alive";