(&self, collection: &str, doc_id: &str)
| 11 | |
| 12 | impl<'a> DocumentEngine<'a> { |
| 13 | pub fn delete(&self, collection: &str, doc_id: &str) -> crate::Result<bool> { |
| 14 | if self.is_bitemporal(collection) { |
| 15 | let prior_body = |
| 16 | self.sparse |
| 17 | .versioned_get_current(self.tenant_id, collection, doc_id)?; |
| 18 | let Some(body) = prior_body else { |
| 19 | return Ok(false); |
| 20 | }; |
| 21 | let sys_from = wall_now_ms(); |
| 22 | self.sparse |
| 23 | .versioned_tombstone(self.tenant_id, collection, doc_id, sys_from)?; |
| 24 | if let Some(config) = self.configs.get(collection) |
| 25 | && let Ok(rmpv_val) = rmpv::decode::read_value(&mut &body[..]) |
| 26 | { |
| 27 | for index_path in &config.index_paths { |
| 28 | for v in |
| 29 | extract_index_values_rmpv(&rmpv_val, &index_path.path, index_path.is_array) |
| 30 | { |
| 31 | self.sparse.versioned_index_tombstone( |
| 32 | self.tenant_id, |
| 33 | collection, |
| 34 | &index_path.path, |
| 35 | &v, |
| 36 | doc_id, |
| 37 | sys_from, |
| 38 | )?; |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | return Ok(true); |
| 43 | } |
| 44 | self.sparse |
| 45 | .delete_indexes_for_document(self.tenant_id, collection, doc_id)?; |
| 46 | Ok(self |
| 47 | .sparse |
| 48 | .delete(self.tenant_id, collection, doc_id)? |
| 49 | .is_some()) |
| 50 | } |
| 51 | } |
nothing calls this directly
no test coverage detected