From d8f5e643bcee95969b59c309809710a38b0661e3 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 24 Apr 2020 10:10:01 +0000 Subject: Split code for modular compilation --- src/api/Cargo.toml | 28 ++++++++++++++++++++++++++++ src/api/api_server.rs | 18 +++++++++--------- src/api/http_util.rs | 2 +- src/api/lib.rs | 5 +++++ src/api/mod.rs | 2 -- 5 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 src/api/Cargo.toml create mode 100644 src/api/lib.rs delete mode 100644 src/api/mod.rs (limited to 'src/api') diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml new file mode 100644 index 00000000..3606c1df --- /dev/null +++ b/src/api/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "garage_api" +version = "0.1.0" +authors = ["Alex Auvolat "] +edition = "2018" + +[lib] +path = "lib.rs" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +garage_util = { path = "../util" } +garage_table = { path = "../table" } +garage_core = { path = "../core" } + +bytes = "0.4" +hex = "0.3" +log = "0.4" + +futures = "0.3" +futures-util = "0.3" +tokio = { version = "0.2", default-features = false, features = ["rt-core", "rt-threaded", "io-driver", "net", "tcp", "time", "macros", "sync", "signal", "fs"] } + +http = "0.2" +hyper = "0.13" + + diff --git a/src/api/api_server.rs b/src/api/api_server.rs index 905ba0dd..de79ffc2 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -9,18 +9,18 @@ use hyper::server::conn::AddrStream; use hyper::service::{make_service_fn, service_fn}; use hyper::{Body, Method, Request, Response, Server, StatusCode}; -use crate::data::*; -use crate::error::Error; -use crate::server::Garage; +use garage_util::data::*; +use garage_util::error::Error; -use crate::table::EmptyKey; +use garage_table::EmptyKey; -use crate::store::block::INLINE_THRESHOLD; -use crate::store::block_ref_table::*; -use crate::store::object_table::*; -use crate::store::version_table::*; +use garage_core::block::INLINE_THRESHOLD; +use garage_core::block_ref_table::*; +use garage_core::garage::Garage; +use garage_core::object_table::*; +use garage_core::version_table::*; -use crate::api::http_util::*; +use crate::http_util::*; type BodyType = Box + Send + Unpin>; diff --git a/src/api/http_util.rs b/src/api/http_util.rs index 228448f0..e7e74409 100644 --- a/src/api/http_util.rs +++ b/src/api/http_util.rs @@ -5,7 +5,7 @@ use futures::ready; use futures::stream::*; use hyper::body::{Bytes, HttpBody}; -use crate::error::Error; +use garage_util::error::Error; type StreamType = Pin> + Send>>; diff --git a/src/api/lib.rs b/src/api/lib.rs new file mode 100644 index 00000000..b313d45d --- /dev/null +++ b/src/api/lib.rs @@ -0,0 +1,5 @@ +#[macro_use] +extern crate log; + +pub mod api_server; +pub mod http_util; diff --git a/src/api/mod.rs b/src/api/mod.rs deleted file mode 100644 index 8e62d1e7..00000000 --- a/src/api/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod api_server; -pub mod http_util; -- cgit v1.2.3