-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate parquet and postgres model files
- Loading branch information
Showing
129 changed files
with
278 additions
and
239 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod block_metadata_transactions; | ||
pub mod move_resources; | ||
pub mod move_tables; | ||
|
||
// parquet models | ||
pub mod parquet_move_modules; | ||
pub mod parquet_move_resources; | ||
pub mod parquet_move_tables; | ||
pub mod parquet_transactions; | ||
pub mod parquet_write_set_changes; | ||
pub mod raw_table_items; |
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 |
---|---|---|
@@ -1,19 +1 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod account_transaction_models; | ||
pub mod ans_models; | ||
pub mod coin_models; | ||
pub mod default_models; | ||
pub mod events_models; | ||
pub mod fungible_asset_models; | ||
pub mod ledger_info; | ||
pub mod object_models; | ||
pub mod processor_status; | ||
pub mod property_map; | ||
pub mod resources; | ||
pub mod stake_models; | ||
pub mod token_models; | ||
pub mod token_v2_models; | ||
pub mod transaction_metadata_model; | ||
pub mod user_transactions_models; |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
pub mod common; | ||
pub mod parquet; | ||
pub mod postgres; |
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 models; |
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,6 @@ | ||
// parquet models | ||
pub mod parquet_move_modules; | ||
pub mod parquet_move_resources; | ||
pub mod parquet_move_tables; | ||
pub mod parquet_transactions; | ||
pub mod parquet_write_set_changes; |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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 default_models; |
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 models; |
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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,6 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod block_metadata_transactions; | ||
pub mod move_resources; | ||
pub mod move_tables; |
File renamed without changes.
76 changes: 76 additions & 0 deletions
76
rust/processor/src/db/postgres/models/default_models/move_tables.rs
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,76 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#![allow(clippy::extra_unused_lifetimes)] | ||
|
||
use crate::{ | ||
db::common::models::default_models::raw_table_items::{RawTableItem, TableItemConvertible}, | ||
schema::{current_table_items, table_items, table_metadatas}, | ||
}; | ||
use aptos_protos::transaction::v1::WriteTableItem; | ||
use field_count::FieldCount; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, Deserialize, FieldCount, Identifiable, Insertable, Serialize)] | ||
#[diesel(primary_key(table_handle, key_hash))] | ||
#[diesel(table_name = current_table_items)] | ||
pub struct CurrentTableItem { | ||
pub table_handle: String, | ||
pub key_hash: String, | ||
pub key: String, | ||
pub decoded_key: serde_json::Value, | ||
pub decoded_value: Option<serde_json::Value>, | ||
pub last_transaction_version: i64, | ||
pub is_deleted: bool, | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize, FieldCount, Identifiable, Insertable, Serialize)] | ||
#[diesel(primary_key(transaction_version, write_set_change_index))] | ||
#[diesel(table_name = table_items)] | ||
pub struct TableItem { | ||
pub transaction_version: i64, | ||
pub write_set_change_index: i64, | ||
pub transaction_block_height: i64, | ||
pub key: String, | ||
pub table_handle: String, | ||
pub decoded_key: serde_json::Value, | ||
pub decoded_value: Option<serde_json::Value>, | ||
pub is_deleted: bool, | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize, FieldCount, Identifiable, Insertable, Serialize)] | ||
#[diesel(primary_key(handle))] | ||
#[diesel(table_name = table_metadatas)] | ||
pub struct TableMetadata { | ||
pub handle: String, | ||
pub key_type: String, | ||
pub value_type: String, | ||
} | ||
|
||
impl TableItemConvertible for TableItem { | ||
fn from_raw(raw_item: &RawTableItem) -> Self { | ||
TableItem { | ||
transaction_version: raw_item.txn_version, | ||
write_set_change_index: raw_item.write_set_change_index, | ||
transaction_block_height: raw_item.transaction_block_height, | ||
key: raw_item.table_key.clone(), | ||
table_handle: raw_item.table_handle.clone(), | ||
decoded_key: serde_json::from_str(raw_item.decoded_key.as_str()).unwrap(), | ||
decoded_value: raw_item | ||
.decoded_value | ||
.clone() | ||
.map(|v| serde_json::from_str(v.as_str()).unwrap()), | ||
is_deleted: raw_item.is_deleted, | ||
} | ||
} | ||
} | ||
|
||
impl TableMetadata { | ||
pub fn from_write_table_item(table_item: &WriteTableItem) -> Self { | ||
Self { | ||
handle: table_item.handle.to_string(), | ||
key_type: table_item.data.as_ref().unwrap().key_type.clone(), | ||
value_type: table_item.data.as_ref().unwrap().value_type.clone(), | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.