Skip to content

Commit

Permalink
feat: support multi circuits - update column circuit of table task …
Browse files Browse the repository at this point in the history
…to type string (#239)

* Update `fluidex-common` for removing `CircuitType`.

* Update `fluidex-common`.

* cargo fmt

Co-authored-by: HAOYUatHZ <[email protected]>
Co-authored-by: HAOYUatHZ <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2021
1 parent 6845f43 commit c739bb0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
31 changes: 19 additions & 12 deletions Cargo.lock

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

17 changes: 6 additions & 11 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
#![allow(dead_code)]

use crossbeam_channel::RecvTimeoutError;
use fluidex_common::db::models::tablenames;
use fluidex_common::db::models::task::TaskStatus;
use fluidex_common::db::MIGRATOR;
use fluidex_common::non_blocking_tracing;
use fluidex_common::{
db::{
models::{
tablenames,
task::{CircuitType, TaskStatus},
},
MIGRATOR,
},
types::FrExt,
};
use fluidex_common::types::FrExt;
use rollup_state_manager::config::Settings;
use rollup_state_manager::grpc::run_grpc_server;
use rollup_state_manager::msg::{msg_loader, msg_processor};
Expand Down Expand Up @@ -240,6 +234,7 @@ async fn save_block_to_db(pool: &PgPool, block: &L2Block) -> anyhow::Result<()>
}

async fn save_task_to_db(pool: &PgPool, block: L2Block) -> anyhow::Result<()> {
let tx_num = block.detail.encoded_txs.len();
let input = L2BlockSerde::from(block.detail);
let task_id = unique_task_id();

Expand All @@ -248,7 +243,7 @@ async fn save_task_to_db(pool: &PgPool, block: L2Block) -> anyhow::Result<()> {
tablenames::TASK
))
.bind(task_id)
.bind(CircuitType::BLOCK)
.bind(format!("block_{}", tx_num))
.bind(block.block_id as i64) // TODO: will it overflow?
.bind(sqlx::types::Json(input))
.bind(TaskStatus::Inited)
Expand Down

0 comments on commit c739bb0

Please sign in to comment.