forked from 0LNetworkCommunity/libra-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a41416
commit 1bcb815
Showing
8 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,67 @@ | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
pub enum DummyTransactionV5 { | ||
/// Transaction submitted by the user. e.g: P2P payment transaction, publishing module | ||
/// transaction, etc. | ||
/// TODO: We need to rename SignedTransaction to SignedUserTransaction, as well as all the other | ||
/// transaction types we had in our codebase. | ||
#[serde(with = "serde_bytes")] | ||
|
||
UserTransaction(Vec<u8>), | ||
|
||
/// Transaction that applies a WriteSet to the current storage, it's applied manually via db-bootstrapper. | ||
#[serde(with = "serde_bytes")] | ||
|
||
GenesisTransaction(Vec<u8>), | ||
|
||
/// Transaction to update the block metadata resource at the beginning of a block. | ||
#[serde(with = "serde_bytes")] | ||
BlockMetadata(Vec<u8>), | ||
} | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
struct DummyTransactionInfoV5 { | ||
/// The hash of this transaction. | ||
#[serde(with = "serde_bytes")] | ||
transaction_hash: Vec<u8>, | ||
|
||
/// The root hash of Sparse Merkle Tree describing the world state at the end of this | ||
/// transaction. | ||
#[serde(with = "serde_bytes")] | ||
state_root_hash: Vec<u8>, | ||
|
||
/// The root hash of Merkle Accumulator storing all events emitted during this transaction. | ||
#[serde(with = "serde_bytes")] | ||
event_root_hash: Vec<u8>, | ||
|
||
/// The amount of gas used. | ||
gas_used: u64, | ||
|
||
/// The vm status. If it is not `Executed`, this will provide the general error class. Execution | ||
/// failures and Move abort's recieve more detailed information. But other errors are generally | ||
/// categorized with no status code or other information | ||
#[serde(with = "serde_bytes")] | ||
status: Vec<u8>, | ||
} | ||
|
||
/// Support versioning of the data structure. | ||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
enum DummyContractEventV5 { | ||
V0(ContractEventV0), | ||
} | ||
|
||
/// Entry produced via a call to the `emit_event` builtin. | ||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
struct ContractEventV0 { | ||
/// The unique key that the event was emitted to | ||
#[serde(with = "serde_bytes")] | ||
key: Vec<u8>, | ||
/// The number of messages that have been emitted to the path previously | ||
sequence_number: u64, | ||
/// The type of the data | ||
#[serde(with = "serde_bytes")] | ||
type_tag: Vec<u8>, | ||
/// The data payload of the event | ||
#[serde(with = "serde_bytes")] | ||
event_data: Vec<u8>, | ||
} |
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,15 @@ | ||
[package] | ||
name = "libra-warehouse" | ||
authors.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
publish.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
clap = { workspace = true } | ||
tokio ={ workspace = true } |
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 @@ | ||
pub mod warehouse_cli; |
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,9 @@ | ||
//! entry point | ||
use clap::Parser; | ||
use libra_warehouse::warehouse_cli::WarehouseCli; | ||
|
||
#[tokio::main] | ||
async fn main() -> anyhow::Result<()> { | ||
WarehouseCli::parse().run(); | ||
Ok(()) | ||
} |
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,37 @@ | ||
use anyhow::{bail, Result}; | ||
use clap::{Parser, Subcommand}; | ||
use std::{fs, path::PathBuf}; | ||
|
||
// use crate::{read_snapshot, restore, restore_bundle::RestoreBundle}; | ||
|
||
#[derive(Parser)] | ||
#[clap(author, version, about, long_about = None)] | ||
#[clap(arg_required_else_help(true))] | ||
/// DB tools e.g.: backup, restore, export to json | ||
pub struct WarehouseCli { | ||
#[clap(subcommand)] | ||
command: Sub, | ||
} | ||
|
||
#[derive(Subcommand)] | ||
#[allow(clippy::large_enum_variant)] | ||
pub enum Sub { | ||
/// scans directory and subdirectory for manifests | ||
/// Tries to identify the libra version they belong to (v5 etc.) | ||
// #[clap(su)] | ||
Scan { | ||
#[clap(long, short('d'))] | ||
dir_archive: PathBuf | ||
}, | ||
|
||
} | ||
|
||
impl WarehouseCli { | ||
pub fn run(&self) { | ||
match &self.command { | ||
Sub::Scan { dir_archive } => { | ||
dbg!(&dir_archive) | ||
}, | ||
}; | ||
} | ||
} |