diff --git a/rust/processor/src/processors/mod.rs b/rust/processor/src/processors/mod.rs index 8545a6abe..f30819bcb 100644 --- a/rust/processor/src/processors/mod.rs +++ b/rust/processor/src/processors/mod.rs @@ -4,8 +4,6 @@ // Note: For enum_dispatch to work nicely, it is easiest to have the trait and the enum // in the same file (ProcessorTrait and Processor). -// ignore doc stuff -#![allow(clippy::too_long_first_doc_paragraph)] pub mod account_transactions_processor; pub mod ans_processor; pub mod default_processor; @@ -157,6 +155,7 @@ pub trait ProcessorTrait: Send + Sync + Debug { } /// This enum captures the configs for all the different processors that are defined. +/// /// The configs for each processor should only contain configuration specific to that /// processor. For configuration that is common to all processors, put it in /// IndexerGrpcProcessorConfig. @@ -228,14 +227,16 @@ impl ProcessorConfig { } } -/// This enum contains all the processors defined in this crate. We use enum_dispatch -/// as it is more efficient than using dynamic dispatch (Box) and +/// This enum contains all the processors defined in this crate. +/// +/// We use enum_dispatch as it is more efficient than using dynamic dispatch (Box) and /// it enables nice safety checks like in we do in `test_processor_names_complete`. -#[enum_dispatch(ProcessorTrait)] -#[derive(Debug)] -// To ensure that the variants of ProcessorConfig and Processor line up, in the testing +/// +/// // To ensure that the variants of ProcessorConfig and Processor line up, in the testing // build path we derive EnumDiscriminants on this enum as well and make sure the two // sets of variants match up in `test_processor_names_complete`. +#[enum_dispatch(ProcessorTrait)] +#[derive(Debug)] #[cfg_attr( test, derive(strum::EnumDiscriminants), @@ -273,8 +274,10 @@ mod test { use strum::VariantNames; /// This test exists to make sure that when a new processor is added, it is added - /// to both Processor and ProcessorConfig. To make sure this passes, make sure the - /// variants are in the same order (lexicographical) and the names match. + /// to both Processor and ProcessorConfig. + /// + /// To make sure this passes, make sure the variants are in the same order + /// (lexicographical) and the names match. #[test] fn test_processor_names_complete() { assert_eq!(ProcessorName::VARIANTS, ProcessorDiscriminants::VARIANTS); diff --git a/rust/processor/src/utils/database.rs b/rust/processor/src/utils/database.rs index 4d7502c5c..128553159 100644 --- a/rust/processor/src/utils/database.rs +++ b/rust/processor/src/utils/database.rs @@ -1,10 +1,6 @@ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 -//! Database-related functions -#![allow(clippy::extra_unused_lifetimes)] -// ignore doc stuff -#![allow(clippy::too_long_first_doc_paragraph)] use crate::utils::util::remove_null_bytes; use ahash::AHashMap; use diesel::{ @@ -34,7 +30,9 @@ pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("src/db/postgres/mi pub const DEFAULT_MAX_POOL_SIZE: u32 = 150; #[derive(QueryId)] -/// Using this will append a where clause at the end of the string upsert function, e.g. +/// Using this will append a where clause at the end of the string upsert function +/// +/// e.g. /// INSERT INTO ... ON CONFLICT DO UPDATE SET ... WHERE "transaction_version" = excluded."transaction_version" /// This is needed when we want to maintain a table with only the latest state pub struct UpsertFilterLatestTransactionQuery { @@ -42,7 +40,8 @@ pub struct UpsertFilterLatestTransactionQuery { where_clause: Option<&'static str>, } -// the max is actually u16::MAX but we see that when the size is too big we get an overflow error so reducing it a bit +/// the max is actually u16::MAX but we see that when the size is too big we get +/// an overflow error so reducing it a bit pub const MAX_DIESEL_PARAM_SIZE: usize = (u16::MAX / 2) as usize; /// This function will clean the data for postgres. Currently it has support for removing @@ -191,7 +190,8 @@ where res } -/// Returns the entry for the config hashmap, or the default field count for the insert +/// Returns the entry for the config hashmap, or the default field count for the insert. +/// /// Given diesel has a limit of how many parameters can be inserted in a single operation (u16::MAX), /// we default to chunk an array of items based on how many columns are in the table. pub fn get_config_table_chunk_size(