relay_knowledge/domain/graph/retrieval/
backend.rs1use serde::{Deserialize, Serialize};
2
3use super::super::GraphVersion;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
7#[serde(rename_all = "snake_case")]
8pub enum RetrieverSource {
9 Bm25,
10 GraphEvidence,
11 CodeGraph,
12 Semantic,
13 Vector,
14 GraphPath,
15 Temporal,
16 CommunitySummary,
17}
18
19impl RetrieverSource {
20 pub const fn as_str(self) -> &'static str {
22 match self {
23 Self::Bm25 => "bm25",
24 Self::GraphEvidence => "graph_evidence",
25 Self::CodeGraph => "code_graph",
26 Self::Semantic => "semantic",
27 Self::Vector => "vector",
28 Self::GraphPath => "graph_path",
29 Self::Temporal => "temporal",
30 Self::CommunitySummary => "community_summary",
31 }
32 }
33}
34
35#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
37#[serde(rename_all = "snake_case")]
38pub enum RetrievalBackendState {
39 Available,
40 Degraded,
41 Unavailable,
42}
43
44#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
47pub struct RetrievalBackendStatus {
48 pub source: RetrieverSource,
49 pub state: RetrievalBackendState,
50 pub scope_post_filter: bool,
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub indexed_graph_version: Option<GraphVersion>,
53 #[serde(skip_serializing_if = "Option::is_none")]
54 pub reason: Option<String>,
55}
56
57#[cfg(test)]
58#[path = "backend_tests.rs"]
59mod tests;