Skip to content

Commit

Permalink
feat: expose RegionMigrationProcedureTask
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Jan 3, 2024
1 parent 2c17a94 commit 5f7cfc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/meta-srv/src/procedure/region_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use common_procedure::error::{
Error as ProcedureError, FromJsonSnafu, Result as ProcedureResult, ToJsonSnafu,
};
use common_procedure::{Context as ProcedureContext, LockKey, Procedure, Status};
pub use manager::RegionMigrationProcedureTask;
use serde::{Deserialize, Serialize};
use snafu::{location, Location, OptionExt, ResultExt};
use store_api::storage::RegionId;
Expand Down
15 changes: 13 additions & 2 deletions src/meta-srv/src/procedure/region_migration/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,24 @@ impl Drop for RegionMigrationProcedureGuard {
}

#[derive(Debug, Clone)]
pub(crate) struct RegionMigrationProcedureTask {
pub struct RegionMigrationProcedureTask {
pub(crate) cluster_id: ClusterId,
pub(crate) region_id: RegionId,
pub(crate) from_peer: Peer,
pub(crate) to_peer: Peer,
}

impl RegionMigrationProcedureTask {
pub fn new(cluster_id: ClusterId, region_id: RegionId, from_peer: Peer, to_peer: Peer) -> Self {
Self {
cluster_id,
region_id,
from_peer,
to_peer,
}
}
}

impl Display for RegionMigrationProcedureTask {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
Expand Down Expand Up @@ -223,7 +234,7 @@ impl RegionMigrationManager {
}

/// Submits a new region migration procedure.
pub(crate) async fn submit_procedure(
pub async fn submit_procedure(
&self,
task: RegionMigrationProcedureTask,
) -> Result<Option<ProcedureId>> {
Expand Down

0 comments on commit 5f7cfc7

Please sign in to comment.