Skip to main content

sim_table_remote/
citizen.rs

1use sim_citizen_derive::Citizen;
2use sim_kernel::Symbol;
3
4/// Citizen record describing a [`RemoteDir`](crate::RemoteDir) and its backing
5/// site.
6#[derive(Clone, Debug, PartialEq, Citizen)]
7#[citizen(symbol = "table/RemoteDir", version = 0)]
8pub struct RemoteDirDescriptor {
9    /// Identifier of the remote site kind backing the directory.
10    pub site_kind: String,
11    /// Codec used to encode and decode rows over the wire.
12    #[citizen(with = "sim_table_core::citizen_fields::symbol")]
13    pub codec: Symbol,
14    /// Path segments locating the directory within the remote site.
15    #[citizen(with = "sim_table_core::citizen_fields::path_segments")]
16    pub path: Vec<String>,
17}
18
19impl Default for RemoteDirDescriptor {
20    fn default() -> Self {
21        Self {
22            site_kind: String::new(),
23            codec: Symbol::qualified("codec", "binary"),
24            path: Vec::new(),
25        }
26    }
27}
28
29/// Returns the citizen class symbol for [`RemoteDirDescriptor`].
30pub fn remote_dir_class_symbol() -> Symbol {
31    Symbol::qualified("table", "RemoteDir")
32}