agentstatedeveloper_core/
paths.rs1pub const ASD_ROOT: &str = "/asd/v1";
6
7pub fn clean(p: &str) -> String {
8 p.trim_start_matches('/').replace("//", "/")
9}
10
11pub fn code_path(lang: &str, file: &str, symbol_fp: &str) -> String {
12 format!("{}/code/{}/{}/{}", ASD_ROOT, lang, clean(file), symbol_fp)
13}
14
15pub fn qname_index_path(qname: &str) -> String {
16 format!("{}/index/by-qname/{}", ASD_ROOT, qname)
17}
18
19pub fn callers_path(symbol_id: &str) -> String {
20 format!("{}/index/callers/{}", ASD_ROOT, symbol_id)
21}
22
23pub fn callees_path(symbol_id: &str) -> String {
24 format!("{}/index/callees/{}", ASD_ROOT, symbol_id)
25}
26
27pub fn effects_reverse_index_path(effect: &str, symbol_id: &str) -> String {
28 format!("{}/index/effects-rev/{}/{}", ASD_ROOT, effect, symbol_id)
29}
30
31pub fn endpoint_contract_prefix(contract_hash: &str) -> String {
43 format!("{}/index/endpoints/{}", ASD_ROOT, contract_hash)
44}
45
46pub fn endpoint_path(contract_hash: &str, repo_id: &str, symbol_id: &str) -> String {
49 format!(
50 "{}/index/endpoints/{}/{}/{}",
51 ASD_ROOT, contract_hash, repo_id, symbol_id
52 )
53}
54
55pub fn service_manifest_path() -> String {
58 format!("{}/meta/service-manifest", ASD_ROOT)
59}
60
61pub fn edge_evidence_path(from_symbol_id: &str, to_symbol_id: &str) -> String {
64 format!(
65 "{}/index/edge-evidence/{}/{}",
66 ASD_ROOT, from_symbol_id, to_symbol_id
67 )
68}
69
70pub fn edge_evidence_from_prefix(from_symbol_id: &str) -> String {
72 format!("{}/index/edge-evidence/{}", ASD_ROOT, from_symbol_id)
73}
74
75pub fn ledger_root() -> String {
77 format!("{}/ledger", ASD_ROOT)
78}
79
80pub fn ledger_entry_path(symbol_id: &str, entry_id: &str) -> String {
81 format!("{}/ledger/{}/{}", ASD_ROOT, symbol_id, entry_id)
82}
83
84pub fn ledger_symbol_path(symbol_id: &str) -> String {
85 format!("{}/ledger/{}", ASD_ROOT, symbol_id)
86}
87
88pub fn effects_path(symbol_id: &str) -> String {
89 format!("{}/effects/{}", ASD_ROOT, symbol_id)
90}
91
92pub fn traces_path(symbol_id: &str, trace_id: &str) -> String {
93 format!("{}/traces/{}/{}", ASD_ROOT, symbol_id, trace_id)
94}
95
96pub fn file_meta_path(file: &str) -> String {
97 format!("{}/meta/files/{}", ASD_ROOT, clean(file))
98}
99
100pub fn schema_version_path() -> String {
101 format!("{}/meta/schema-version", ASD_ROOT)
102}
103
104pub fn rebind_path(from_symbol_id: &str) -> String {
105 format!("{}/rebinds/{}", ASD_ROOT, from_symbol_id)
106}
107
108pub fn ledger_index_root() -> String {
112 format!("{}/ledger-idx", ASD_ROOT)
113}
114
115pub fn ledger_entry_index_path(entry_id: &str) -> String {
116 format!("{}/ledger-idx/{}", ASD_ROOT, entry_id)
117}
118
119pub fn scratch_root() -> &'static str {
126 "/asd/v1/scratch"
127}
128
129pub fn scratch_entry_path(scratch_id: &str) -> String {
131 format!("/asd/v1/scratch/{}", scratch_id)
132}
133
134pub fn feedback_entry_path(symbol_id: &str, entry_id: &str) -> String {
139 format!("{}/feedback/{}/{}", ASD_ROOT, symbol_id, entry_id)
140}
141
142pub fn feedback_symbol_path(symbol_id: &str) -> String {
143 format!("{}/feedback/{}", ASD_ROOT, symbol_id)
144}