saluki_core/topology/
context.rs

1use memory_accounting::MemoryLimiter;
2use saluki_health::HealthRegistry;
3use tokio::runtime::Handle;
4
5/// Topology context.
6#[derive(Clone)]
7pub struct TopologyContext {
8    memory_limiter: MemoryLimiter,
9    health_registry: HealthRegistry,
10    global_thread_pool: Handle,
11}
12
13impl TopologyContext {
14    /// Creates a new `TopologyContext`.
15    pub fn new(memory_limiter: MemoryLimiter, health_registry: HealthRegistry, global_thread_pool: Handle) -> Self {
16        Self {
17            memory_limiter,
18            health_registry,
19            global_thread_pool,
20        }
21    }
22
23    /// Gets a reference to the memory limiter.
24    pub fn memory_limiter(&self) -> &MemoryLimiter {
25        &self.memory_limiter
26    }
27
28    /// Gets a reference to the health registry.
29    pub fn health_registry(&self) -> &HealthRegistry {
30        &self.health_registry
31    }
32
33    /// Gets a reference to the global thread pool.
34    pub fn global_thread_pool(&self) -> &Handle {
35        &self.global_thread_pool
36    }
37}