diff --git a/README.md b/README.md index a60b4b4..dbc9619 100644 --- a/README.md +++ b/README.md @@ -5,26 +5,33 @@ ## Introduction -Galois is an extremely high performance matching engine written in Rust which uses event-sourcing pattern to handle tens of thousands of orders per second or even better, depending on the performance of persistence. +Galois is an extremely high-performance matching engine written in Rust which uses event-sourcing pattern to handle tens of thousands of orders per second or even better. + +The internal structure of Galois looks like below: ``` + sidecar chain <-+ - | | \ + ^ | \ | | \ v v \ - +-----> server scanner + + +----> server scanner + | \ / | |\ \ / | | \ \ / | - | +-<- sequencer | + | +-- sequencer | + | | |\ | | | \ v | - | +-<- executor | - + / \ + - \ / \ / - \ / \ / - +-<- output committer -+ + | +-- executor | + | | | + | | | + | v | + + rocksdb + + \ / \ / + \ / \ / + \ / \ / + +-- market committer -+ ``` diff --git a/engine/src/executor/orderbook.rs b/engine/src/executor/orderbook.rs index 15d8573..7e7e4bb 100644 --- a/engine/src/executor/orderbook.rs +++ b/engine/src/executor/orderbook.rs @@ -164,7 +164,7 @@ pub struct OrderBook { pub min_vol: Amount, pub enable_market_order: bool, pub open: bool, - max_id: OrderId, + pub max_id: OrderId, } #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)] diff --git a/engine/src/migration.rs b/engine/src/migration.rs index 3e4f14d..b56e955 100644 --- a/engine/src/migration.rs +++ b/engine/src/migration.rs @@ -43,10 +43,10 @@ mod v1_to_v2 { futures::executor::block_on(async move { Pool::connect_with(option).await.unwrap() }); let mut pendings = vec![]; let pool = std::sync::Arc::new(pool); - for (symbol, _) in data.orderbooks.iter() { + for (symbol, orderbook) in data.orderbooks.iter() { let sql = format!( - "select * from t_order_{}_{} where f_status in (0, 3)", - symbol.0, symbol.1 + "select * from t_order_{}_{} where f_status in (0, 3) and f_id <= {}", + symbol.0, symbol.1, orderbook.max_id, ); let s = *symbol; let p = pool.clone();