Use the store's tables in an already-open database, creating any that are missing.
(db: Arc<Database>)
| 320 | /// Use the store's tables in an already-open database, creating any that |
| 321 | /// are missing. |
| 322 | pub fn from_database(db: Arc<Database>) -> RedbStoreResult<Self> { |
| 323 | atomic_core::pristine::schema::check_schema_version(&db.begin_read()?) |
| 324 | .map_err(|error| RedbStoreError::Corrupt(error.to_string()))?; |
| 325 | { |
| 326 | let txn = db.begin_write()?; |
| 327 | { |
| 328 | let _ = txn.open_table(tables::CHANGE_META)?; |
| 329 | let _ = txn.open_table(tables::CHANGE_GRAPH)?; |
| 330 | let _ = txn.open_table(tables::CHANGE_SEMANTIC)?; |
| 331 | let _ = txn.open_table(tables::CONTENT_CHUNKS)?; |
| 332 | let _ = txn.open_table(tables::CHANGE_CHUNKS)?; |
| 333 | let _ = txn.open_table(tables::CHANGE_UNHASHED)?; |
| 334 | let _ = txn.open_table(tables::CHANGE_SIGNATURES)?; |
| 335 | Self::initialize_provenance_tables(&txn)?; |
| 336 | let _ = txn.open_table(tables::SESSION_LOG)?; |
| 337 | let _ = txn.open_table(tables::SESSION_LOG_IDS)?; |
| 338 | let _ = txn.open_table(tables::SESSION_LOG_INDEX)?; |
| 339 | } |
| 340 | txn.commit()?; |
| 341 | } |
| 342 | |
| 343 | Ok(Self { db }) |
| 344 | } |
| 345 | |
| 346 | /// Get a reference to the underlying database. |
| 347 | pub(crate) fn db(&self) -> &Database { |
nothing calls this directly
no test coverage detected