mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-13 09:52:00 -04:00
job: Rename DBus interfaces Job and JobManager to Job1 and JobManager1
This commit is contained in:
parent
39ea3b0d41
commit
6a08ce823e
4 changed files with 20 additions and 21 deletions
21
src/job.rs
21
src/job.rs
|
@ -25,7 +25,7 @@ use zbus::{interface, zvariant, Connection, Interface, InterfaceRef, SignalConte
|
||||||
use zbus_xml::Node;
|
use zbus_xml::Node;
|
||||||
|
|
||||||
use crate::error::{to_zbus_fdo_error, zbus_to_zbus_fdo};
|
use crate::error::{to_zbus_fdo_error, zbus_to_zbus_fdo};
|
||||||
use crate::proxy::{JobManagerProxy, JobProxy};
|
use crate::proxy::{JobManager1Proxy, Job1Proxy};
|
||||||
use crate::Service;
|
use crate::Service;
|
||||||
|
|
||||||
const JOB_PREFIX: &str = "/com/steampowered/SteamOSManager1/Jobs";
|
const JOB_PREFIX: &str = "/com/steampowered/SteamOSManager1/Jobs";
|
||||||
|
@ -54,7 +54,7 @@ pub struct JobManagerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MirroredJob {
|
struct MirroredJob {
|
||||||
job: JobProxy<'static>,
|
job: Job1Proxy<'static>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum JobManagerCommand {
|
pub enum JobManagerCommand {
|
||||||
|
@ -135,7 +135,7 @@ impl JobManager {
|
||||||
return Ok(object_path.clone());
|
return Ok(object_path.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let proxy = JobProxy::builder(connection)
|
let proxy = Job1Proxy::builder(connection)
|
||||||
.destination("com.steampowered.SteamOSManager1")?
|
.destination("com.steampowered.SteamOSManager1")?
|
||||||
.path(path)?
|
.path(path)?
|
||||||
.build()
|
.build()
|
||||||
|
@ -166,7 +166,7 @@ impl JobManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[interface(name = "com.steampowered.SteamOSManager1.JobManager")]
|
#[interface(name = "com.steampowered.SteamOSManager1.JobManager1")]
|
||||||
impl JobManagerInterface {
|
impl JobManagerInterface {
|
||||||
#[zbus(signal)]
|
#[zbus(signal)]
|
||||||
async fn job_started(
|
async fn job_started(
|
||||||
|
@ -232,7 +232,7 @@ impl Job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[interface(name = "com.steampowered.SteamOSManager1.Job")]
|
#[interface(name = "com.steampowered.SteamOSManager1.Job1")]
|
||||||
impl Job {
|
impl Job {
|
||||||
pub async fn pause(&mut self) -> fdo::Result<()> {
|
pub async fn pause(&mut self) -> fdo::Result<()> {
|
||||||
if self.paused {
|
if self.paused {
|
||||||
|
@ -285,7 +285,7 @@ impl Job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[interface(name = "com.steampowered.SteamOSManager1.Job")]
|
#[interface(name = "com.steampowered.SteamOSManager1.Job1")]
|
||||||
impl MirroredJob {
|
impl MirroredJob {
|
||||||
pub async fn pause(&mut self) -> fdo::Result<()> {
|
pub async fn pause(&mut self) -> fdo::Result<()> {
|
||||||
self.job.pause().await.map_err(zbus_to_zbus_fdo)
|
self.job.pause().await.map_err(zbus_to_zbus_fdo)
|
||||||
|
@ -355,7 +355,7 @@ impl Service for JobManagerService {
|
||||||
const NAME: &'static str = "job-manager";
|
const NAME: &'static str = "job-manager";
|
||||||
|
|
||||||
async fn run(&mut self) -> Result<()> {
|
async fn run(&mut self) -> Result<()> {
|
||||||
let jm = JobManagerProxy::new(&self.connection).await?;
|
let jm = JobManager1Proxy::new(&self.connection).await?;
|
||||||
let mut stream = jm.receive_job_started().await?;
|
let mut stream = jm.receive_job_started().await?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -381,7 +381,6 @@ impl Service for JobManagerService {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod test {
|
pub(crate) mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::proxy::JobProxy;
|
|
||||||
use crate::testing;
|
use crate::testing;
|
||||||
|
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
|
@ -409,7 +408,7 @@ pub(crate) mod test {
|
||||||
|
|
||||||
let job = tokio::spawn(async move {
|
let job = tokio::spawn(async move {
|
||||||
let connection = ConnectionBuilder::session()?.build().await?;
|
let connection = ConnectionBuilder::session()?.build().await?;
|
||||||
let jm = JobManagerProxy::builder(&connection)
|
let jm = JobManager1Proxy::builder(&connection)
|
||||||
.destination(sender)?
|
.destination(sender)?
|
||||||
.build()
|
.build()
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -498,7 +497,7 @@ pub(crate) mod test {
|
||||||
|
|
||||||
struct MockJob {}
|
struct MockJob {}
|
||||||
|
|
||||||
#[zbus::interface(name = "com.steampowered.SteamOSManager1.Job")]
|
#[zbus::interface(name = "com.steampowered.SteamOSManager1.Job1")]
|
||||||
impl MockJob {
|
impl MockJob {
|
||||||
pub async fn pause(&mut self) -> fdo::Result<()> {
|
pub async fn pause(&mut self) -> fdo::Result<()> {
|
||||||
Err(fdo::Error::Failed(String::from("pause")))
|
Err(fdo::Error::Failed(String::from("pause")))
|
||||||
|
@ -552,7 +551,7 @@ pub(crate) mod test {
|
||||||
.await
|
.await
|
||||||
.expect("mirror_job");
|
.expect("mirror_job");
|
||||||
let name = connection.unique_name().unwrap().clone();
|
let name = connection.unique_name().unwrap().clone();
|
||||||
let proxy = JobProxy::builder(&connection)
|
let proxy = Job1Proxy::builder(&connection)
|
||||||
.destination(BusName::Unique(name.into()))
|
.destination(BusName::Unique(name.into()))
|
||||||
.expect("destination")
|
.expect("destination")
|
||||||
.path(path)
|
.path(path)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.Job`
|
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.Job1`
|
||||||
//!
|
//!
|
||||||
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
|
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
|
||||||
//! Source: `com.steampowered.SteamOSManager1.xml`.
|
//! Source: `com.steampowered.SteamOSManager1.xml`.
|
||||||
|
@ -13,11 +13,11 @@
|
||||||
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
|
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
|
||||||
use zbus::proxy;
|
use zbus::proxy;
|
||||||
#[proxy(
|
#[proxy(
|
||||||
interface = "com.steampowered.SteamOSManager1.Job",
|
interface = "com.steampowered.SteamOSManager1.Job1",
|
||||||
default_service = "com.steampowered.SteamOSManager1",
|
default_service = "com.steampowered.SteamOSManager1",
|
||||||
assume_defaults = true
|
assume_defaults = true
|
||||||
)]
|
)]
|
||||||
trait Job {
|
trait Job1 {
|
||||||
/// Cancel method
|
/// Cancel method
|
||||||
fn cancel(&self, force: bool) -> zbus::Result<()>;
|
fn cancel(&self, force: bool) -> zbus::Result<()>;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.JobManager`
|
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.JobManager1`
|
||||||
//!
|
//!
|
||||||
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
|
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
|
||||||
//! Source: `com.steampowered.SteamOSManager1.xml`.
|
//! Source: `com.steampowered.SteamOSManager1.xml`.
|
||||||
|
@ -13,12 +13,12 @@
|
||||||
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
|
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
|
||||||
use zbus::proxy;
|
use zbus::proxy;
|
||||||
#[proxy(
|
#[proxy(
|
||||||
interface = "com.steampowered.SteamOSManager1.JobManager",
|
interface = "com.steampowered.SteamOSManager1.JobManager1",
|
||||||
default_service = "com.steampowered.SteamOSManager1",
|
default_service = "com.steampowered.SteamOSManager1",
|
||||||
default_path = "/com/steampowered/SteamOSManager1/Jobs",
|
default_path = "/com/steampowered/SteamOSManager1/Jobs",
|
||||||
assume_defaults = true
|
assume_defaults = true
|
||||||
)]
|
)]
|
||||||
trait JobManager {
|
trait JobManager1 {
|
||||||
/// JobStarted signal
|
/// JobStarted signal
|
||||||
#[zbus(signal)]
|
#[zbus(signal)]
|
||||||
fn job_started(&self, job: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
|
fn job_started(&self, job: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
|
|
@ -8,11 +8,11 @@
|
||||||
// Re-export relevant proxies
|
// Re-export relevant proxies
|
||||||
|
|
||||||
// TODO Some of these should get renamed
|
// TODO Some of these should get renamed
|
||||||
mod job;
|
mod job1;
|
||||||
mod job_manager;
|
mod job_manager1;
|
||||||
mod udev_events;
|
mod udev_events;
|
||||||
pub use crate::proxy::job::JobProxy;
|
pub use crate::proxy::job1::Job1Proxy;
|
||||||
pub use crate::proxy::job_manager::JobManagerProxy;
|
pub use crate::proxy::job_manager1::JobManager1Proxy;
|
||||||
pub use crate::proxy::udev_events::UdevEventsProxy;
|
pub use crate::proxy::udev_events::UdevEventsProxy;
|
||||||
|
|
||||||
// Deprecated interface
|
// Deprecated interface
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue