cdns_rs/sync/
cfg_host_parser.rsuse std::path::Path;
use crate::cfg_host_parser::HostConfig;
use crate::error::*;
use super::caches::CacheOperations;
use super::cfg_parsers::{ConfigParser, read_file};
use super::common::{ HOST_CFG_PATH, HOST_CFG_PATH_P};
use super::log::sync_log_writer;
impl CacheOperations for HostConfig
{
fn is_reload_allowed(&self) -> bool
{
return true;
}
}
impl ConfigParser<HostConfig> for HostConfig
{
fn parse_config() -> CDnsResult<Self>
{
let mut writer = Writer::new();
let file_content = read_file(HOST_CFG_PATH)?;
let ret = Self::parse_host_file_internal(file_content, &mut writer);
sync_log_writer(writer);
return ret;
}
fn get_file_path() -> &'static Path
{
return &HOST_CFG_PATH_P;
}
fn is_default(&self) -> bool
{
return self.is_empty();
}
}