use std::path::Path;
use crate::cfg_host_parser::HostConfig;
use crate::error::*;
use super::caches::CacheOperations;
use super::cfg_parsers::{ConfigParser, read_file};
use crate::common::{ HOST_CFG_PATH, HOST_CFG_PATH_P};
impl CacheOperations for HostConfig
{
fn is_reload_allowed(&self) -> bool
{
return true;
}
}
impl ConfigParser<HostConfig> for HostConfig
{
fn parse_config() -> CDnsResult<Self>
{
let file_content = read_file(HOST_CFG_PATH)?;
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();
}
}