Skip to content

Commit

Permalink
feat(core): insert into indexer table
Browse files Browse the repository at this point in the history
  • Loading branch information
remiroyc committed Sep 7, 2023
1 parent 4a542f6 commit ef700d4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 21 deletions.
39 changes: 30 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
chrono = "0.4.19"
anyhow = "1.0"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }
Expand Down
25 changes: 13 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use ark_starknet::{client2::StarknetClient, collection_manager::CollectionManage
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_dynamodb::{types::AttributeValue, Client as DynamoClient};
use aws_sdk_kinesis::Client as KinesisClient;
use chrono::Utc;
use dotenv::dotenv;
use reqwest::{Client as ReqwestClient, Url};
use simple_logger::SimpleLogger;
Expand All @@ -33,20 +34,20 @@ async fn main() -> Result<()> {
let dynamo_client = DynamoClient::new(&config);
let reqwest_client = ReqwestClient::new();

// let indexer_table_name =
// env::var("ARK_INDEXER_TABLE_NAME").expect("ARK_INDEXER_TABLE_NAME must be set");
let indexer_table_name =
env::var("ARK_INDEXER_TABLE_NAME").expect("ARK_INDEXER_TABLE_NAME must be set");

// let indexer_table_name =
// env::var("ARK_INDEXER_TABLE_NAME").expect("ARK_INDEXER_TABLE_NAME must be set");
// dynamo_client
// .put_item()
// .table_name(indexer_table_name)
// .item("PK", AttributeValue::S());
let indexer_version = env::var("ARK_INDEXER_VERSION").unwrap_or(String::from("undefined"));
let now = Utc::now();
let unix_timestamp = now.timestamp();

// Iterate over all environment variables and log them
for (key, value) in env::vars() {
log::info!("{}: {}", key, value);
}
dynamo_client
.put_item()
.table_name(indexer_table_name)
.item("PK", AttributeValue::S(String::from("ECS_")))
.item("SK", AttributeValue::S(unix_timestamp.to_string()))
.item("status", AttributeValue::S(String::from("running")))
.item("version", AttributeValue::S(String::from(indexer_version)));

Check warning on line 50 in src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `std::string::String`

warning: useless conversion to the same type: `std::string::String` --> src/main.rs:50:44 | 50 | .item("version", AttributeValue::S(String::from(indexer_version))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `indexer_version` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default

process_blocks_continuously(
&collection_manager,
Expand Down

0 comments on commit ef700d4

Please sign in to comment.