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 task_mutation_service(
        &self,
        org: &str,
        repo: &str,
    ) -> Result<Box<dyn TaskMutationService + Send>, DomainError>;
    fn spec_repository(
        &self,
        org: &str,
        repo: &str,
    ) -> Result<Box<dyn SpecRepository + Send>, DomainError>;
    fn pull_artifact_bundle(
        &self,
        org: &str,
        repo: &str,
        change_id: &str,
    ) -> Result<ArtifactBundle, BackendError>;
    fn push_artifact_bundle(
        &self,
        org: &str,
        repo: &str,
        change_id: &str,
        bundle: &ArtifactBundle,
    ) -> Result<PushResult, BackendError>;
    fn archive_change(
        &self,
        org: &str,
        repo: &str,
        change_id: &str,
    ) -> Result<ArchiveResult, BackendError>;
    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 task_mutation_service( &self, org: &str, repo: &str, ) -> Result<Box<dyn TaskMutationService + Send>, DomainError>

Obtain a task mutation service for the given project.

Source

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

Obtain a promoted spec repository for the given project.

Source

fn pull_artifact_bundle( &self, org: &str, repo: &str, change_id: &str, ) -> Result<ArtifactBundle, BackendError>

Pull the latest artifact bundle for a change from backend-managed storage.

Source

fn push_artifact_bundle( &self, org: &str, repo: &str, change_id: &str, bundle: &ArtifactBundle, ) -> Result<PushResult, BackendError>

Push an updated artifact bundle into backend-managed storage.

Source

fn archive_change( &self, org: &str, repo: &str, change_id: &str, ) -> Result<ArchiveResult, BackendError>

Archive a change in backend-managed storage and mirror promoted specs.

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§