mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
* wip * restructure backend for new ui structure * new patchdb bootstrap, single websocket api, local storage migration, more * update db websocket * init apis * update patch-db * setup progress * feat: implement state service, alert and routing Signed-off-by: waterplea <alexander@inkin.ru> * update setup wizard for new types * feat: add init page Signed-off-by: waterplea <alexander@inkin.ru> * chore: refactor message, patch-db source stream and connection service Signed-off-by: waterplea <alexander@inkin.ru> * fix method not found on state * fix backend bugs * fix compat assets * address comments * remove unneeded styling * cleaner progress * bugfixes * fix init logs * fix progress reporting * fix navigation by getting state after init * remove patch dependency from live api * fix caching * re-add patchDB to live api * fix metrics values * send close frame * add bootId and fix polling --------- Signed-off-by: waterplea <alexander@inkin.ru> Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: waterplea <alexander@inkin.ru>
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
use std::ops::Deref;
|
|
use std::sync::Arc;
|
|
|
|
use rpc_toolkit::Context;
|
|
use tokio::sync::broadcast::Sender;
|
|
use tracing::instrument;
|
|
|
|
use crate::net::utils::find_eth_iface;
|
|
use crate::rpc_continuations::RpcContinuations;
|
|
use crate::Error;
|
|
|
|
pub struct InstallContextSeed {
|
|
pub ethernet_interface: String,
|
|
pub shutdown: Sender<()>,
|
|
pub rpc_continuations: RpcContinuations,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct InstallContext(Arc<InstallContextSeed>);
|
|
impl InstallContext {
|
|
#[instrument(skip_all)]
|
|
pub async fn init() -> Result<Self, Error> {
|
|
let (shutdown, _) = tokio::sync::broadcast::channel(1);
|
|
Ok(Self(Arc::new(InstallContextSeed {
|
|
ethernet_interface: find_eth_iface().await?,
|
|
shutdown,
|
|
rpc_continuations: RpcContinuations::new(),
|
|
})))
|
|
}
|
|
}
|
|
|
|
impl AsRef<RpcContinuations> for InstallContext {
|
|
fn as_ref(&self) -> &RpcContinuations {
|
|
&self.rpc_continuations
|
|
}
|
|
}
|
|
|
|
impl Context for InstallContext {}
|
|
impl Deref for InstallContext {
|
|
type Target = InstallContextSeed;
|
|
fn deref(&self) -> &Self::Target {
|
|
&*self.0
|
|
}
|
|
}
|