summaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 14:59:28 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 14:59:28 -0700
commit2fd925e4eb3730c36519096e4a74b2de5998e8d4 (patch)
tree63bd81c57fa02ae8359c20bedd8cbc7da0980d6b /rust
parente35b10434aa4ceb2708610f13fe078e977496ce5 (diff)
downloadfatcat-2fd925e4eb3730c36519096e4a74b2de5998e8d4.tar.gz
fatcat-2fd925e4eb3730c36519096e4a74b2de5998e8d4.zip
start ripping out cruft
Diffstat (limited to 'rust')
-rw-r--r--rust/Cargo.lock64
-rw-r--r--rust/Cargo.toml6
-rw-r--r--rust/src/api_server.rs7
-rw-r--r--rust/src/bin/fatcat-iron.rs9
-rw-r--r--rust/src/lib.rs6
5 files changed, 46 insertions, 46 deletions
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 8c972677..b9b52098 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -73,6 +73,15 @@ dependencies = [
]
[[package]]
+name = "bigdecimal"
+version = "0.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "bitflags"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -191,10 +200,21 @@ name = "diesel"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
+ "bigdecimal 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "chrono 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel_derives 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pq-sys 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
+ "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -314,9 +334,7 @@ dependencies = [
"iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"iron-slog 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"iron-test 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "iron_diesel_middleware 0.4.0 (git+https://github.com/darayus/iron-diesel-middleware)",
"r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "r2d2-diesel 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -425,6 +443,11 @@ dependencies = [
]
[[package]]
+name = "ipnetwork"
+version = "0.12.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "iron"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -479,17 +502,6 @@ dependencies = [
]
[[package]]
-name = "iron_diesel_middleware"
-version = "0.4.0"
-source = "git+https://github.com/darayus/iron-diesel-middleware#d663e4a238b8a3952a31b90d7cba56ee292013c2"
-dependencies = [
- "diesel 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "r2d2-diesel 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "isatty"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -624,12 +636,24 @@ name = "num"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
+ "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
+name = "num-bigint"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "num-integer"
version = "0.1.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -803,15 +827,6 @@ dependencies = [
]
[[package]]
-name = "r2d2-diesel"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "diesel 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "rand"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1293,6 +1308,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
"checksum base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30e93c03064e7590d0466209155251b90c22e37fab1daf2771582598b5827557"
"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
+"checksum bigdecimal 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d1e12b0aed2aaf0aabcb915ade1cb2f7938d8a4bcd2ad7ec6f1b5a0c38ea236c"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
"checksum bodyparser 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6928e817538b74a73d1dd6e9a942a2a35c632a597b6bb14fd009480f859a6bf5"
@@ -1330,11 +1346,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "368cb56b2740ebf4230520e2b90ebb0461e69034d85d1945febd9b3971426db2"
"checksum hyper-openssl 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5ecb3cd8e4d53f8abe7cb2227e66674bb63c1bd0ba60ca9ba7b74ea1e0054891"
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
+"checksum ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)" = "70783119ac90828aaba91eae39db32c6c1b8838deea3637e5238efa0130801ab"
"checksum iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2440ae846e7a8c7f9b401db8f6e31b4ea5e7d3688b91761337da7e054520c75b"
"checksum iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8e17268922834707e1c29e8badbf9c712c9c43378e1b6a3388946baff10be2"
"checksum iron-slog 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb0cc34306c77baf5089b3af209a0547c0ce36cdeaee2424a9fa0e45c042f4a0"
"checksum iron-test 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1944bcf30f8b3f51ebf01e715517dd9755e9480934778d6de70179a41d283c1"
-"checksum iron_diesel_middleware 0.4.0 (git+https://github.com/darayus/iron-diesel-middleware)" = "<none>"
"checksum isatty 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a118a53ba42790ef25c82bb481ecf36e2da892646cccd361e69a6bb881e19398"
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
@@ -1353,6 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58"
"checksum multipart 0.13.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92f54eb45230c3aa20864ccf0c277eeaeadcf5e437e91731db498dbf7fbe0ec6"
"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
+"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1"
"checksum num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac0ea58d64a89d9d6b7688031b3be9358d6c919badcf7fbb0527ccfd891ee45"
"checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124"
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
@@ -1374,7 +1391,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
"checksum r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f9078ca6a8a5568ed142083bb2f7dc9295b69d16f867ddcc9849e51b17d8db46"
-"checksum r2d2-diesel 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9c29bad92da76d02bc2c020452ebc3a3fe6fa74cfab91e711c43116e4fb1a3"
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 7612751c..ab3f5e35 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -8,12 +8,11 @@ members = ["fatcat-api"]
[dependencies]
fatcat-api = {version = "*", path = "fatcat-api"}
-diesel = { version = "1.0.0", features = ["postgres"] }
+diesel = { version = "1.2", features = ["postgres", "extras"] }
dotenv = "0.9.0"
clap = "*"
error-chain = "0.11"
r2d2 = "*"
-r2d2-diesel = "*"
# API server
chrono = { version = "0.4", features = ["serde"] }
@@ -27,9 +26,6 @@ slog = "^2.0"
slog-term = "*"
slog-async = "*"
-[dependencies.iron_diesel_middleware]
-git = "https://github.com/darayus/iron-diesel-middleware"
-
#hyper-openssl = {version = "0.2", optional = true}
#hyper-tls = {version = "0.1.2", optional = true}
#tokio-core = "0.1.6"
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 3e2e6c9c..2dd1bd8c 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -11,9 +11,8 @@ use self::models::*;
use ConnectionPool;
use diesel;
use diesel::prelude::*;
-use iron_diesel_middleware::DieselPooledConnection;
+use diesel::r2d2::ConnectionManager;
use r2d2;
-use r2d2_diesel::ConnectionManager;
use swagger;
@@ -37,8 +36,8 @@ pub struct Server {
impl Api for Server {
fn container_id_get(
&self,
- id: String,
- context: &Context,
+ _id: String,
+ _context: &Context,
) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let c: i64 = container_rev.count().first(&*conn).expect("DB Error");
diff --git a/rust/src/bin/fatcat-iron.rs b/rust/src/bin/fatcat-iron.rs
index e0705787..9f684b92 100644
--- a/rust/src/bin/fatcat-iron.rs
+++ b/rust/src/bin/fatcat-iron.rs
@@ -8,7 +8,6 @@ extern crate fatcat;
extern crate fatcat_api;
extern crate futures;
extern crate iron;
-extern crate iron_diesel_middleware;
extern crate iron_slog;
extern crate swagger;
#[macro_use]
@@ -21,7 +20,6 @@ extern crate slog_term;
use clap::{App, Arg};
use dotenv::dotenv;
use iron::{Chain, Iron};
-use iron_diesel_middleware::{DieselMiddleware, DieselPooledConnection, DieselReqExt};
use iron_slog::{DefaultLogFormatter, LoggerMiddleware};
use slog::{Drain, Logger};
use std::env;
@@ -44,12 +42,6 @@ fn main() {
let logger = Logger::root(drain, o!());
let formatter = DefaultLogFormatter;
- dotenv().ok();
- let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
-
- let diesel_middleware: DieselMiddleware<diesel::pg::PgConnection> =
- DieselMiddleware::new(&database_url).unwrap();
-
let server = fatcat::server().unwrap();
let router = fatcat_api::router(server);
@@ -61,7 +53,6 @@ fn main() {
chain.link_before(AllowAllMiddleware::new("cosmo"));
chain.link_after(fatcat::XClacksOverheadMiddleware);
- //chain.link_before(diesel_middleware);
if matches.is_present("https") {
unimplemented!()
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index b8f2be88..e2b2f892 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -5,7 +5,6 @@ extern crate chrono;
extern crate diesel;
extern crate dotenv;
extern crate futures;
-extern crate iron_diesel_middleware;
#[macro_use]
extern crate hyper;
extern crate swagger;
@@ -13,7 +12,6 @@ extern crate swagger;
extern crate error_chain;
extern crate iron;
extern crate r2d2;
-extern crate r2d2_diesel;
pub mod api_server;
pub mod database_schema;
@@ -25,13 +23,13 @@ mod errors {
pub use self::errors::*;
use diesel::pg::PgConnection;
use diesel::prelude::*;
+use diesel::r2d2::ConnectionManager;
use dotenv::dotenv;
use iron::middleware::AfterMiddleware;
use iron::{Request, Response};
-use r2d2_diesel::ConnectionManager;
use std::env;
-pub type ConnectionPool = r2d2::Pool<r2d2_diesel::ConnectionManager<diesel::pg::PgConnection>>;
+pub type ConnectionPool = r2d2::Pool<ConnectionManager<diesel::pg::PgConnection>>;
pub fn establish_connection() -> PgConnection {
dotenv().ok();