Skip to main content

saluki_core/topology/
context.rs

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