You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
mod config;
|
|
pub mod descr;
|
|
pub mod git;
|
|
pub mod git_proxy;
|
|
pub mod mux;
|
|
|
|
pub use config::*;
|
|
pub use descr::Descr;
|
|
|
|
use crate::error::unexpected;
|
|
use crate::util;
|
|
|
|
#[derive(thiserror::Error, Clone, Debug, PartialEq)]
|
|
pub enum SyncError {
|
|
#[error("invalid url")]
|
|
InvalidURL,
|
|
|
|
#[error("invalid branch name")]
|
|
InvalidBranchName,
|
|
|
|
#[error("already in progress")]
|
|
AlreadyInProgress,
|
|
|
|
#[error(transparent)]
|
|
Unexpected(#[from] unexpected::Error),
|
|
}
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum GetFileError {
|
|
#[error("descr not synced")]
|
|
DescrNotSynced,
|
|
|
|
#[error("file not found")]
|
|
FileNotFound,
|
|
|
|
#[error("path is directory")]
|
|
PathIsDirectory,
|
|
|
|
#[error(transparent)]
|
|
Unexpected(#[from] unexpected::Error),
|
|
}
|
|
|
|
/// Describes a storage mechanism for Origins. Each Origin is uniquely identified by its Descr.
|
|
pub trait Store {
|
|
/// If the origin is of a kind which can be updated, sync will pull down the latest version of
|
|
/// the origin into the storage.
|
|
fn sync(&self, descr: &Descr) -> util::BoxFuture<'_, Result<(), SyncError>>;
|
|
|
|
fn get_file(&self, descr: &Descr, path: &str) -> Result<util::BoxByteStream, GetFileError>;
|
|
}
|
|
|