Clean up dependencies

This commit is contained in:
Nadja Reitzenstein 2021-10-27 14:49:45 +02:00
parent 937d271b20
commit 48978326af
6 changed files with 67 additions and 205 deletions

136
Cargo.lock generated
View File

@ -157,6 +157,15 @@ dependencies = [
"futures-lite", "futures-lite",
] ]
[[package]]
name = "async-oneshot"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ec7c75bcbcb0139e9177f30692fd617405ca4e0c27802e128d53171f7042e2c"
dependencies = [
"futures-micro",
]
[[package]] [[package]]
name = "async-process" name = "async-process"
version = "1.2.0" version = "1.2.0"
@ -222,10 +231,10 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "bincode" name = "bincode"
version = "2.0.0-dev" version = "1.3.3"
source = "git+https://github.com/dequbed/bincode.git?branch=feature/in_place_buffer#bdea73bc3542257ef3b9788d4d54e53af236ed7a" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [ dependencies = [
"byteorder",
"serde", "serde",
] ]
@ -425,7 +434,6 @@ dependencies = [
"libc", "libc",
"num-integer", "num-integer",
"num-traits", "num-traits",
"time",
"winapi", "winapi",
] ]
@ -488,16 +496,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "crossbeam-channel"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.5" version = "0.8.5"
@ -557,6 +555,7 @@ dependencies = [
name = "diflouroborane" name = "diflouroborane"
version = "0.3.0" version = "0.3.0"
dependencies = [ dependencies = [
"async-oneshot",
"async-trait", "async-trait",
"bincode", "bincode",
"capnp", "capnp",
@ -565,7 +564,6 @@ dependencies = [
"capnpc", "capnpc",
"clap", "clap",
"erased-serde", "erased-serde",
"futures 0.3.16",
"futures-signals", "futures-signals",
"futures-test", "futures-test",
"inventory", "inventory",
@ -584,9 +582,6 @@ dependencies = [
"serde_dhall", "serde_dhall",
"serde_json", "serde_json",
"signal-hook", "signal-hook",
"slog",
"slog-async",
"slog-term",
"smol", "smol",
"tempfile", "tempfile",
"tracing", "tracing",
@ -613,27 +608,6 @@ dependencies = [
"generic-array 0.14.4", "generic-array 0.14.4",
] ]
[[package]]
name = "dirs-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
dependencies = [
"cfg-if 1.0.0",
"dirs-sys-next",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]] [[package]]
name = "discard" name = "discard"
version = "1.0.4" version = "1.0.4"
@ -776,7 +750,6 @@ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
"futures-util", "futures-util",
"num_cpus",
] ]
[[package]] [[package]]
@ -830,6 +803,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "futures-micro"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b460264b3593d68b16a7bc35f7bc226ddfebdf9a1c8db1ed95d5cc6b7168c826"
dependencies = [
"pin-project-lite",
]
[[package]] [[package]]
name = "futures-preview" name = "futures-preview"
version = "0.3.0-alpha.19" version = "0.3.0-alpha.19"
@ -1536,16 +1518,6 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "redox_users"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
dependencies = [
"getrandom",
"redox_syscall",
]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.4" version = "1.5.4"
@ -1689,12 +1661,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustversion"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.5" version = "1.0.5"
@ -1835,37 +1801,6 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
[[package]]
name = "slog"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06"
[[package]]
name = "slog-async"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "766c59b252e62a34651412870ff55d8c4e6d04df19b43eecb2703e417b097ffe"
dependencies = [
"crossbeam-channel",
"slog",
"take_mut",
"thread_local",
]
[[package]]
name = "slog-term"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95c1e7e5aab61ced6006149ea772770b84a0d16ce0f7885def313e4829946d76"
dependencies = [
"atty",
"chrono",
"slog",
"term",
"thread_local",
]
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.7.0" version = "1.7.0"
@ -1929,12 +1864,6 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "take_mut"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.2.0" version = "3.2.0"
@ -1949,17 +1878,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "term"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
dependencies = [
"dirs-next",
"rustversion",
"winapi",
]
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.1.2" version = "1.1.2"
@ -2007,16 +1925,6 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "time"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.3.1" version = "1.3.1"

View File

@ -16,63 +16,57 @@ default = ["lmdb"]
lmdb = [] lmdb = []
[dependencies] [dependencies]
futures = { version = "0.3.16", features = ["thread-pool", "compat"] } libc = "0.2.101"
#futures-util = "0.3.16" lazy_static = "1.4.0"
futures-signals = "0.3.22" uuid = { version = "0.8.2", features = ["serde", "v4"] }
async-trait = "0.1.51"
smol = "1.2.5"
tracing = "0.1.28"
tracing-subscriber = "0.2.25"
# Catch&Handle POSIX process signals
signal-hook = "0.3.9" signal-hook = "0.3.9"
slog = { version = "2.7.0", features = ["max_level_trace"] } # Argument parsing for bin/bffhd.rs
slog-term = "2.8.0" clap = "2.33.3"
slog-async = "2.7.0"
capnp = "0.14.3"
capnpc = "0.14.4"
capnp-rpc = "0.14.1"
capnp-futures = "0.14.1"
serde = { version = "1.0.130", features = ["derive"] }
erased-serde = "0.3"
#toml = "0.5.8"
#flexbuffers = "2.0.0"
# Internal Databases
lmdb-rkv = "0.14.0"
rkyv = "0.7" rkyv = "0.7"
ptr_meta = "0.1" ptr_meta = "0.1"
rkyv_typename = "0.7" rkyv_typename = "0.7"
rkyv_dyn = "0.7" rkyv_dyn = "0.7"
inventory = "0.1" inventory = "0.1"
# Password hashing for internal users
rust-argon2 = "0.8.3"
rand = "0.8.4"
# Async aware logging and tracing
tracing = "0.1.28"
tracing-subscriber = "0.2.25"
# API
capnp = "0.14.3"
capnpc = "0.14.4"
capnp-rpc = "0.14.1"
capnp-futures = "0.14.1"
# API Authentication
rsasl = "1.4.0" # TODO update this if bindgen breaks (again)
#rsasl = { path = "../../rsasl" }
futures-signals = "0.3.22"
async-oneshot = "0.5"
smol = "1.2.5"
# Config and Database (De)Serialization
serde = { version = "1.0.130", features = ["derive"] }
erased-serde = "0.3"
serde_dhall = { version = "0.10.1", default-features = false } serde_dhall = { version = "0.10.1", default-features = false }
serde_json = "1.0" serde_json = "1.0"
uuid = { version = "0.8.2", features = ["serde", "v4"] } # Shelly support
clap = "2.33.3"
# TODO update this if bindgen breaks (again)
rsasl = "1.4.0"
#rsasl = { path = "../../rsasl" }
# rumqtt needs tokio which I'm trying to get away from
paho-mqtt = { git = "https://github.com/dequbed/paho.mqtt.rust.git", branch = "master", features = ["build_bindgen"] } paho-mqtt = { git = "https://github.com/dequbed/paho.mqtt.rust.git", branch = "master", features = ["build_bindgen"] }
#mlua = { version = "0.4", features = ["async", "luajit"] }
libc = "0.2.101"
lmdb-rkv = "0.14.0"
async-trait = "0.1.51"
lazy_static = "1.4.0"
rust-argon2 = "0.8.3"
rand = "0.8.4"
[build-dependencies] [build-dependencies]
capnpc = "0.14.4" capnpc = "0.14.4"
# Used in build.rs to iterate over all files in schema/ # Used in build.rs to iterate over all files in schema/
@ -81,7 +75,4 @@ walkdir = "2.3.2"
[dev-dependencies] [dev-dependencies]
futures-test = "0.3.16" futures-test = "0.3.16"
tempfile = "3.2" tempfile = "3.2"
bincode = "2.0.0-dev" bincode = "1.3"
[patch.crates-io]
bincode = { git = "https://github.com/dequbed/bincode.git", branch = "feature/in_place_buffer" }

View File

@ -9,7 +9,8 @@ use diflouroborane::{config, error::Error};
use diflouroborane::db::{Databases, Dump}; use diflouroborane::db::{Databases, Dump};
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
fn main_res() -> Result<(), Error> { fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
// Argument parsing // Argument parsing
// values for the name, description and version are pulled from `Cargo.toml`. // values for the name, description and version are pulled from `Cargo.toml`.
let matches = App::new(crate_name!()) let matches = App::new(crate_name!())
@ -151,20 +152,4 @@ fn main_res() -> Result<(), Error> {
*/ */
Ok(()) Ok(())
}
fn main() {
let retval;
// Scope to drop everything before exiting.
{
tracing_subscriber::fmt::init();
match main_res() {
Ok(_) => retval = 0,
Err(e) => {
tracing::error!("{}", e);
retval = -1;
}
}
}
std::process::exit(retval);
} }

View File

@ -4,13 +4,14 @@ use std::collections::HashMap;
use serde::{Serialize, Deserialize, Deserializer, Serializer}; use serde::{Serialize, Deserialize, Deserializer, Serializer};
use crate::error::Result;
use std::fmt::Formatter; use std::fmt::Formatter;
use std::net::{SocketAddr, IpAddr, ToSocketAddrs}; use std::net::{SocketAddr, IpAddr, ToSocketAddrs};
use std::str::FromStr; use std::str::FromStr;
use crate::permissions::{PermRule, RoleIdentifier}; use crate::permissions::{PermRule, RoleIdentifier};
use serde::de::Error; use serde::de::Error;
type Result<T> = std::result::Result<T, serde_dhall::Error>;
pub fn read(path: &Path) -> Result<Config> { pub fn read(path: &Path) -> Result<Config> {
serde_dhall::from_file(path) serde_dhall::from_file(path)
.parse() .parse()

View File

@ -4,9 +4,6 @@ use serde_dhall;
use rsasl::SaslError; use rsasl::SaslError;
// SpawnError is a somewhat ambigous name, `use as` to make it futures::SpawnError instead.
use futures::task as futures_task;
use paho_mqtt::errors as mqtt; use paho_mqtt::errors as mqtt;
use crate::db::DBError; use crate::db::DBError;
@ -20,9 +17,7 @@ pub enum Error {
Boxed(Box<dyn std::error::Error>), Boxed(Box<dyn std::error::Error>),
Capnp(capnp::Error), Capnp(capnp::Error),
DB(DBError), DB(DBError),
FuturesSpawn(futures_task::SpawnError),
MQTT(mqtt::Error), MQTT(mqtt::Error),
BadVersion((u32,u32)),
Denied, Denied,
} }
@ -47,15 +42,9 @@ impl fmt::Display for Error {
Error::DB(e) => { Error::DB(e) => {
write!(f, "DB Error: {:?}", e) write!(f, "DB Error: {:?}", e)
}, },
Error::FuturesSpawn(e) => {
write!(f, "Future could not be spawned: {}", e)
},
Error::MQTT(e) => { Error::MQTT(e) => {
write!(f, "Paho MQTT encountered an error: {}", e) write!(f, "Paho MQTT encountered an error: {}", e)
}, },
Error::BadVersion((major,minor)) => {
write!(f, "Peer uses API version {}.{} which is incompatible!", major, minor)
}
Error::Denied => { Error::Denied => {
write!(f, "You do not have the permission required to do that.") write!(f, "You do not have the permission required to do that.")
} }
@ -99,22 +88,10 @@ impl From<DBError> for Error {
} }
} }
impl From<futures_task::SpawnError> for Error {
fn from(e: futures_task::SpawnError) -> Error {
Error::FuturesSpawn(e)
}
}
impl From<mqtt::Error> for Error { impl From<mqtt::Error> for Error {
fn from(e: mqtt::Error) -> Error { fn from(e: mqtt::Error) -> Error {
Error::MQTT(e) Error::MQTT(e)
} }
} }
/*impl From<network::Error> for Error { pub(crate) type Result<T> = std::result::Result<T, Error>;
fn from(e: network::Error) -> Error {
Error::EventNetwork(e)
}
}*/
pub(crate) type Result<T> = std::result::Result<T, Error>;

View File

@ -1,7 +1,7 @@
use async_trait::async_trait; use async_trait::async_trait;
use futures::channel::oneshot;
use futures_signals::signal::Mutable; use futures_signals::signal::Mutable;
use async_oneshot::{Sender };
use smol::channel::Receiver; use smol::channel::Receiver;
@ -47,7 +47,7 @@ pub trait Resource {
pub struct Update { pub struct Update {
pub state: State, pub state: State,
pub errchan: oneshot::Sender<DBError>, pub errchan: Sender<DBError>,
} }
pub struct ResourceDriver { pub struct ResourceDriver {
@ -67,7 +67,7 @@ impl ResourceDriver {
pub async fn drive_to_end(&mut self) { pub async fn drive_to_end(&mut self) {
while let Ok(update) = self.rx.recv().await { while let Ok(update) = self.rx.recv().await {
let state = update.state; let state = update.state;
let errchan = update.errchan; let mut errchan = update.errchan;
match self.res.update(&state).await { match self.res.update(&state).await {
Ok(outstate) => { Ok(outstate) => {