Get statistics about the store.
(&self)
| 244 | |
| 245 | /// Get statistics about the store. |
| 246 | pub fn stats(&self) -> RedbStoreResult<StoreStats> { |
| 247 | let txn = self.db().begin_read()?; |
| 248 | |
| 249 | let change_count = count_table_entries(&txn, tables::CHANGE_META)?; |
| 250 | let graph_section_count = count_table_entries(&txn, tables::CHANGE_GRAPH)?; |
| 251 | let semantic_section_count = count_table_entries(&txn, tables::CHANGE_SEMANTIC)?; |
| 252 | let content_chunk_count = count_table_entries(&txn, tables::CONTENT_CHUNKS)?; |
| 253 | let change_chunk_mappings = count_table_entries(&txn, tables::CHANGE_CHUNKS)?; |
| 254 | let unhashed_count = count_table_entries(&txn, tables::CHANGE_UNHASHED)?; |
| 255 | |
| 256 | Ok(StoreStats { |
| 257 | change_count, |
| 258 | graph_section_count, |
| 259 | semantic_section_count, |
| 260 | content_chunk_count, |
| 261 | change_chunk_mappings, |
| 262 | unhashed_count, |
| 263 | }) |
| 264 | } |
| 265 | |
| 266 | /// Check if a content chunk exists in the store (by its content hash). |
| 267 | /// |