1pub(crate) mod wire;
9
10#[cfg(not(target_os = "windows"))]
11#[cfg(feature = "unix")]
12pub mod unix;
13
14#[cfg(not(target_os = "windows"))]
15#[cfg(feature = "async-tokio")]
16pub mod tokio;
17
18use std::io;
19
20pub trait Xs {
23 fn directory(&self, path: &str) -> io::Result<Vec<Box<str>>>;
25
26 fn read(&self, path: &str) -> io::Result<Box<str>>;
28
29 fn write(&self, path: &str, data: &str) -> io::Result<()>;
31
32 fn rm(&self, path: &str) -> io::Result<()>;
34}
35
36pub trait XsTransaction: Xs {
49 type Span: Xs; fn transaction(&self) -> io::Result<Self::Span>;
52}
53
54pub trait XsTransactionSpan: Xs {
56 fn commit(self) -> io::Result<()>;
58}
59
60#[cfg(feature = "async")]
62#[trait_variant::make(AsyncXs: Send)]
63pub trait LocalAsyncXs {
64 async fn directory(&self, path: &str) -> io::Result<Vec<Box<str>>>;
66
67 async fn read(&self, path: &str) -> io::Result<Box<str>>;
69
70 async fn write(&self, path: &str, data: &str) -> io::Result<()>;
72
73 async fn rm(&self, path: &str) -> io::Result<()>;
75}
76
77#[cfg(feature = "async")]
79#[trait_variant::make(AsyncXsTransaction: Send)]
80pub trait LocalAsyncXsTransaction: AsyncXs {
81 type Span: Xs;
82
83 async fn transaction(&self) -> io::Result<Self::Span>;
84}
85
86#[cfg(feature = "async")]
88#[trait_variant::make(AsyncXsTransactionSpan: Send)]
89pub trait LocalAsyncXsTransactionSpan: Xs {
90 async fn commit(self) -> io::Result<()>;
92}
93
94#[cfg(feature = "async")]
96#[trait_variant::make(AsyncWatch: Send)]
97pub trait LocalAsyncWatch {
98 async fn watch(
100 &self,
101 path: &str,
102 ) -> io::Result<impl futures::Stream<Item = Box<str>> + Unpin + 'static>;
103}