From 20dad7d4290f2c98583168cd4b9afcdec4802944 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 7 Apr 2021 04:33:45 +0300 Subject: Implement Block GET/PUT with new schema - `Arc`+`Mutex` is replaced by `parking_lot::RwLock,` decoupled Read+Write and ability to upgrade read locks into write locks if needed - Schema has changed, `Db` is now a struct that implements `new()` to return a new instance of itself, pros/cons listed in code but tl;dr blockchain and pending transactions are separate now - `custom_filters` now supports extracting Block json and Transaction json in separate functions too - /block GET and PUT implemented, `Blocks` currently have one check (transactions appear in pending transaction) - debug is working after something, dunno how I fixed it --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index bcd4173..7ef2597 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,15 +11,15 @@ mod schema; async fn main() { // Show debug logs by default by setting `RUST_LOG=restful_rust=debug` if env::var_os("RUST_LOG").is_none() { - env::set_var("RUST_LOG", "restful_rust=debug"); + env::set_var("RUST_LOG", "gradecoin=debug"); } pretty_env_logger::init(); - let db = schema::ledger(); // 1. we need this to return a _simple_ db + let db = schema::create_database(); let api = routes::consensus_routes(db); - let routes = api.with(warp::log("restful_rust")); + let routes = api.with(warp::log("gradecoin")); // Start the server warp::serve(routes).run(([127, 0, 0, 1], 8080)).await; -- cgit v1.2.3-70-g09d2