2023-05-17 12:08:17 +00:00
|
|
|
use crate::error;
|
2023-05-09 14:37:06 +00:00
|
|
|
|
2023-05-04 12:56:31 +00:00
|
|
|
mod descr;
|
|
|
|
pub use self::descr::Descr;
|
|
|
|
pub mod store;
|
2023-05-09 14:37:06 +00:00
|
|
|
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
|
|
pub enum ReadFileIntoError {
|
|
|
|
#[error("file not found")]
|
|
|
|
FileNotFound,
|
|
|
|
|
|
|
|
#[error(transparent)]
|
2023-05-17 12:08:17 +00:00
|
|
|
Unexpected(#[from] error::Unexpected),
|
2023-05-09 14:37:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[mockall::automock]
|
|
|
|
/// Describes an origin which has already been synced locally and is available for reading files
|
|
|
|
/// from.
|
|
|
|
pub trait Origin {
|
|
|
|
fn descr(&self) -> &Descr;
|
|
|
|
fn read_file_into(
|
|
|
|
&self,
|
|
|
|
path: &str,
|
|
|
|
into: &mut dyn std::io::Write,
|
|
|
|
) -> Result<(), ReadFileIntoError>;
|
|
|
|
}
|