use super::*;
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct UpdateClientConfig {
pub(crate) base_url: String,
pub(crate) project: String,
pub(crate) channel: String,
pub(crate) verify_key: Vec<u8>,
#[new(skip)]
#[get(type(copy))]
pub(crate) host_abi: u32,
#[new(skip)]
#[get(type(copy))]
pub(crate) delivery_mode: DeliveryChannelMode,
#[new(skip)]
pub(crate) capabilities: Vec<String>,
#[new(skip)]
#[get(skip)]
pub(crate) preferred_track: Option<String>,
#[new(skip)]
#[get(type(copy))]
pub(crate) max_artifact_bytes: u64,
#[new(skip)]
#[get(type(copy))]
pub(crate) mailbox_capacity: usize,
#[new(skip)]
#[get(type(copy))]
pub(crate) reconnect_backoff_ms: u64,
#[new(skip)]
#[get(type(copy))]
pub(crate) http_timeout_ms: u64,
#[new(skip)]
#[get(type(copy))]
pub(crate) sandbox_config: WasmSandboxConfig,
}
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct HttpReleaseTransport {
pub(crate) base_url: String,
#[get(type(copy))]
pub(crate) timeout_ms: u64,
}
#[derive(Clone, Data, Debug)]
pub struct PreparedReleaseCandidate {
pub(crate) manifest: ReleaseManifest,
pub(crate) manifest_sha256: String,
pub(crate) warmed_artifacts: BTreeMap<String, WarmedArtifact>,
pub(crate) affected_routes: Vec<String>,
pub(crate) newly_fetched_hashes: Vec<String>,
pub(crate) reused_cached_hashes: Vec<String>,
pub(crate) migrated_ui_states: BTreeMap<String, ComponentUiStateSnapshot>,
#[get(type(copy))]
pub(crate) snapshot_business_revision: u64,
pub(crate) snapshot_entity_revisions: BTreeMap<String, u64>,
pub(crate) prepared_on_thread: String,
}
#[derive(Debug)]
pub(crate) struct CandidateMailboxInner {
pub(crate) capacity: usize,
pub(crate) highest_seen_seq: u64,
pub(crate) queue: VecDeque<PreparedReleaseCandidate>,
}
#[derive(Clone, Debug)]
pub struct CandidateMailbox {
pub(crate) inner: Arc<Mutex<CandidateMailboxInner>>,
}
#[derive(CustomDebug)]
pub(crate) struct UpdateWorkerShared {
pub(crate) config: UpdateClientConfig,
pub(crate) mailbox: CandidateMailbox,
pub(crate) blob_cache: Mutex<HashMap<String, Arc<Vec<u8>>>>,
pub(crate) fetched_hashes_log: Mutex<Vec<String>>,
pub(crate) last_event_id: Mutex<Option<String>>,
pub(crate) last_prepared_manifest: Mutex<Option<ReleaseManifest>>,
pub(crate) last_error: Mutex<Option<DynamicReleaseError>>,
pub(crate) pending_snapshot: Mutex<Option<NestedStateSnapshot>>,
#[debug(skip)]
pub(crate) migrator: SharedStateMigrator,
pub(crate) running: AtomicBool,
pub(crate) reconcile_requested: AtomicBool,
pub(crate) sse_connect_count: AtomicU64,
}
#[derive(Debug)]
pub struct UpdateWorkerHandle {
pub(crate) shared: Arc<UpdateWorkerShared>,
#[cfg(not(target_arch = "wasm32"))]
pub(crate) worker_thread: Option<JoinHandle<()>>,
}
#[derive(Clone, Data, Debug)]
pub struct ReleaseGeneration {
#[get(type(copy))]
pub(crate) generation_id: u64,
pub(crate) manifest: ReleaseManifest,
pub(crate) warmed_artifacts: BTreeMap<String, WarmedArtifact>,
#[get(type(copy))]
pub(crate) active_route_pins: usize,
#[get(type(copy))]
pub(crate) active_in_flight_tasks: usize,
}
#[derive(Clone, Data, Debug)]
pub struct RoutePinHandle {
pub(crate) route_instance_id: String,
pub(crate) route: String,
#[get(type(copy))]
pub(crate) generation_id: u64,
pub(crate) entry_module: String,
pub(crate) slot_bindings: BTreeMap<String, String>,
pub(crate) cancellation_token: Arc<AtomicBool>,
}
#[derive(Clone, Data, Debug, New)]
pub struct CrossRouteAction {
pub(crate) target_route: String,
pub(crate) action_id: String,
pub(crate) payload: Value,
#[get(type(copy))]
pub(crate) origin_generation: u64,
pub(crate) cancellation_token: Arc<AtomicBool>,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct ActivationReport {
#[get(type(copy))]
pub(crate) release_seq: u64,
pub(crate) swapped_routes: Vec<String>,
pub(crate) unchanged_pinned_routes: Vec<String>,
#[get(type(copy))]
pub(crate) deferred: bool,
pub(crate) defer_reason: String,
#[get(type(copy))]
pub(crate) caught_up_deltas: usize,
#[get(type(copy))]
pub(crate) gc_reclaimed_generations: usize,
}
#[derive(CustomDebug)]
pub struct DynamicReleaseRuntime {
pub(crate) hub: DynamicUpdateHub,
pub(crate) business_store: BusinessStateStore,
pub(crate) sandbox_config: WasmSandboxConfig,
pub(crate) active_release_seq: u64,
pub(crate) generations: BTreeMap<u64, ReleaseGeneration>,
pub(crate) open_routes: BTreeMap<String, RoutePinHandle>,
pub(crate) restored_ui_states: BTreeMap<String, ComponentUiStateSnapshot>,
pub(crate) deferred_candidate: Option<PreparedReleaseCandidate>,
pub(crate) next_hub_revision: u64,
}