syncthing_types/
lib.rs

1pub mod cluster;
2pub mod events;
3pub mod routes;
4pub mod system;
5#[cfg(feature = "utils")]
6pub mod utils;
7
8use chrono::DateTime;
9use chrono::FixedOffset;
10use serde::{Deserialize, Serialize};
11use std::collections::HashMap;
12
13pub static API_HEADER_KEY: &str = "X-API-Key";
14pub static API_DEFAULT_AUTHORITY: &str = "127.0.0.1:8384";
15pub static EMPTY_EVENT_SUBSCRIPTION: Vec<crate::events::EventType> = Vec::new();
16
17//TODO: ip type for address, DeviceID/FolderID type with deser
18//FIXME: check folder == folderLable inconsistency
19
20type FileName = String;
21//TODO: use separate type?
22type DeviceID = String;
23type FolderName = String;
24type Folder = HashMap<FileName, File>;
25pub type Timestamp = DateTime<FixedOffset>;
26
27//TODO: maybe move to events if not used in system
28#[non_exhaustive]
29#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
30#[serde(rename_all(deserialize = "camelCase"))]
31pub struct File {
32    pub total: u64,
33    pub pulling: u64,
34    pub copied_from_origin: u64,
35    pub reused: u64,
36    pub copied_from_elsewhere: u64,
37    pub pulled: u64,
38    pub bytes_total: u64,
39    pub bytes_done: u64,
40}