| 148 | |
| 149 | #[inline] |
| 150 | pub async fn subscribe<K, Doc>(&self, sender: Sender<Event<K, Doc>>) -> Result<(), SessionResult> |
| 151 | where |
| 152 | Doc: Serialize + DeserializeOwned + Clone + Send + 'static + Document, |
| 153 | K: Serialize |
| 154 | + DeserializeOwned |
| 155 | + PartialOrd |
| 156 | + Ord |
| 157 | + PartialEq |
| 158 | + Eq |
| 159 | + Hash |
| 160 | + Clone |
| 161 | + Send |
| 162 | + Sync |
| 163 | + 'static |
| 164 | { |
| 165 | match self.datastores.get::<Storage<K, Doc>>() { |
| 166 | None => Err(SessionResult::DataStoreNotFound), |
| 167 | Some(datastore) => { |
| 168 | datastore.subscribe(sender).await |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | #[inline] |
| 174 | pub async fn insert<K, Doc>(&self, key: K, doc: Doc) -> Result<(), SessionResult> |