-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PartitionProcessorManager as long-living service
- Loading branch information
1 parent
8bcdd4b
commit 70d9b11
Showing
12 changed files
with
210 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) 2024 - Restate Software, Inc., Restate GmbH. | ||
// All rights reserved. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the LICENSE file. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0. | ||
|
||
mod partition_processor_manager; | ||
|
||
pub use partition_processor_manager::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2024 - Restate Software, Inc., Restate GmbH. | ||
// All rights reserved. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the LICENSE file. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0. | ||
|
||
use restate_types::identifiers::PartitionId; | ||
use tokio::sync::{mpsc, oneshot}; | ||
|
||
use crate::ShutdownError; | ||
|
||
#[derive(Debug)] | ||
pub enum ProcessorsManagerCommand { | ||
GetLivePartitions(oneshot::Sender<Vec<PartitionId>>), | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct ProcessorsManagerHandle(mpsc::Sender<ProcessorsManagerCommand>); | ||
|
||
impl ProcessorsManagerHandle { | ||
pub fn new(sender: mpsc::Sender<ProcessorsManagerCommand>) -> Self { | ||
Self(sender) | ||
} | ||
|
||
pub async fn get_live_partitions(&self) -> Result<Vec<PartitionId>, ShutdownError> { | ||
let (tx, rx) = oneshot::channel(); | ||
self.0 | ||
.send(ProcessorsManagerCommand::GetLivePartitions(tx)) | ||
.await | ||
.unwrap(); | ||
rx.await.map_err(|_| ShutdownError) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.