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/// Local writer lock filename inside `state/`.
50pub(crate) const STORE_WRITER_LOCK_FILE: &str = "writer.lock";
51
52/// Active channel pointer filename inside `channels/<project>/<channel>/`.
53pub(crate) const STORE_ACTIVE_POINTER_FILE: &str = "active.json";
54
55/// Staged manifest filename inside `staging/<stage_id>/`.
56pub(crate) const STORE_STAGED_MANIFEST_FILE: &str = "manifest.json";
57
58/// Query parameter key carrying client protocol version.
59#[cfg(feature = "update-server")]
60pub(crate) const QUERY_KEY_PROTOCOL: &str = "protocol";
61
62/// Query parameter key carrying client host ABI version.
63#[cfg(feature = "update-server")]
64pub(crate) const QUERY_KEY_ABI: &str = "abi";
65
66/// Query parameter key carrying client delivery mode (`wasm_component` or `declarative_data`).
67#[cfg(feature = "update-server")]
68pub(crate) const QUERY_KEY_MODE: &str = "mode";
69
70/// Query parameter key carrying preferred compatibility track.
71#[cfg(feature = "update-server")]
72pub(crate) const QUERY_KEY_TRACK: &str = "track";
73
74/// Query parameter key carrying fallback `Last-Event-ID` cursor.
75#[cfg(feature = "update-server")]
76pub(crate) const QUERY_KEY_LAST_EVENT_ID: &str = "last_event_id";
77
78/// Route parameter key for project name.
79#[cfg(feature = "update-server")]
80pub(crate) const ROUTE_PARAM_PROJECT: &str = "project";
81
82/// Route parameter key for channel name.
83#[cfg(feature = "update-server")]
84pub(crate) const ROUTE_PARAM_CHANNEL: &str = "channel";
85
86/// Route parameter key for SHA-256 blob digest.
87#[cfg(feature = "update-server")]
88pub(crate) const ROUTE_PARAM_SHA256: &str = "sha256";
89
90/// Delivery mode wire token for Declarative Data delivery.
91#[cfg(feature = "update-server")]
92pub(crate) const MODE_TOKEN_DATA: &str = "declarative_data";
93
94/// HTTP header name for `ETag`.
95#[cfg(feature = "update-server")]
96pub(crate) const UPDATE_HDR_ETAG: &str = "etag";
97
98/// HTTP header name for `Accept-Ranges`.
99#[cfg(feature = "update-server")]
100pub(crate) const UPDATE_HDR_ACCEPT_RANGES: &str = "accept-ranges";
101
102/// HTTP header value indicating byte range support.
103#[cfg(feature = "update-server")]
104pub(crate) const UPDATE_HDR_BYTES: &str = "bytes";
105
106/// HTTP header name for `Content-Range`.
107#[cfg(feature = "update-server")]
108pub(crate) const UPDATE_HDR_CONTENT_RANGE: &str = "content-range";
109
110/// HTTP header name for incoming `Range` requests.
111#[cfg(feature = "update-server")]
112pub(crate) const UPDATE_HDR_RANGE_LOWER: &str = "range";
113
114/// HTTP header name for `Last-Event-ID`.
115#[cfg(feature = "update-server")]
116pub(crate) const UPDATE_HDR_LAST_EVENT_ID_LOWER: &str = "last-event-id";
117
118/// Immutable cache control directive for content-addressed SHA-256 blobs.
119#[cfg(feature = "update-server")]
120pub(crate) const UPDATE_CACHE_IMMUTABLE: &str = "public, max-age=31536000, immutable";
121
122/// No-cache directive for dynamic channel manifests.
123#[cfg(feature = "update-server")]
124pub(crate) const UPDATE_CACHE_NO_CACHE: &str = "no-cache";
125
126/// MIME type for JSON responses.
127#[cfg(feature = "update-server")]
128pub(crate) const UPDATE_MIME_JSON: &str = "application/json; charset=utf-8";
129
130/// MIME type for immutable binary blobs.
131#[cfg(feature = "update-server")]
132pub(crate) const UPDATE_MIME_OCTET: &str = "application/octet-stream";
133
134/// Prefix expected on HTTP `Range` byte headers.
135pub(crate) const RANGE_BYTES_PREFIX: &str = "bytes=";
136
137/// File extension for JSON manifest and pointer files.
138pub(crate) const EXT_JSON_DOT: &str = ".json";
139
140/// File extension for JSONL event history files.
141pub(crate) const EXT_JSONL_DOT: &str = ".jsonl";
142
143/// Allowed ASCII hyphen byte in store identifiers.
144pub(crate) const ASCII_HYPHEN: u8 = b'-';
145
146/// Allowed ASCII underscore byte in store identifiers.
147pub(crate) const ASCII_UNDERSCORE: u8 = b'_';
148
149/// Allowed ASCII period byte in store identifiers.
150pub(crate) const ASCII_DOT: u8 = b'.';
151
152/// Error string when an identifier contains unsafe path characters.
153pub(crate) const ERR_INVALID_STORE_IDENT: &str =
154    "store identifier must contain only ASCII alphanumerics, '-', '_', or '.' without traversal";
155
156/// Error string when a writer lock cannot be acquired within the bounded wait budget.
157pub(crate) const ERR_WRITER_LOCK_TIMEOUT: &str = "timed out acquiring update store writer lock";
158
159/// Error string when a signing key is empty during publish or rollback.
160pub(crate) const ERR_EMPTY_SIGNING_KEY: &str =
161    "signing key cannot be empty for publish or rollback";
162
163/// Error string when a staged release directory does not exist.
164pub(crate) const ERR_STAGE_NOT_FOUND: &str = "staged release directory not found";
165
166/// Error string when a target rollback release does not exist.
167pub(crate) const ERR_ROLLBACK_TARGET_MISSING: &str = "rollback target release manifest not found";
168
169/// Error string when a blob referenced by a manifest is missing or corrupted.
170pub(crate) const ERR_BLOB_INTEGRITY: &str = "blob missing or SHA-256 digest mismatch";
171
172/// Error string when no compatible release exists for the client's protocol, ABI, or delivery mode.
173pub(crate) const ERR_NO_COMPATIBLE_RELEASE: &str =
174    "no compatible release available for client protocol, ABI, or delivery mode";
175
176/// Error string when `euv update serve` is invoked without the `update-server` Cargo feature.
177#[cfg(not(feature = "update-server"))]
178pub(crate) const ERR_UPDATE_SERVER_FEATURE_DISABLED: &str =
179    "euv-cli was built without the `update-server` Cargo feature";
180
181/// Error response payload returned for HTTP 404.
182#[cfg(feature = "update-server")]
183pub(crate) const ERR_BODY_NOT_FOUND: &str = "{\"error\":\"not_found\"}";
184
185/// Error response payload returned for HTTP 405.
186#[cfg(feature = "update-server")]
187pub(crate) const ERR_BODY_METHOD_NOT_ALLOWED: &str = "{\"error\":\"method_not_allowed\"}";
188
189/// Error response payload returned for HTTP 400.
190#[cfg(feature = "update-server")]
191pub(crate) const ERR_BODY_BAD_REQUEST: &str = "{\"error\":\"bad_request\"}";
192
193/// Error response payload returned for HTTP 416.
194#[cfg(feature = "update-server")]
195pub(crate) const ERR_BODY_RANGE_INVALID: &str = "{\"error\":\"range_not_satisfiable\"}";
196
197/// Error response payload returned when update server state is not registered.
198#[cfg(feature = "update-server")]
199pub(crate) const ERR_BODY_UNCONFIGURED: &str = "{\"error\":\"update_server_unconfigured\"}";
200
201/// SSE initial connection comment line payload.
202#[cfg(feature = "update-server")]
203pub(crate) const UPDATE_SSE_CONNECTED_COMMENT: &str = "connected";
204
205/// SSE periodic keep-alive heartbeat comment payload.
206#[cfg(feature = "update-server")]
207pub(crate) const UPDATE_SSE_HEARTBEAT_COMMENT: &str = "keep-alive";