Skip to content

Commit

Permalink
storage: added client state manager stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
delbonis committed Jan 31, 2025
1 parent b6844a1 commit 7120ece
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pub mod ops;
use std::sync::Arc;

pub use managers::{
chainstate::ChainstateManager, checkpoint::CheckpointDbManager, l1::L1BlockManager,
l2::L2BlockManager,
chainstate::ChainstateManager, checkpoint::CheckpointDbManager,
client_state::ClientStateManager, l1::L1BlockManager, l2::L2BlockManager,
};
pub use ops::l1tx_broadcast::BroadcastDbOps;
use strata_db::traits::Database;
Expand Down
23 changes: 23 additions & 0 deletions crates/storage/src/managers/client_state.rs
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 }
}
}
1 change: 1 addition & 0 deletions crates/storage/src/managers/mod.rs
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;

0 comments on commit 7120ece

Please sign in to comment.