diff --git a/crates/rooch-types/src/da/batch.rs b/crates/rooch-types/src/da/batch.rs index 24b9d49f13..b8c51b9081 100644 --- a/crates/rooch-types/src/da/batch.rs +++ b/crates/rooch-types/src/da/batch.rs @@ -8,8 +8,8 @@ use moveos_types::h256; use moveos_types::h256::{sha2_256_of, H256}; use serde::{Deserialize, Serialize}; -#[derive(Eq, PartialEq, Hash, Deserialize, Serialize, Clone, Debug)] /// The tx order range of the block. +#[derive(Eq, PartialEq, Hash, Deserialize, Serialize, Clone, Debug)] pub struct BlockRange { /// The Rooch block number for DA, each batch maps to a block pub block_number: u128, @@ -25,8 +25,8 @@ impl BlockRange { } } -#[derive(Eq, PartialEq, Hash, Deserialize, Serialize, Clone, Debug)] /// The state of the block submission. +#[derive(Eq, PartialEq, Hash, Deserialize, Serialize, Clone, Debug)] pub struct BlockSubmitState { /// tx order range of the block pub block_range: BlockRange, @@ -67,8 +67,8 @@ impl BlockSubmitState { } } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] /// Meta of DA batch +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct DABatchMeta { /// tx order range of the block pub block_range: BlockRange, @@ -100,8 +100,8 @@ pub struct SignedDABatchMeta { pub signature: Vec, } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] /// A batch is a collection of transactions. It is the unit of data flow in DA Stream +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct DABatch { /// The metadata of the batch pub meta: DABatchMeta, diff --git a/crates/rooch/src/commands/da/commands/index_tx.rs b/crates/rooch/src/commands/da/commands/index.rs similarity index 89% rename from crates/rooch/src/commands/da/commands/index_tx.rs rename to crates/rooch/src/commands/da/commands/index.rs index 9140b7b8a9..d787d43236 100644 --- a/crates/rooch/src/commands/da/commands/index_tx.rs +++ b/crates/rooch/src/commands/da/commands/index.rs @@ -10,19 +10,19 @@ use std::path::PathBuf; /// Index tx_order:tx_hash:block_number to a file from segments #[derive(Debug, clap::Parser)] -pub struct IndexTxCommand { - #[clap(long = "segment-dir")] +pub struct IndexCommand { + #[clap(long = "segment-dir", short = 's')] pub segment_dir: PathBuf, - #[clap(long = "output")] - pub output: PathBuf, + #[clap(long = "index", short = 'i')] + pub index_path: PathBuf, } -impl IndexTxCommand { +impl IndexCommand { pub fn execute(self) -> RoochResult<()> { let ledger_tx_loader = LedgerTxGetter::new(self.segment_dir)?; let mut block_number = ledger_tx_loader.get_min_chunk_id(); let mut expected_tx_order = 0; - let file = File::create(self.output.clone())?; + let file = File::create(self.index_path.clone())?; let mut writer = BufWriter::with_capacity(8 * 1024 * 1024, file.try_clone().unwrap()); loop { diff --git a/crates/rooch/src/commands/da/commands/mod.rs b/crates/rooch/src/commands/da/commands/mod.rs index 8e3017dc82..264767aa79 100644 --- a/crates/rooch/src/commands/da/commands/mod.rs +++ b/crates/rooch/src/commands/da/commands/mod.rs @@ -25,7 +25,7 @@ use std::sync::atomic::AtomicU64; use tracing::info; pub mod exec; -pub mod index_tx; +pub mod index; pub mod namespace; pub mod unpack; diff --git a/crates/rooch/src/commands/da/mod.rs b/crates/rooch/src/commands/da/mod.rs index f07786edd3..ef44bd9cbd 100644 --- a/crates/rooch/src/commands/da/mod.rs +++ b/crates/rooch/src/commands/da/mod.rs @@ -5,7 +5,7 @@ pub mod commands; use crate::cli_types::CommandAction; use crate::commands::da::commands::exec::ExecCommand; -use crate::commands::da::commands::index_tx::IndexTxCommand; +use crate::commands::da::commands::index::IndexCommand; use crate::commands::da::commands::namespace::NamespaceCommand; use crate::commands::da::commands::unpack::UnpackCommand; use async_trait::async_trait; @@ -26,7 +26,7 @@ impl CommandAction for DA { DACommand::Unpack(unpack) => unpack.execute().map(|_| "".to_owned()), DACommand::Namespace(namespace) => namespace.execute().map(|_| "".to_owned()), DACommand::Exec(exec) => exec.execute().await.map(|_| "".to_owned()), - DACommand::IndexTx(index_tx) => index_tx.execute().map(|_| "".to_owned()), + DACommand::Index(index) => index.execute().map(|_| "".to_owned()), } } } @@ -37,5 +37,5 @@ pub enum DACommand { Unpack(UnpackCommand), Namespace(NamespaceCommand), Exec(Box), - IndexTx(IndexTxCommand), + Index(IndexCommand), }