use super::*;
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct UpdateServerConfig {
pub(crate) store_root: PathBuf,
pub(crate) host: String,
#[get(type(copy))]
pub(crate) port: u16,
#[serde(default)]
pub(crate) proxy_base: String,
#[get(type(copy))]
pub(crate) heartbeat_ms: u64,
#[get(type(copy))]
pub(crate) retry_ms: u64,
#[get(type(copy))]
pub(crate) replay_capacity: usize,
#[get(type(copy))]
pub(crate) watch_poll_ms: u64,
#[get(type(copy))]
pub(crate) max_artifact_bytes: u64,
#[get(type(copy))]
pub(crate) once: bool,
}
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ChannelPointer {
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) track: String,
#[get(type(copy))]
pub(crate) active_release_seq: u64,
pub(crate) manifest_sha256: String,
#[get(type(copy))]
pub(crate) updated_at_unix: u64,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct StoredReleaseEvent {
#[get(type(copy))]
pub(crate) event_id: u64,
pub(crate) event: ReleaseActivatedEvent,
}
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct UpdateStore {
pub(crate) root: PathBuf,
#[new(skip)]
#[get(type(copy))]
pub(crate) max_artifact_bytes: u64,
}
#[derive(Debug)]
pub(crate) struct UpdateWriterLockGuard {
pub(crate) lock_path: PathBuf,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct StageReport {
pub(crate) stage_id: String,
pub(crate) project: String,
pub(crate) channel: String,
#[get(type(copy))]
pub(crate) blob_count: usize,
#[get(type(copy))]
pub(crate) total_bytes: u64,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct PublishReport {
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) track: String,
#[get(type(copy))]
pub(crate) from_release: u64,
#[get(type(copy))]
pub(crate) to_release: u64,
#[new(skip)]
#[get(skip)]
pub(crate) rollback_of: Option<u64>,
pub(crate) manifest_sha256: String,
#[new(skip)]
pub(crate) affected_routes: Vec<String>,
#[new(skip)]
#[get(type(copy))]
pub(crate) blobs_written: usize,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ChannelStatusEntry {
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) pointer: ChannelPointer,
#[get(type(copy))]
pub(crate) release_count: usize,
#[get(type(copy))]
pub(crate) event_count: usize,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct UpdateStoreStatus {
pub(crate) store_root: String,
#[get(type(copy))]
pub(crate) blob_count: usize,
#[get(type(copy))]
pub(crate) blob_total_bytes: u64,
pub(crate) channels: Vec<ChannelStatusEntry>,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct UpdateServerReport {
pub(crate) store_root: String,
pub(crate) url: String,
pub(crate) manifest_route: String,
pub(crate) blob_route: String,
pub(crate) events_route: String,
#[get(type(copy))]
pub(crate) once: bool,
}
#[cfg(feature = "update-server")]
#[derive(Clone)]
pub struct UpdateServerState {
pub(crate) store: UpdateStore,
pub(crate) sse_hub: SseHub,
pub(crate) sse_config: SseConfig,
pub(crate) proxy_base: String,
pub(crate) dispatched_seqs: Arc<Mutex<HashMap<(String, String), u64>>>,
pub(crate) running: Arc<AtomicBool>,
}
#[cfg(feature = "update-server")]
pub struct UpdateServerHandle {
pub(crate) address: SocketAddr,
pub(crate) state: Arc<UpdateServerState>,
pub(crate) control: Option<ServerControlHook>,
pub(crate) runtime: Option<runtime::Runtime>,
}
#[cfg(feature = "update-server")]
pub struct ManifestRouteHook;
#[cfg(feature = "update-server")]
pub struct BlobRouteHook;
#[cfg(feature = "update-server")]
pub struct EventsRouteHook;
#[cfg(feature = "update-server")]
pub struct HealthRouteHook;
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct UpdateHealthResponse {
pub(crate) status: String,
pub(crate) store_root: String,
#[get(type(copy))]
pub(crate) blob_count: usize,
#[get(type(copy))]
pub(crate) blob_total_bytes: u64,
#[get(type(copy))]
pub(crate) channel_count: usize,
pub(crate) channels: Vec<ChannelStatusEntry>,
#[get(type(copy))]
pub(crate) running: bool,
#[get(type(copy))]
pub(crate) timestamp_unix: u64,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct KeygenReport {
pub(crate) signing_key: String,
pub(crate) env_var: String,
pub(crate) export_hint: String,
#[get(type(copy))]
pub(crate) bit_length: usize,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct OtaProjectConfig {
#[get(type(copy))]
pub(crate) schema_version: u32,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) store_root: String,
pub(crate) server_url: String,
pub(crate) signing_key_env: String,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaInitConfig {
pub(crate) store_root: PathBuf,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) config_path: Option<PathBuf>,
pub(crate) signing_key: Option<String>,
pub(crate) server_url: String,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct OtaInitReport {
pub(crate) store_root: String,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) config_file: String,
pub(crate) signing_key: String,
pub(crate) signing_key_env: String,
pub(crate) created_dirs: Vec<String>,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct DynamicWasmValidation {
#[get(type(copy))]
pub(crate) abi_version: u32,
pub(crate) exports: Vec<String>,
pub(crate) sha256: String,
#[get(type(copy))]
pub(crate) size_bytes: u64,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaBuildConfig {
pub(crate) manifest_dir: PathBuf,
pub(crate) package: Option<String>,
pub(crate) out_path: Option<PathBuf>,
#[get(type(copy))]
pub(crate) release: bool,
#[get(type(copy))]
pub(crate) push: bool,
pub(crate) store_root: PathBuf,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) route: Option<String>,
pub(crate) slot: Option<String>,
pub(crate) signing_key: Option<String>,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct OtaBuildReport {
pub(crate) wasm_path: String,
pub(crate) sha256: String,
#[get(type(copy))]
pub(crate) size_bytes: u64,
#[get(type(copy))]
pub(crate) abi_version: u32,
pub(crate) exports: Vec<String>,
#[new(skip)]
pub(crate) pushed: Option<PublishReport>,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaDevConfig {
pub(crate) store_root: PathBuf,
pub(crate) host: String,
#[get(type(copy))]
pub(crate) port: u16,
pub(crate) proxy_base: String,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) route: Option<String>,
pub(crate) slot: Option<String>,
pub(crate) watch_path: Option<PathBuf>,
pub(crate) package: Option<String>,
pub(crate) signing_key: String,
#[get(type(copy))]
pub(crate) heartbeat_ms: u64,
#[get(type(copy))]
pub(crate) poll_ms: u64,
#[get(type(copy))]
pub(crate) once: bool,
}
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaDevReport {
pub(crate) store_root: String,
pub(crate) local_url: String,
pub(crate) lan_urls: Vec<String>,
pub(crate) manifest_url: String,
pub(crate) events_url: String,
pub(crate) health_url: String,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) initial_release: Option<PublishReport>,
#[get(type(copy))]
pub(crate) once: bool,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaVerifyConfig {
pub(crate) store_root: PathBuf,
pub(crate) project: Option<String>,
pub(crate) channel: Option<String>,
pub(crate) signing_key: Option<String>,
#[get(type(copy))]
pub(crate) all_releases: bool,
#[get(type(copy))]
#[serde(default)]
pub(crate) release_seq: Option<u64>,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct OtaVerifyIssue {
pub(crate) severity: String,
pub(crate) scope: String,
pub(crate) message: String,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct OtaVerifyReport {
pub(crate) store_root: String,
#[get(type(copy))]
pub(crate) valid: bool,
#[get(type(copy))]
pub(crate) channels_checked: usize,
#[get(type(copy))]
pub(crate) releases_checked: usize,
#[get(type(copy))]
pub(crate) signatures_verified: usize,
#[get(type(copy))]
pub(crate) blobs_verified: usize,
pub(crate) issues: Vec<OtaVerifyIssue>,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct OtaArtifactDiff {
pub(crate) artifact_key: String,
pub(crate) status: String,
pub(crate) from_sha256: Option<String>,
pub(crate) to_sha256: Option<String>,
#[get(type(copy))]
pub(crate) from_bytes: u64,
#[get(type(copy))]
pub(crate) to_bytes: u64,
#[get(type(copy))]
pub(crate) size_delta_bytes: i64,
}
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaReleaseDiff {
pub(crate) project: String,
pub(crate) channel: String,
#[get(type(copy))]
pub(crate) from_seq: u64,
#[get(type(copy))]
pub(crate) to_seq: u64,
pub(crate) from_track: String,
pub(crate) to_track: String,
#[get(type(copy))]
pub(crate) track_changed: bool,
pub(crate) from_delivery_mode: String,
pub(crate) to_delivery_mode: String,
pub(crate) from_manifest_sha256: String,
pub(crate) to_manifest_sha256: String,
#[get(type(copy))]
pub(crate) rollback_of: Option<u64>,
pub(crate) affected_routes: Vec<String>,
pub(crate) added_routes: Vec<String>,
pub(crate) removed_routes: Vec<String>,
pub(crate) artifact_diffs: Vec<OtaArtifactDiff>,
#[get(type(copy))]
pub(crate) total_from_bytes: u64,
#[get(type(copy))]
pub(crate) total_to_bytes: u64,
#[get(type(copy))]
pub(crate) total_size_delta_bytes: i64,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaGcConfig {
pub(crate) store_root: PathBuf,
#[get(type(copy))]
pub(crate) keep_releases: usize,
#[get(type(copy))]
pub(crate) dry_run: bool,
#[get(type(copy))]
pub(crate) prune_staging: bool,
}
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtaGcReport {
pub(crate) store_root: String,
#[get(type(copy))]
pub(crate) dry_run: bool,
#[get(type(copy))]
pub(crate) releases_kept: usize,
#[get(type(copy))]
pub(crate) releases_removed: usize,
#[get(type(copy))]
pub(crate) blobs_kept: usize,
#[get(type(copy))]
pub(crate) blobs_removed: usize,
#[get(type(copy))]
pub(crate) staging_dirs_removed: usize,
#[get(type(copy))]
pub(crate) bytes_reclaimed: u64,
pub(crate) removed_paths: Vec<String>,
}
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct EmbeddedOtaResponse {
#[get(type(copy))]
pub(crate) status_code: u16,
#[get(type(copy))]
pub(crate) status_text: &'static str,
#[get(type(copy))]
pub(crate) content_type: &'static str,
pub(crate) headers: Vec<(String, String)>,
pub(crate) body: Vec<u8>,
}