Skip to content

Commit

Permalink
Implement safety checks in SoT migration tool
Browse files Browse the repository at this point in the history
Summary:
Now we check for:
- If the repo is enabled in config?
- If the repo is unlocked in the config for writing?
- If the repo is unlocked in the DB for writing?

I will also add a check for validating hooks are enabled for the repo in a follow up diff.

Reviewed By: markbt

Differential Revision: D63893886

fbshipit-source-id: 5b27189af92ecfc03619ee191740aea0ea820a7c
  • Loading branch information
RajivTS authored and facebook-github-bot committed Oct 6, 2024
1 parent 9da5863 commit 11c5284
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions eden/mononoke/metaconfig/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions eden/mononoke/repo_attributes/repo_lock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 11c5284

Please sign in to comment.