Struct Repo

Source
pub struct Repo {
    pub id: RepoId,
    pub repo_def: Repository,
    pub read_cap: Option<ReadCap>,
    pub write_cap: Option<RepoWriteCapSecret>,
    pub signer: Option<SignerCap>,
    pub certificate_ref: Option<ObjectRef>,
    pub members: HashMap<Digest, UserInfo>,
    pub branches: HashMap<BranchId, BranchInfo>,
    pub opened_branches: HashMap<BranchId, bool>,
    pub store: Arc<Store>,
}
Expand description

In memory Repository representation. With helper functions that access the underlying UserStorage and keeps proxy of the values

Fields§

§id: RepoId§repo_def: Repository

Repo definition

§read_cap: Option<ReadCap>§write_cap: Option<RepoWriteCapSecret>§signer: Option<SignerCap>§certificate_ref: Option<ObjectRef>§members: HashMap<Digest, UserInfo>§branches: HashMap<BranchId, BranchInfo>§opened_branches: HashMap<BranchId, bool>

if opened_branches is empty, it means the repo has not been opened yet. if a branchId is present in the hashmap, it means it is opened. the boolean indicates if the branch is opened as publisher or not

§store: Arc<Store>

Implementations§

Source§

impl Repo

Source

pub fn history_at_heads( &self, heads: &[ObjectRef], ) -> Result<(Vec<(ObjectId, CommitInfo)>, Vec<Option<ObjectId>>), VerifierError>

Source

pub fn update_branch_current_heads( &mut self, branch: &BranchId, commit_ref: ObjectRef, past: Vec<ObjectRef>, ) -> Result<Vec<ObjectRef>, VerifierError>

Source

pub fn new_with_member( repo_id: &PubKey, member: &UserId, perms: &[PermissionV0], store: Arc<Store>, ) -> Self

Source

pub fn verify_permission(&self, commit: &Commit) -> Result<(), NgError>

Source

pub fn member_pubkey(&self, hash: &Digest) -> Result<UserId, NgError>

Source

pub fn branch(&self, id: &BranchId) -> Result<&BranchInfo, NgError>

Source

pub fn branch_mut(&mut self, id: &BranchId) -> Result<&mut BranchInfo, NgError>

Source

pub fn overlay_branch(&self) -> Option<&BranchInfo>

Source

pub fn user_branch(&self) -> Option<&BranchInfo>

Source

pub fn main_branch(&self) -> Option<&BranchInfo>

Source

pub fn store_branch(&self) -> Option<&BranchInfo>

Source

pub fn header_branch(&self) -> Option<&BranchInfo>

Source

pub fn root_branch(&self) -> Option<&BranchInfo>

Source

pub fn overlay_branch_read_cap(&self) -> Option<&ReadCap>

Source

pub fn branch_is_opened(&self, branch: &BranchId) -> bool

Source

pub fn branch_is_opened_as_publisher(&self, branch: &BranchId) -> bool

Trait Implementations§

Source§

impl Debug for Repo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Repo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Repo

§

impl RefUnwindSafe for Repo

§

impl Send for Repo

§

impl Sync for Repo

§

impl Unpin for Repo

§

impl UnwindSafe for Repo

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V