diff --git a/eden/mononoke/metaconfig/types/src/lib.rs b/eden/mononoke/metaconfig/types/src/lib.rs index 53a1c06a585c0..5de10185ceae6 100644 --- a/eden/mononoke/metaconfig/types/src/lib.rs +++ b/eden/mononoke/metaconfig/types/src/lib.rs @@ -508,6 +508,16 @@ pub enum RepoReadOnly { ReadWrite, } +impl RepoReadOnly { + /// Returns true if the repo is read-only + pub fn is_read_only(&self) -> bool { + match self { + RepoReadOnly::ReadOnly(_) => true, + RepoReadOnly::ReadWrite => false, + } + } +} + /// Configuration of warming up the Mononoke cache. This warmup happens on startup #[derive(Debug, Clone, Eq, PartialEq)] pub struct CacheWarmupParams { diff --git a/eden/mononoke/repo_attributes/repo_lock/src/lib.rs b/eden/mononoke/repo_attributes/repo_lock/src/lib.rs index c34b7470cb615..0c65e64bde178 100644 --- a/eden/mononoke/repo_attributes/repo_lock/src/lib.rs +++ b/eden/mononoke/repo_attributes/repo_lock/src/lib.rs @@ -28,6 +28,16 @@ pub enum RepoLockState { Unlocked, } +impl RepoLockState { + /// Returns true if the repo is locked, false otherwise. + pub fn is_locked(&self) -> bool { + match self { + RepoLockState::Locked(_) => true, + RepoLockState::Unlocked => false, + } + } +} + #[facet::facet] #[async_trait] pub trait RepoLock: Send + Sync {