do not pad tx during sync phase

This commit is contained in:
Peter Zhang 2024-11-06 18:43:41 +08:00
parent 3fd800275a
commit ce7a320098
2 changed files with 8 additions and 6 deletions

View File

@ -63,22 +63,22 @@ impl<T: ?Sized + Configurable> ConfigurableExt for T {}
impl Configurable for LogManager {
fn get_config(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
Ok(self.flow_db.get(COL_MISC, key)?)
Ok(self.data_db.get(COL_MISC, key)?)
}
fn set_config(&self, key: &[u8], value: &[u8]) -> Result<()> {
self.flow_db.put(COL_MISC, key, value)?;
self.data_db.put(COL_MISC, key, value)?;
Ok(())
}
fn remove_config(&self, key: &[u8]) -> Result<()> {
Ok(self.flow_db.delete(COL_MISC, key)?)
Ok(self.data_db.delete(COL_MISC, key)?)
}
fn exec_configs(&self, tx: ConfigTx) -> Result<()> {
let mut db_tx = self.flow_db.transaction();
let mut db_tx = self.data_db.transaction();
db_tx.ops = tx.ops;
self.flow_db.write(db_tx)?;
self.data_db.write(db_tx)?;
Ok(())
}

View File

@ -62,6 +62,7 @@ pub struct UpdateFlowMessage {
pub struct LogManager {
pub(crate) flow_db: Arc<dyn ZgsKeyValueDB>,
pub(crate) data_db: Arc<dyn ZgsKeyValueDB>,
tx_store: TransactionStore,
flow_store: Arc<FlowStore>,
merkle: RwLock<MerkleManager>,
@ -635,7 +636,7 @@ impl LogManager {
config: LogConfig,
executor: task_executor::TaskExecutor,
) -> Result<Self> {
let tx_store = TransactionStore::new(flow_db_source.clone())?;
let tx_store = TransactionStore::new(data_db_source.clone())?;
let flow_db = Arc::new(FlowDBStore::new(flow_db_source.clone()));
let data_db = Arc::new(FlowDBStore::new(data_db_source.clone()));
let flow_store = Arc::new(FlowStore::new(data_db.clone(), config.flow.clone()));
@ -743,6 +744,7 @@ impl LogManager {
let mut log_manager = Self {
flow_db: flow_db_source,
data_db: data_db_source,
tx_store,
flow_store,
merkle,