-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: added client state manager stubs
- Loading branch information
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//! Client state manager. | ||
// TODO should this also include sync events? | ||
|
||
use std::sync::Arc; | ||
|
||
use strata_db::traits::Database; | ||
use strata_state::operation::ClientUpdateOutput; | ||
use threadpool::ThreadPool; | ||
|
||
use crate::{cache, ops}; | ||
|
||
pub struct ClientStateManager { | ||
ops: ops::client_state::ClientStateOps, | ||
state_cache: cache::CacheTable<u64, Option<ClientUpdateOutput>>, | ||
} | ||
|
||
impl ClientStateManager { | ||
pub fn new<D: Database + Sync + Send + 'static>(pool: ThreadPool, db: Arc<D>) -> Self { | ||
let ops = ops::client_state::Context::new(db.client_state_db().clone()).into_ops(pool); | ||
let state_cache = cache::CacheTable::new(64.try_into().unwrap()); | ||
Self { ops, state_cache } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod chainstate; | ||
pub mod checkpoint; | ||
pub mod client_state; | ||
pub mod l1; | ||
pub mod l2; |