1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Centralized memory management with pressure handling.
//!
//! When you need to control total memory usage across the database (not just
//! individual allocations), this is what you use. The [`BufferManager`] tracks
//! all allocations, monitors memory pressure, and can trigger spilling when
//! you're running low.
//!
//! # Architecture
//!
//! ```text
//! ┌────────────────────────────────────────────────────────────┐
//! │ BufferManager │
//! │ ┌──────────────┬──────────────┬──────────────┬──────────┐ │
//! │ │ GraphStorage │ IndexBuffers │ Execution │ Spill │ │
//! │ │ │ │ Buffers │ Staging │ │
//! │ └──────────────┴──────────────┴──────────────┴──────────┘ │
//! │ │ │
//! │ Pressure Thresholds: │ │
//! │ < 70% Normal │ │
//! │ 70-85% Moderate (evict cold) │
//! │ 85-95% High (aggressive evict/spill) │
//! │ > 95% Critical (block allocations) │
//! └────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Usage
//!
//! ```no_run
//! use grafeo_common::memory::buffer::{BufferManager, MemoryRegion};
//!
//! // Create with default config (75% of system RAM)
//! let manager = BufferManager::with_defaults();
//!
//! // Or with specific budget
//! let manager = BufferManager::with_budget(1024 * 1024 * 100); // 100MB
//!
//! // Allocate memory
//! if let Some(grant) = manager.try_allocate(1024, MemoryRegion::ExecutionBuffers) {
//! // Use the memory...
//! // Memory is automatically released when grant is dropped
//! }
//!
//! // Check pressure level
//! let level = manager.pressure_level();
//! if level.should_spill() {
//! // Trigger spilling for spillable operators
//! }
//! ```
pub use ;
pub use ;
pub use ;
pub use MemoryRegion;
pub use ;