locus_sdk/domain/
evict.rs1use serde::{Deserialize, Serialize};
2
3use crate::domain::memory::{MemoryFilter, MemoryScope};
4
5#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
6#[serde(rename_all = "snake_case")]
7pub enum MemoryEvictMode {
8 #[default]
9 BySyncKeys,
10 ByNodeIds,
11 ByFilter,
12 PurgeSession,
13}
14
15#[derive(Debug, Clone, Default, Serialize, Deserialize)]
16#[serde(rename_all = "camelCase")]
17pub struct MemoryEvictRequest {
18 pub mode: MemoryEvictMode,
19 pub scope: MemoryScope,
20 pub filter: MemoryFilter,
21 pub sync_keys: Option<Vec<String>>,
22 pub node_ids: Option<Vec<String>>,
23 pub dry_run: bool,
24 pub force: bool,
25 pub max_nodes: usize,
26 pub include_calibration: bool,
27 pub include_checkpoints: bool,
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(rename_all = "camelCase")]
32pub struct MemoryEvictRecord {
33 pub node_id: String,
34 pub sync_key: String,
35 pub status: String,
36 pub reason: Option<String>,
37 pub inbound_references: Option<InboundReferencesPreview>,
38}
39
40#[derive(Debug, Clone, Default, Serialize, Deserialize)]
41#[serde(rename_all = "camelCase")]
42pub struct InboundReferencesPreview {
43 pub child_parent_links: Vec<String>,
44 pub incoming_semantic_refs: Vec<String>,
45}
46
47#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48#[serde(rename_all = "camelCase")]
49pub struct MemoryEvictResult {
50 pub dry_run: bool,
51 pub deleted: usize,
52 pub blocked: usize,
53 pub not_found: usize,
54 pub skipped: usize,
55 pub would_delete: Vec<String>,
56 pub calibrations_deleted: usize,
57 pub checkpoints_deleted: usize,
58 pub records: Vec<MemoryEvictRecord>,
59}