use std::path::Path;
use async_trait::async_trait;
use crate::a_sync::interface::UnifiedFs;
use crate::cfg_host_parser::HostConfig;
use crate::common::{HOST_CFG_PATH, HOST_CFG_PATH_P};
use crate::error::*;
use super::caches::CacheOperations;
use super::cfg_parsers::{ConfigParser, read_file};
impl CacheOperations for HostConfig
{
fn is_reload_allowed(&self) -> bool
{
return true;
}
}
impl ConfigParser<HostConfig> for HostConfig
{
async
fn parse_config<UFS: UnifiedFs>() -> CDnsResult<Self>
{
let file_content = read_file::<UFS>(HOST_CFG_PATH).await?;
let ret = Self::parse_host_file_internal(file_content);
return ret;
}
fn get_file_path() -> &'static Path
{
return &HOST_CFG_PATH_P;
}
fn is_default(&self) -> bool
{
return self.is_empty();
}
}