Skip to main content

BackendProjectStore

Trait BackendProjectStore 

Source
pub trait BackendProjectStore: Send + Sync {
    // Required methods
    fn change_repository(
        &self,
        org: &str,
        repo: &str,
    ) -> Result<Box<dyn ChangeRepository + Send>, DomainError>;
    fn module_repository(
        &self,
        org: &str,
        repo: &str,
    ) -> Result<Box<dyn ModuleRepository + Send>, DomainError>;
    fn task_repository(
        &self,
        org: &str,
        repo: &str,
    ) -> Result<Box<dyn TaskRepository + Send>, DomainError>;
    fn ensure_project(&self, org: &str, repo: &str) -> Result<(), DomainError>;
    fn project_exists(&self, org: &str, repo: &str) -> bool;
}
Expand description

Port for resolving {org}/{repo} to project-level repositories.

The backend server uses this trait to obtain domain repository instances for a given project namespace. Implementations live in ito-core and may be backed by the filesystem or a database.

This trait is Send + Sync so it can be shared across async request handlers via Arc.

Required Methods§

Source

fn change_repository( &self, org: &str, repo: &str, ) -> Result<Box<dyn ChangeRepository + Send>, DomainError>

Obtain a change repository for the given project.

Source

fn module_repository( &self, org: &str, repo: &str, ) -> Result<Box<dyn ModuleRepository + Send>, DomainError>

Obtain a module repository for the given project.

Source

fn task_repository( &self, org: &str, repo: &str, ) -> Result<Box<dyn TaskRepository + Send>, DomainError>

Obtain a task repository for the given project.

Source

fn ensure_project(&self, org: &str, repo: &str) -> Result<(), DomainError>

Ensure the project directory/storage structure exists.

Called before first write to a project. Implementations should create whatever backing store structure is needed.

Source

fn project_exists(&self, org: &str, repo: &str) -> bool

Check whether the project exists in the store.

Implementors§