Skip to main content

saluki_core/topology/
context.rs

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