Skip to content

Commit 8c529e8

Browse files
committed
lint
1 parent ab36ec5 commit 8c529e8

File tree

9 files changed

+19
-27
lines changed

9 files changed

+19
-27
lines changed

rust/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,5 @@ parquet = "51.0.0"
116116
num = "0.4.0"
117117
google-cloud-storage = "0.13.0"
118118
hyper = { version = "0.14.18", features = ["full"] }
119-
lazy_static = "1.4.0"
120119
parquet_derive = { version = "51.0.0" }
121120
canonical_json = "0.5.0"

rust/indexer-metrics/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ async fn start_processor_status_fetch(url: String, chain_name: String) {
155155
.set(processor.last_success_version as i64);
156156
HASURA_API_LATEST_VERSION_TIMESTAMP
157157
.with_label_values(&[&processor.processor, &chain_name])
158-
.set(processor.last_updated.timestamp_micros() as f64 * 1e-6);
158+
.set(processor.last_updated.and_utc().timestamp_micros() as f64 * 1e-6);
159159
HASURA_API_LATEST_TRANSACTION_TIMESTAMP
160160
.with_label_values(&[&processor.processor, &chain_name])
161161
.set(
162-
processor.last_transaction_timestamp.timestamp_micros() as f64
162+
processor.last_transaction_timestamp.and_utc().timestamp_micros() as f64
163163
* 1e-6,
164164
);
165165
let latency = system_time_now - processor.last_transaction_timestamp;

rust/moving-average/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct MovingAverage {
1515

1616
impl MovingAverage {
1717
pub fn new(window_millis: u64) -> Self {
18-
let now = chrono::Utc::now().naive_utc().timestamp_millis() as u64;
18+
let now = chrono::Utc::now().naive_utc().and_utc().timestamp_millis() as u64;
1919
let mut queue = VecDeque::new();
2020
queue.push_back((now, 0));
2121
Self {
@@ -26,7 +26,7 @@ impl MovingAverage {
2626
}
2727

2828
pub fn tick_now(&mut self, value: u64) {
29-
let now = chrono::Utc::now().naive_utc().timestamp_millis() as u64;
29+
let now = chrono::Utc::now().naive_utc().and_utc().timestamp_millis() as u64;
3030
self.tick(now, value);
3131
}
3232

rust/processor/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ extern crate diesel;
1313

1414
// for parquet_derive
1515
extern crate parquet;
16-
#[macro_use]
1716
extern crate parquet_derive;
18-
19-
#[macro_use]
2017
extern crate canonical_json;
2118

2219

rust/processor/src/models/default_models/parquet_move_resources.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use parquet_derive::{ParquetRecordWriter};
2020
pub struct MoveResource {
2121
pub transaction_version: i64,
2222
pub write_set_change_index: i64,
23-
pub transaction_block_height: i64,
23+
pub block_height: i64,
2424
pub name: String,
2525
pub address: String,
2626
pub resource_type: String,
@@ -44,7 +44,7 @@ impl MoveResource {
4444
write_resource: &WriteResource,
4545
write_set_change_index: i64,
4646
transaction_version: i64,
47-
transaction_block_height: i64,
47+
block_height: i64,
4848
block_timestamp: chrono::NaiveDateTime,
4949
) -> Self {
5050
let parsed_data = Self::convert_move_struct_tag(
@@ -55,7 +55,7 @@ impl MoveResource {
5555
);
5656
Self {
5757
transaction_version,
58-
transaction_block_height,
58+
block_height,
5959
write_set_change_index,
6060
resource_type: write_resource.type_str.clone(),
6161
name: parsed_data.name.clone(),
@@ -75,7 +75,7 @@ impl MoveResource {
7575
delete_resource: &DeleteResource,
7676
write_set_change_index: i64,
7777
transaction_version: i64,
78-
transaction_block_height: i64,
78+
block_height: i64,
7979
block_timestamp: chrono::NaiveDateTime,
8080
) -> Self {
8181
let parsed_data = Self::convert_move_struct_tag(
@@ -86,7 +86,7 @@ impl MoveResource {
8686
);
8787
Self {
8888
transaction_version,
89-
transaction_block_height,
89+
block_height,
9090
write_set_change_index,
9191
resource_type: delete_resource.type_str.clone(),
9292
name: parsed_data.name.clone(),

rust/processor/src/parquet_processors/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ pub trait ParquetHandlerTrait: Send + Sync {
106106
ParquetStruct::MoveResource(move_resource) => Some(move_resource.transaction_version as u64),
107107
ParquetStruct::Transaction(transaction) => Some(transaction.version as u64),
108108
ParquetStruct::WriteSetChange(write_set_change) => Some(write_set_change.transaction_version as u64),
109-
_ => None,
110109
};
111110

112111
if let Some(version) = current_version {

rust/processor/src/parquet_processors/move_resource_processor.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ use std::{ fs::{File, remove_file, rename}, sync::Arc};
1515
use super::{ParquetData, ParquetHandlerTrait, ParquetProcessingResult, ParquetStruct};
1616

1717

18-
const MAX_FILE_SIZE: u64 = 500 * 1024 * 1024; // 500 MB in bytes, maybe reduce this to 300 MB. use different value for struct type
19-
const BUCKET_REGULAR_TRAFFIC: &str = "devnet-airflow-continue";
20-
const BUCKET_BACKFILL_TRAFFIC: &str = "devnet-airflow-backfill";
21-
18+
const MAX_FILE_SIZE: u64 = 500 * 1024 * 1024;
2219

2320
pub struct MoveResourceParquetHandler {
2421
writer: Option<SerializedFileWriter<File>>,

rust/processor/src/processors/parquet_default_processor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ pub fn process_transactions(
148148
match detail {
149149
WriteSetChangeDetail::Module(module) => {
150150
move_modules.push(module.clone());
151-
// transaction_version_to_struct_count.entry(module.transaction_version).and_modify(|e| *e += 1);
151+
// transaction_version_to_struct_count.entry(module.transaction_version).and_modify(|e| *e += 1); // TODO: uncomment in Tranche2
152152
},
153153
WriteSetChangeDetail::Resource(resource) => {
154154
move_resources.push(ParquetStruct::MoveResource(resource.clone()));
155155
transaction_version_to_struct_count.entry(resource.transaction_version).and_modify(|e| *e += 1);
156156
},
157157
WriteSetChangeDetail::Table(item, current_item, metadata) => {
158158
table_items.push(item.clone());
159-
// transaction_version_to_struct_count.entry(item.transaction_version).and_modify(|e| *e += 1);
159+
// transaction_version_to_struct_count.entry(item.transaction_version).and_modify(|e| *e += 1); // TODO: uncomment in Tranche2
160160

161161
current_table_items.insert(
162162
(
@@ -165,11 +165,11 @@ pub fn process_transactions(
165165
),
166166
current_item.clone(),
167167
);
168-
// transaction_version_to_struct_count.entry(current_item.last_transaction_version).and_modify(|e| *e += 1);
168+
// transaction_version_to_struct_count.entry(current_item.last_transaction_version).and_modify(|e| *e += 1); // TODO: uncomment in Tranche2
169169

170170
if let Some(meta) = metadata {
171171
table_metadata.insert(meta.handle.clone(), meta.clone());
172-
// transaction_version_to_struct_count.entry(current_item.last_transaction_version).and_modify(|e| *e += 1);
172+
// transaction_version_to_struct_count.entry(current_item.last_transaction_version).and_modify(|e| *e += 1); // TODO: uncomment in Tranche2
173173
}
174174
},
175175
}

rust/processor/src/worker.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub struct Worker {
5252
pub transaction_filter: TransactionFilter,
5353
pub grpc_response_item_timeout_in_secs: u64,
5454
pub gcs_client: Arc<GCSClient>,
55-
pub bucket_name: Option<String>,
55+
pub parquet_bucket_name: Option<String>,
5656
pub is_parquet_processor: Option<bool>,
5757
}
5858

@@ -77,7 +77,7 @@ impl Worker {
7777
transaction_filter: TransactionFilter,
7878
grpc_response_item_timeout_in_secs: u64,
7979
gcs_client: Arc<GCSClient>,
80-
bucket_name: Option<String>,
80+
parquet_bucket_name: Option<String>,
8181
is_parquet_processor: Option<bool>,
8282
) -> Result<Self> {
8383
let processor_name = processor_config.name();
@@ -116,7 +116,7 @@ impl Worker {
116116
transaction_filter,
117117
grpc_response_item_timeout_in_secs,
118118
gcs_client,
119-
bucket_name,
119+
parquet_bucket_name,
120120
is_parquet_processor,
121121
})
122122
}
@@ -277,15 +277,15 @@ impl Worker {
277277
}
278278

279279
let gcs_client = self.gcs_client.clone();
280-
let bucket_name = self.bucket_name.clone().unwrap().to_string();
280+
let parquet_bucket_name = self.parquet_bucket_name.clone().unwrap().to_string();
281281

282282
tokio::spawn(async move {
283283
crate::parquet_handler::create_parquet_handler_loop(
284284
gcs_client,
285285
new_gap_detector_sender.clone(),
286286
parquet_type_to_receiver.clone(),
287287
processor_name,
288-
bucket_name.clone(),
288+
parquet_bucket_name.clone(),
289289
)
290290
.await;
291291
});

0 commit comments

Comments
 (0)