system_api/bindings/client/
org_chromium_spaced.rs1use dbus as dbus;
3#[allow(unused_imports)]
4use dbus::arg;
5use dbus::blocking;
6
7pub trait OrgChromiumSpaced {
8 fn get_free_disk_space(&self, path: &str) -> Result<i64, dbus::Error>;
9 fn get_total_disk_space(&self, path: &str) -> Result<i64, dbus::Error>;
10 fn get_root_device_size(&self) -> Result<i64, dbus::Error>;
11 fn is_quota_supported(&self, path: &str) -> Result<bool, dbus::Error>;
12 fn get_quota_current_space_for_uid(&self, path: &str, uid: u32) -> Result<i64, dbus::Error>;
13 fn get_quota_current_space_for_gid(&self, path: &str, gid: u32) -> Result<i64, dbus::Error>;
14 fn get_quota_current_space_for_project_id(&self, path: &str, project_id: u32) -> Result<i64, dbus::Error>;
15 fn get_quota_current_spaces_for_ids(&self, request: Vec<u8>) -> Result<Vec<u8>, dbus::Error>;
16 fn get_quota_overall_usage(&self, path: &str) -> Result<Vec<u8>, dbus::Error>;
17 fn get_quota_overall_usage_pretty_print(&self, path: &str) -> Result<String, dbus::Error>;
18 fn set_project_id(&self, fd: arg::OwnedFd, project_id: u32) -> Result<Vec<u8>, dbus::Error>;
19 fn set_project_inheritance_flag(&self, fd: arg::OwnedFd, enable: bool) -> Result<Vec<u8>, dbus::Error>;
20}
21
22#[derive(Debug)]
23pub struct OrgChromiumSpacedStatefulDiskSpaceUpdate {
24 pub status: Vec<u8>,
25}
26
27impl arg::AppendAll for OrgChromiumSpacedStatefulDiskSpaceUpdate {
28 fn append(&self, i: &mut arg::IterAppend) {
29 arg::RefArg::append(&self.status, i);
30 }
31}
32
33impl arg::ReadAll for OrgChromiumSpacedStatefulDiskSpaceUpdate {
34 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
35 Ok(OrgChromiumSpacedStatefulDiskSpaceUpdate {
36 status: i.read()?,
37 })
38 }
39}
40
41impl dbus::message::SignalArgs for OrgChromiumSpacedStatefulDiskSpaceUpdate {
42 const NAME: &'static str = "StatefulDiskSpaceUpdate";
43 const INTERFACE: &'static str = "org.chromium.Spaced";
44}
45
46impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgChromiumSpaced for blocking::Proxy<'a, C> {
47
48 fn get_free_disk_space(&self, path: &str) -> Result<i64, dbus::Error> {
49 self.method_call("org.chromium.Spaced", "GetFreeDiskSpace", (path, ))
50 .and_then(|r: (i64, )| Ok(r.0, ))
51 }
52
53 fn get_total_disk_space(&self, path: &str) -> Result<i64, dbus::Error> {
54 self.method_call("org.chromium.Spaced", "GetTotalDiskSpace", (path, ))
55 .and_then(|r: (i64, )| Ok(r.0, ))
56 }
57
58 fn get_root_device_size(&self) -> Result<i64, dbus::Error> {
59 self.method_call("org.chromium.Spaced", "GetRootDeviceSize", ())
60 .and_then(|r: (i64, )| Ok(r.0, ))
61 }
62
63 fn is_quota_supported(&self, path: &str) -> Result<bool, dbus::Error> {
64 self.method_call("org.chromium.Spaced", "IsQuotaSupported", (path, ))
65 .and_then(|r: (bool, )| Ok(r.0, ))
66 }
67
68 fn get_quota_current_space_for_uid(&self, path: &str, uid: u32) -> Result<i64, dbus::Error> {
69 self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpaceForUid", (path, uid, ))
70 .and_then(|r: (i64, )| Ok(r.0, ))
71 }
72
73 fn get_quota_current_space_for_gid(&self, path: &str, gid: u32) -> Result<i64, dbus::Error> {
74 self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpaceForGid", (path, gid, ))
75 .and_then(|r: (i64, )| Ok(r.0, ))
76 }
77
78 fn get_quota_current_space_for_project_id(&self, path: &str, project_id: u32) -> Result<i64, dbus::Error> {
79 self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpaceForProjectId", (path, project_id, ))
80 .and_then(|r: (i64, )| Ok(r.0, ))
81 }
82
83 fn get_quota_current_spaces_for_ids(&self, request: Vec<u8>) -> Result<Vec<u8>, dbus::Error> {
84 self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpacesForIds", (request, ))
85 .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
86 }
87
88 fn get_quota_overall_usage(&self, path: &str) -> Result<Vec<u8>, dbus::Error> {
89 self.method_call("org.chromium.Spaced", "GetQuotaOverallUsage", (path, ))
90 .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
91 }
92
93 fn get_quota_overall_usage_pretty_print(&self, path: &str) -> Result<String, dbus::Error> {
94 self.method_call("org.chromium.Spaced", "GetQuotaOverallUsagePrettyPrint", (path, ))
95 .and_then(|r: (String, )| Ok(r.0, ))
96 }
97
98 fn set_project_id(&self, fd: arg::OwnedFd, project_id: u32) -> Result<Vec<u8>, dbus::Error> {
99 self.method_call("org.chromium.Spaced", "SetProjectId", (fd, project_id, ))
100 .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
101 }
102
103 fn set_project_inheritance_flag(&self, fd: arg::OwnedFd, enable: bool) -> Result<Vec<u8>, dbus::Error> {
104 self.method_call("org.chromium.Spaced", "SetProjectInheritanceFlag", (fd, enable, ))
105 .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
106 }
107}