upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/storage/mod.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 14:33:18 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 14:33:18 +0000
commitc2c0cdba4af434043f3fa707231d8f5a7e3fd882 (patch)
tree02adae65fba476e5fcdf1fadcd0ce9efa4f1fbcd /src/storage/mod.rs
parent4d89f4537c325f60571cc6339df0708ee8161514 (diff)
add announcement tests
Diffstat (limited to 'src/storage/mod.rs')
-rw-r--r--src/storage/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/storage/mod.rs b/src/storage/mod.rs
index 2ec6d4e..eab8211 100644
--- a/src/storage/mod.rs
+++ b/src/storage/mod.rs
@@ -12,6 +12,7 @@ use crate::config::Config;
12pub struct Storage { 12pub struct Storage {
13 events: Arc<RwLock<HashMap<String, Event>>>, 13 events: Arc<RwLock<HashMap<String, Event>>>,
14 data_path: String, 14 data_path: String,
15 domain: String,
15} 16}
16 17
17impl Storage { 18impl Storage {
@@ -22,9 +23,14 @@ impl Storage {
22 Ok(Storage { 23 Ok(Storage {
23 events: Arc::new(RwLock::new(HashMap::new())), 24 events: Arc::new(RwLock::new(HashMap::new())),
24 data_path: config.relay_data_path.clone(), 25 data_path: config.relay_data_path.clone(),
26 domain: config.domain.clone(),
25 }) 27 })
26 } 28 }
27 29
30 pub fn get_domain(&self) -> String {
31 self.domain.clone()
32 }
33
28 pub async fn store_event(&self, event: Event) -> Result<()> { 34 pub async fn store_event(&self, event: Event) -> Result<()> {
29 let mut events = self.events.write().await; 35 let mut events = self.events.write().await;
30 events.insert(event.id.to_hex(), event); 36 events.insert(event.id.to_hex(), event);