Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
radicle-desktop crates radicle-types src domain patch traits.rs
use radicle::identity;
use radicle::patch;
use radicle::patch::Patch;
use radicle::patch::PatchId;

use crate::domain::patch::models;

pub trait PatchStorage {
    fn list(
        &self,
        rid: identity::RepoId,
    ) -> Result<impl Iterator<Item = (PatchId, Patch)>, models::patch::ListPatchesError>;

    fn list_by_status(
        &self,
        rid: identity::RepoId,
        status: patch::Status,
    ) -> Result<impl Iterator<Item = (PatchId, Patch)>, models::patch::ListPatchesError>;

    fn counts(
        &self,
        rid: identity::RepoId,
    ) -> Result<models::patch::PatchCounts, models::patch::CountsError>;
}

pub trait PatchService {
    fn list(
        &self,
        rid: identity::RepoId,
    ) -> Result<impl Iterator<Item = (PatchId, Patch)>, models::patch::ListPatchesError>;

    fn list_by_status(
        &self,
        rid: identity::RepoId,
        status: patch::Status,
    ) -> Result<impl Iterator<Item = (PatchId, Patch)>, models::patch::ListPatchesError>;

    fn counts(
        &self,
        rid: identity::RepoId,
    ) -> Result<models::patch::PatchCounts, models::patch::CountsError>;
}