Skip to main content

euv_core/dynamic/engine/
const.rs

1/// Default capacity of the bounded non-blocking `CandidateMailbox`.
2pub const DEFAULT_CANDIDATE_MAILBOX_CAP: usize = 4;
3
4/// Default maximum size in bytes allowed for a single downloaded artifact (`16 MiB`).
5pub const DEFAULT_MAX_ARTIFACT_BYTES: u64 = 16 * 1024 * 1024;
6
7/// Default HTTP connect and read timeout in milliseconds for update requests.
8pub const DEFAULT_UPDATE_HTTP_TIMEOUT_MS: u64 = 5_000;
9
10/// Default SSE reconnect backoff interval in milliseconds.
11pub const DEFAULT_SSE_RECONNECT_MS: u64 = 100;
12
13/// Dedicated OS thread name assigned to the background `UpdateWorker`.
14pub const UPDATE_WORKER_THREAD_NAME: &str = "euv-update-worker";
15
16/// Environment variable overriding the dynamic hot-update server base URL.
17pub const ENV_EUV_UPDATE_URL: &str = "EUV_UPDATE_URL";
18
19/// Environment variable configuring an explicit HTTP forward proxy for hot updates.
20pub const ENV_EUV_PROXY_URL: &str = "EUV_PROXY_URL";
21
22/// Standard uppercase HTTPS proxy environment variable consulted by `resolve_proxy_env`.
23pub const ENV_HTTPS_PROXY: &str = "HTTPS_PROXY";
24
25/// Standard uppercase HTTP proxy environment variable consulted by `resolve_proxy_env`.
26pub const ENV_HTTP_PROXY: &str = "HTTP_PROXY";
27
28/// Standard lowercase HTTPS proxy environment variable fallback.
29pub const ENV_HTTPS_PROXY_LOWER: &str = "https_proxy";
30
31/// Standard lowercase HTTP proxy environment variable fallback.
32pub const ENV_HTTP_PROXY_LOWER: &str = "http_proxy";
33
34/// Default hot-update server URL used when `EUV_UPDATE_URL` is unset.
35pub const DEFAULT_HOT_UPDATE_SERVER_URL: &str = "http://127.0.0.1:8787";
36
37/// Default hot-update channel name used by `HotUpdateProxyConfig`.
38pub const DEFAULT_HOT_UPDATE_CHANNEL: &str = "prod";
39
40/// Default periodic manifest poll fallback cadence in seconds when SSE disconnects.
41pub const DEFAULT_POLL_FALLBACK_SECS: u64 = 30;
42
43/// HTTP header name carrying forward-proxy credentials.
44#[cfg(not(target_arch = "wasm32"))]
45pub(crate) const HDR_PROXY_AUTHORIZATION: &str = "Proxy-Authorization";
46
47/// HTTP header name keeping forward-proxied SSE streams alive.
48#[cfg(not(target_arch = "wasm32"))]
49pub(crate) const HDR_PROXY_CONNECTION: &str = "Proxy-Connection";
50
51/// Standard Base64 encoding alphabet used for HTTP Basic `Proxy-Authorization`.
52pub(crate) const BASE64_STD_TABLE: &[u8; 64] =
53    b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
54
55/// HTTP scheme prefix accepted by `HttpReleaseTransport`.
56#[cfg(not(target_arch = "wasm32"))]
57pub(crate) const UPDATE_HTTP_SCHEME: &str = "http://";
58
59/// HTTP header separator marking the end of response headers.
60#[cfg(not(target_arch = "wasm32"))]
61pub(crate) const HTTP_HEADER_END_MARKER: &[u8] = b"\r\n\r\n";
62
63/// HTTP header name for SSE stream resume cursor.
64#[cfg(not(target_arch = "wasm32"))]
65pub(crate) const HDR_LAST_EVENT_ID: &str = "Last-Event-ID";
66
67/// HTTP header name for byte-range resume requests.
68#[cfg(not(target_arch = "wasm32"))]
69pub(crate) const HDR_RANGE: &str = "Range";
70
71/// HTTP transfer-encoding chunked token.
72#[cfg(not(target_arch = "wasm32"))]
73pub(crate) const HDR_TRANSFER_ENCODING_CHUNKED: &str = "chunked";
74
75/// HTTP header key prefix for transfer encoding.
76#[cfg(not(target_arch = "wasm32"))]
77pub(crate) const HDR_TRANSFER_ENCODING_KEY: &str = "transfer-encoding";
78
79/// HTTP header key prefix for content length.
80#[cfg(not(target_arch = "wasm32"))]
81pub(crate) const HDR_CONTENT_LENGTH_KEY: &str = "content-length";
82
83/// SSE wire prefix for event identifier lines.
84#[cfg(not(target_arch = "wasm32"))]
85pub(crate) const SSE_WIRE_ID_PREFIX: &str = "id:";
86
87/// SSE wire prefix for event type lines.
88#[cfg(not(target_arch = "wasm32"))]
89pub(crate) const SSE_WIRE_EVENT_PREFIX: &str = "event:";
90
91/// SSE wire prefix for data payload lines.
92#[cfg(not(target_arch = "wasm32"))]
93pub(crate) const SSE_WIRE_DATA_PREFIX: &str = "data:";
94
95/// Delivery mode query token for Wasm Component channel.
96#[cfg(not(target_arch = "wasm32"))]
97pub(crate) const QUERY_MODE_WASM: &str = "wasm_component";
98
99/// Delivery mode query token for Declarative Data channel.
100#[cfg(not(target_arch = "wasm32"))]
101pub(crate) const QUERY_MODE_DATA: &str = "declarative_data";
102
103/// Error message when a worker URL does not start with `http://`.
104#[cfg(not(target_arch = "wasm32"))]
105pub(crate) const ERR_INVALID_HTTP_BASE_URL: &str =
106    "update server base_url must use http://host:port";
107
108/// Error message when a server returns a malformed HTTP response head.
109#[cfg(not(target_arch = "wasm32"))]
110pub(crate) const ERR_MALFORMED_HTTP_RESP: &str = "malformed HTTP response from update server";
111
112/// Error message when an HTTP status code is not 200 or 206.
113#[cfg(not(target_arch = "wasm32"))]
114pub(crate) const ERR_HTTP_NON_OK: &str = "unexpected HTTP status from update server";
115
116/// Error message when an artifact WASM binary fails ABI or export validation.
117pub(crate) const ERR_WASM_ARTIFACT_ABI: &str = "wasm artifact failed host ABI export check";
118
119/// Error message when a declarative artifact is not valid JSON `DynamicNodeSpec`.
120pub(crate) const ERR_DECLARATIVE_JSON: &str =
121    "declarative artifact payload is not a valid DynamicNodeSpec";
122
123/// Error message when a cross-route action is denied by host permissions.
124pub(crate) const ERR_ACTION_DENIED: &str = "cross-route action is not permitted by host policy";
125
126/// Error message when a cross-route action was cancelled before dispatch.
127pub(crate) const ERR_ACTION_CANCELLED: &str =
128    "cross-route action cancelled by stale generation token";
129
130/// Error message when no active release generation is installed on the runtime.
131pub(crate) const ERR_NO_ACTIVE_GENERATION: &str = "no active release generation installed";
132
133/// Error message when the background update worker thread cannot be spawned.
134#[cfg(not(target_arch = "wasm32"))]
135pub(crate) const ERR_WORKER_SPAWN: &str = "failed to spawn background update worker thread";
136
137/// Error message when a network transport is unavailable on `wasm32` in synchronous mode.
138#[cfg(target_arch = "wasm32")]
139pub(crate) const ERR_WASM32_SYNC_HTTP: &str =
140    "synchronous TCP HTTP transport unavailable on wasm32";