Skip to content

Commit

Permalink
more data in cypher insert
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Nov 22, 2024
1 parent 7f84ea5 commit 5f58786
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use libra_backwards_compatibility::version_five::{
use libra_storage::read_snapshot::load_snapshot_manifest;
use std::{
collections::BTreeMap,
fmt,
path::{Path, PathBuf},
};
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -65,6 +66,12 @@ pub enum FrameworkVersion {
V7,
}

impl fmt::Display for FrameworkVersion {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", &self)
}
}

#[derive(Clone, Debug, clap::ValueEnum)]
pub enum BundleContent {
Unknown,
Expand Down
7 changes: 4 additions & 3 deletions src/schema_account_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ impl WarehouseAccState {
/// Note original data was in an RFC rfc3339 with Z for UTC, Cypher seems to prefer with offsets +00000
pub fn to_cypher_object_template(&self) -> String {
format!(
r#"{{address: "{}", balance: {}, version: {}, sequence_num: {}, slow_locked: {}, slow_transfer: {} }}"#,
r#"{{address: "{}", balance: {}, version: {}, sequence_num: {}, slow_locked: {}, slow_transfer: {}, framework_version: "{}" }}"#,
self.address.to_hex_literal(),
self.balance,
self.time.version,
self.sequence_num,
self.slow_wallet_locked,
self.slow_wallet_transferred,
self.time.framework_version,
)
}

Expand All @@ -86,8 +87,8 @@ impl WarehouseAccState {
UNWIND tx_data AS tx
MERGE (addr:Account {{address: tx.address}})
MERGE (snap:Snapshot {{address: tx.address, balance: tx.balance }})
MERGE (addr)-[rel:State]->(snap)
MERGE (snap:Snapshot {{address: tx.address, balance: tx.balance, framework_version: tx.framework_version, version: tx.version, sequence_num: tx.sequence_num, slow_locked: tx.slow_locked, slow_transfer: tx.slow_transfer }})
MERGE (addr)-[rel:State {{version: tx.version}} ]->(snap)
RETURN
COUNT(snap) AS merged_snapshots
Expand Down
3 changes: 0 additions & 3 deletions tests/test_load_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ use support::{
#[tokio::test]
async fn test_snapshot_unit() -> anyhow::Result<()> {
libra_forensic_db::log_setup();
// let manifest_file = v5_state_manifest_fixtures_path().join("state.manifest");
// assert!(manifest_file.exists());
// let s = extract_v5_snapshot(&manifest_file).await?;

let snap1 = WarehouseAccState::default();
let snap2 = WarehouseAccState::default();
Expand Down

0 comments on commit 5f58786

Please sign in to comment.