mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 17:32:21 -04:00
daemon: Allow context-specific commands on the message channel
This commit is contained in:
parent
b582d51c90
commit
1a69cce50b
3 changed files with 50 additions and 13 deletions
|
@ -41,6 +41,7 @@ struct UserContext {}
|
|||
impl DaemonContext for UserContext {
|
||||
type State = UserState;
|
||||
type Config = UserConfig;
|
||||
type Command = ();
|
||||
|
||||
#[cfg(not(test))]
|
||||
fn user_config_path(&self) -> Result<PathBuf> {
|
||||
|
@ -79,6 +80,15 @@ impl DaemonContext for UserContext {
|
|||
// Nothing to do yet
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_command(
|
||||
&mut self,
|
||||
_cmd: Self::Command,
|
||||
_daemon: &mut Daemon<UserContext>,
|
||||
) -> Result<()> {
|
||||
// Nothing to do yet
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
async fn create_connections() -> Result<(Connection, Connection)> {
|
||||
|
@ -103,7 +113,7 @@ pub async fn daemon() -> Result<()> {
|
|||
|
||||
let stdout_log = fmt::layer();
|
||||
let subscriber = Registry::default().with(stdout_log);
|
||||
let (_tx, rx) = channel();
|
||||
let (_tx, rx) = channel::<UserContext>();
|
||||
|
||||
let (_session, system) = match create_connections().await {
|
||||
Ok(c) => c,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue