diff options
Diffstat (limited to 'src/storage')
| -rw-r--r-- | src/storage/mod.rs | 6 |
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; | |||
| 12 | pub struct Storage { | 12 | pub 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 | ||
| 17 | impl Storage { | 18 | impl 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); |