mod file;
use std::fmt::Debug;
pub use file::FileBacklog;
use crate::Record;
use crate::InfluxResult;
pub trait Backlog: Debug + Send + Sync
{
fn read_pending(&mut self) -> InfluxResult<Vec<Record>>;
fn write_pending(&mut self, record: &Record) -> InfluxResult<()>;
fn truncate_pending(&mut self, record: &Record) -> InfluxResult<()>;
}
#[derive(Debug)]
pub struct NoopBacklog;
impl NoopBacklog
{
pub fn new() -> Self
{
Self {}
}
}
impl Backlog for NoopBacklog
{
fn read_pending(&mut self) -> InfluxResult<Vec<Record>> {
Ok(Vec::new())
}
fn write_pending(&mut self, _: &Record) -> InfluxResult<()> {
Ok(())
}
fn truncate_pending(&mut self, _: &Record) -> InfluxResult<()> {
Ok(())
}
}