1use super::{ClientResult, PollClient};
2use crate::{
3 api::{reply, request},
4 types::{Location, Message, NotBefore, PathBuf, UserAttribute},
5};
6
7pub trait FilesystemClient: PollClient {
9 #[deprecated]
10 fn debug_dump_store(&mut self) -> ClientResult<'_, reply::DebugDumpStore, Self> {
11 self.request(request::DebugDumpStore {})
12 }
13
14 fn read_dir_first(
18 &mut self,
19 location: Location,
20 dir: PathBuf,
21 not_before_filename: Option<PathBuf>,
22 ) -> ClientResult<'_, reply::ReadDirFirst, Self> {
23 self.request(request::ReadDirFirst {
24 location,
25 dir,
26 not_before: NotBefore::with_filename(not_before_filename),
27 })
28 }
29
30 fn read_dir_first_alphabetical(
38 &mut self,
39 location: Location,
40 dir: PathBuf,
41 not_before_filename: Option<PathBuf>,
42 ) -> ClientResult<'_, reply::ReadDirFirst, Self> {
43 self.request(request::ReadDirFirst {
44 location,
45 dir,
46 not_before: NotBefore::with_filename_part(not_before_filename),
47 })
48 }
49
50 fn read_dir_next(&mut self) -> ClientResult<'_, reply::ReadDirNext, Self> {
51 self.request(request::ReadDirNext {})
52 }
53
54 fn read_dir_files_first(
55 &mut self,
56 location: Location,
57 dir: PathBuf,
58 user_attribute: Option<UserAttribute>,
59 ) -> ClientResult<'_, reply::ReadDirFilesFirst, Self> {
60 self.request(request::ReadDirFilesFirst {
61 dir,
62 location,
63 user_attribute,
64 })
65 }
66
67 fn read_dir_files_next(&mut self) -> ClientResult<'_, reply::ReadDirFilesNext, Self> {
68 self.request(request::ReadDirFilesNext {})
69 }
70
71 fn remove_dir(
72 &mut self,
73 location: Location,
74 path: PathBuf,
75 ) -> ClientResult<'_, reply::RemoveDir, Self> {
76 self.request(request::RemoveDir { location, path })
77 }
78
79 fn remove_dir_all(
80 &mut self,
81 location: Location,
82 path: PathBuf,
83 ) -> ClientResult<'_, reply::RemoveDirAll, Self> {
84 self.request(request::RemoveDirAll { location, path })
85 }
86
87 fn remove_file(
88 &mut self,
89 location: Location,
90 path: PathBuf,
91 ) -> ClientResult<'_, reply::RemoveFile, Self> {
92 self.request(request::RemoveFile { location, path })
93 }
94
95 fn read_file(
96 &mut self,
97 location: Location,
98 path: PathBuf,
99 ) -> ClientResult<'_, reply::ReadFile, Self> {
100 self.request(request::ReadFile { location, path })
101 }
102
103 fn entry_metadata(
107 &mut self,
108 location: Location,
109 path: PathBuf,
110 ) -> ClientResult<'_, reply::Metadata, Self> {
111 self.request(request::Metadata { location, path })
112 }
113
114 fn rename(
119 &mut self,
120 location: Location,
121 from: PathBuf,
122 to: PathBuf,
123 ) -> ClientResult<'_, reply::Rename, Self> {
124 self.request(request::Rename { location, from, to })
125 }
126
127 fn locate_file(
128 &mut self,
129 location: Location,
130 dir: Option<PathBuf>,
131 filename: PathBuf,
132 ) -> ClientResult<'_, reply::LocateFile, Self> {
133 self.request(request::LocateFile {
134 location,
135 dir,
136 filename,
137 })
138 }
139
140 fn write_file(
141 &mut self,
142 location: Location,
143 path: PathBuf,
144 data: Message,
145 user_attribute: Option<UserAttribute>,
146 ) -> ClientResult<'_, reply::WriteFile, Self> {
147 self.request(request::WriteFile {
148 location,
149 path,
150 data,
151 user_attribute,
152 })
153 }
154}