Skip to content

Commit

Permalink
feat: expose RegionMigrationManagerRef (#4812)
Browse files Browse the repository at this point in the history
* chore: expose `RegionMigrationProcedureTask`

* fix: fix typos

* chore: expose `tracker`
  • Loading branch information
WenyXu authored Oct 11, 2024
1 parent 288fdc3 commit 695ff1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/meta-srv/src/procedure/region_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ use common_procedure::error::{
Error as ProcedureError, FromJsonSnafu, Result as ProcedureResult, ToJsonSnafu,
};
use common_procedure::{Context as ProcedureContext, LockKey, Procedure, Status, StringKey};
pub use manager::RegionMigrationProcedureTask;
use manager::{RegionMigrationProcedureGuard, RegionMigrationProcedureTracker};
use manager::RegionMigrationProcedureGuard;
pub use manager::{
RegionMigrationManagerRef, RegionMigrationProcedureTask, RegionMigrationProcedureTracker,
};
use serde::{Deserialize, Serialize};
use snafu::{OptionExt, ResultExt};
use store_api::storage::RegionId;
Expand Down
4 changes: 2 additions & 2 deletions src/meta-srv/src/procedure/region_migration/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct RegionMigrationManager {
}

#[derive(Default, Clone)]
pub(crate) struct RegionMigrationProcedureTracker {
pub struct RegionMigrationProcedureTracker {
running_procedures: Arc<RwLock<HashMap<RegionId, RegionMigrationProcedureTask>>>,
}

Expand Down Expand Up @@ -149,7 +149,7 @@ impl RegionMigrationManager {
}

/// Returns the [`RegionMigrationProcedureTracker`].
pub(crate) fn tracker(&self) -> &RegionMigrationProcedureTracker {
pub fn tracker(&self) -> &RegionMigrationProcedureTracker {
&self.tracker
}

Expand Down
8 changes: 4 additions & 4 deletions src/meta-srv/src/region/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl RegionFailureDetectorController for RegionFailureDetectorControl {
.send(Event::RegisterFailureDetectors(detecting_regions))
.await
{
error!(err; "RegionSupervisor is stop receiving heartbeat");
error!(err; "RegionSupervisor has stop receiving heartbeat.");
}
}

Expand All @@ -233,7 +233,7 @@ impl RegionFailureDetectorController for RegionFailureDetectorControl {
.send(Event::DeregisterFailureDetectors(detecting_regions))
.await
{
error!(err; "RegionSupervisor is stop receiving heartbeat");
error!(err; "RegionSupervisor has stop receiving heartbeat.");
}
}
}
Expand All @@ -251,13 +251,13 @@ impl HeartbeatAcceptor {
/// Accepts heartbeats from datanodes.
pub(crate) async fn accept(&self, heartbeat: DatanodeHeartbeat) {
if let Err(err) = self.sender.send(Event::HeartbeatArrived(heartbeat)).await {
error!(err; "RegionSupervisor is stop receiving heartbeat");
error!(err; "RegionSupervisor has stop receiving heartbeat.");
}
}
}

impl RegionSupervisor {
/// Returns a a mpsc channel with a buffer capacity of 1024 for sending and receiving `Event` messages.
/// Returns a mpsc channel with a buffer capacity of 1024 for sending and receiving `Event` messages.
pub(crate) fn channel() -> (Sender<Event>, Receiver<Event>) {
tokio::sync::mpsc::channel(1024)
}
Expand Down

0 comments on commit 695ff1e

Please sign in to comment.