Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ pub use temporal_sdk_core_protos::temporal::api::{
},
};
pub use tonic;
pub use worker_registry::{Slot, SlotManager, SlotProvider, WorkerKey};
pub use worker_registry::{
ClientWorker, ClientWorkerSet, HeartbeatCallback, SharedNamespaceWorkerTrait, Slot, WorkerKey,
};
pub use workflow_handle::{
GetWorkflowResultOpts, WorkflowExecutionInfo, WorkflowExecutionResult, WorkflowHandle,
};
Expand Down Expand Up @@ -388,7 +390,7 @@ pub struct ConfiguredClient<C> {
headers: Arc<RwLock<ClientHeaders>>,
/// Capabilities as read from the `get_system_info` RPC call made on client connection
capabilities: Option<get_system_info_response::Capabilities>,
workers: Arc<SlotManager>,
workers: Arc<ClientWorkerSet>,
Comment thread
yuandrew marked this conversation as resolved.
}

impl<C> ConfiguredClient<C> {
Expand Down Expand Up @@ -438,9 +440,14 @@ impl<C> ConfiguredClient<C> {
}

/// Returns a cloned reference to a registry with workers using this client instance
pub fn workers(&self) -> Arc<SlotManager> {
pub fn workers(&self) -> Arc<ClientWorkerSet> {
self.workers.clone()
}

/// Returns the worker set key, this should be unique across each client
pub fn worker_set_key(&self) -> Uuid {
self.workers.worker_set_key()
}
}

#[derive(Debug)]
Expand Down Expand Up @@ -584,7 +591,7 @@ impl ClientOptions {
client: TemporalServiceClient::new(svc),
options: Arc::new(self.clone()),
capabilities: None,
workers: Arc::new(SlotManager::new()),
workers: Arc::new(ClientWorkerSet::new()),
};
if !self.skip_get_system_info {
match client
Expand Down Expand Up @@ -901,6 +908,11 @@ impl Client {
pub fn into_inner(self) -> ConfiguredClient<TemporalServiceClientWithMetrics> {
self.inner
}

/// Returns the process-wide key
pub fn worker_set_key(&self) -> Uuid {
self.inner.worker_set_key()
}
}

impl NamespacedClient for Client {
Expand Down
12 changes: 6 additions & 6 deletions client/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
TEMPORAL_NAMESPACE_HEADER_KEY, TemporalServiceClient,
metrics::{namespace_kv, task_queue_kv},
raw::sealed::RawClientLike,
worker_registry::{Slot, SlotManager},
worker_registry::{ClientWorkerSet, Slot},
};
use futures_util::{FutureExt, TryFutureExt, future::BoxFuture};
use std::sync::Arc;
Expand Down Expand Up @@ -68,7 +68,7 @@ pub(super) mod sealed {
fn health_client_mut(&mut self) -> &mut HealthClient<Self::SvcType>;

/// Return a registry with workers using this client instance
fn get_workers_info(&self) -> Option<Arc<SlotManager>>;
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>>;

async fn call<F, Req, Resp>(
&mut self,
Expand Down Expand Up @@ -134,7 +134,7 @@ where
self.get_client_mut().health_client_mut()
}

fn get_workers_info(&self) -> Option<Arc<SlotManager>> {
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
self.get_client().get_workers_info()
}

Expand Down Expand Up @@ -213,7 +213,7 @@ where
self.health_svc_mut()
}

fn get_workers_info(&self) -> Option<Arc<SlotManager>> {
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
None
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ where
self.client.health_client_mut()
}

fn get_workers_info(&self) -> Option<Arc<SlotManager>> {
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
Some(self.workers())
}
}
Expand Down Expand Up @@ -316,7 +316,7 @@ impl RawClientLike for Client {
self.inner.health_client_mut()
}

fn get_workers_info(&self) -> Option<Arc<SlotManager>> {
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
self.inner.get_workers_info()
}
}
Expand Down
Loading
Loading