pub fn new<P: AsRef<Path>>(dir: P) -> InfluxResult<Self>
    {
        let dir = PathBuf::from(dir.as_ref());

        if ! dir.is_dir() {
            return Err(format!("Backlog dir is not a directory: {:#?}", dir).into())
        }

        let mut archives = HashMap::new();

        let listing = std::fs::read_dir(&dir)
            .annotate(format!("While opening backlog directory: {:#?}", dir))?;

        for entry in listing
        {
            let entry = entry?;
            let path  = entry.path();
            let file  = Archive::open(&path)?;

            archives.insert(path, file);
        }

        Ok(Self {dir, archives})
    }
/// Construct file based backlog by providing a directory to write [Record](struct.Record.html) files to.
Construct file based backlog by providing a directory to write [Record](struct.Record.html) files to.
Construct file based backlog by providing a directory to write [ Record ] ( struct . Record . html ) files to .
pub fn new<P: AsRef<Path>>(dir: P) -> InfluxResult<Self>
    {
        let dir = PathBuf::from(dir.as_ref());
        if ! dir.is_dir() {
            return Err(format!("Backlog dir is not a directory: {:#?}", dir).into())
        }
        let mut archives = HashMap::new();
        let listing = std::fs::read_dir(&dir)
            .annotate(format!("While opening backlog directory: {:#?}", dir))?;
        for entry in listing
        {
            let entry = entry?;
            let path  = entry.path();
            let file  = Archive::open(&path)?;
            archives.insert(path, file);
        }
        Ok(Self {dir, archives})
    }
pub fn new < P : AsRef < Path > > ( dir : P ) -> InfluxResult < Self > { let dir = PathBuf :: from ( dir . as_ref ( ) ) ; if ! dir . is_dir ( ) { return Err ( format ! ( " " dir ) . into ( ) ) } let mut archives = HashMap :: new ( ) ; let listing = std :: fs :: read_dir ( & dir ) . annotate ( format ! ( " " dir ) ) ? ; for entry in listing { let entry = entry ? ; let path = entry . path ( ) ; let file = Archive :: open ( & path ) ? ; archives . insert ( path , file ) ; } Ok ( Self { dir , archives } ) }
Construct file based backlog by providing a directory to write [Record](struct.Record.html) files to.
Construct file based backlog by providing a directory to write [ Record ] ( struct . Record . html ) files to .
dir
P
dir
P