Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3. refactor(state): move database reads and writes to a new zebra_db module #3579

Merged
merged 6 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,17 @@ jobs:
persist-credentials: false
fetch-depth: '2'

# only run this job if the database format might have changed
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v14.4
with:
files: |
/zebra-state/**/constants.rs
/zebra-state/**/finalized_state.rs
/zebra-state/**/disk_format.rs
/zebra-state/**/disk_db.rs
/zebra-state/**/finalized_state.rs
/zebra-state/**/constants.rs
/zebra-state/**/zebra_db.rs

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
Expand Down
694 changes: 145 additions & 549 deletions zebra-state/src/service/finalized_state.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zebra-state/src/service/finalized_state/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ where

impl FinalizedState {
/// Allow to set up a fake value pool in the database for testing purposes.
pub fn set_current_value_pool(&self, fake_value_pool: ValueBalance<NonNegative>) {
pub fn set_finalized_value_pool(&self, fake_value_pool: ValueBalance<NonNegative>) {
let mut batch = DiskWriteBatch::new();
let value_pool_cf = self.db.cf_handle("tip_chain_value_pool").unwrap();

Expand Down
4 changes: 2 additions & 2 deletions zebra-state/src/service/finalized_state/disk_db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Module defining access to RocksDB via accessor traits.
//! Provides low-level access to RocksDB using some database-specific types.
//!
//! This module makes sure that:
//! - all disk writes happen inside a RocksDB transaction, and
//! - all disk writes happen inside a RocksDB transaction ([`WriteBatch`]), and
//! - format-specific invariants are maintained.
//!
//! # Correctness
Expand Down
2 changes: 1 addition & 1 deletion zebra-state/src/service/finalized_state/disk_format.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Module defining the serialization format for finalized data.
//! Serialization formats for finalized data.
//!
//! # Correctness
//!
Expand Down
Loading