cdns_rs/a_sync/
cfg_host_parser.rs1use std::path::Path;
20
21use async_trait::async_trait;
22
23use crate::a_sync::interface::UnifiedFs;
24use crate::cfg_host_parser::HostConfig;
25use crate::common::{HOST_CFG_PATH, HOST_CFG_PATH_P};
26use crate::error::*;
27
28
29use super::caches::CacheOperations;
30use super::cfg_parsers::{ConfigParser, read_file};
31
32impl CacheOperations for HostConfig
36{
37 fn is_reload_allowed(&self) -> bool
38 {
39 return true;
40 }
41}
42
43
44impl ConfigParser<HostConfig> for HostConfig
45{
46 async
47 fn parse_config<UFS: UnifiedFs>() -> CDnsResult<Self>
48 {
49 let file_content = read_file::<UFS>(HOST_CFG_PATH).await?;
50
51 let ret = Self::parse_host_file_internal(file_content);
52
53 return ret;
54 }
55
56 fn get_file_path() -> &'static Path
57 {
58 return &HOST_CFG_PATH_P;
59 }
60
61 fn is_default(&self) -> bool
62 {
63 return self.is_empty();
64 }
65}
66