mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
* refactor project structure * environment-based default registry * fix tests * update build container * use docker platform for iso build emulation * simplify compat * Fix docker platform spec in run-compat.sh * handle riscv compat * fix bug with dep error exists attr * undo removal of sorting * use qemu for iso stage --------- Co-authored-by: Mariusz Kogen <k0gen@pm.me> Co-authored-by: Matt Hill <mattnine@protonmail.com>
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::Error;
|
|
use crate::net::utils::find_eth_iface;
|
|
use crate::rpc_continuations::RpcContinuations;
|
|
|
|
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
|
|
}
|
|
}
|