Skip to content

Commit

Permalink
Merge pull request #111 from rneswold/pull-request
Browse files Browse the repository at this point in the history
prep for v0.4.0
  • Loading branch information
rneswold authored Apr 18, 2024
2 parents 4807d10 + 43a5549 commit 74174fa
Show file tree
Hide file tree
Showing 13 changed files with 327 additions and 500 deletions.
628 changes: 217 additions & 411 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"drmemd"
]
default-members = ["drmemd"]
resolver = "2"

[workspace.dependencies]
async-trait = { version = "0.1", default-features = false }
Expand All @@ -19,7 +20,7 @@ tokio = { version = "1", default-features = false }
tokio-stream = { version = "0.1", default-features = false }
tracing = { version = "0.1", features = ["std"] }
tracing-futures = { version = "0.2", default-features = false }
tracing-subscriber = { version = "0.2", default-features = false }
tracing-subscriber = { version = "0.3", default-features = false }

serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions backends/drmem-db-redis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmem-db-redis"
version = "0.3.0"
version = "0.4.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
description = "Redis backend for DrMem control system"
Expand Down Expand Up @@ -35,8 +35,8 @@ serde_derive.workspace = true

palette.workspace = true

redis.version = "0.22"
redis.version = "0.25"
redis.default-features = false
redis.features = ["tokio-comp", "streams"]

drmem-api = { path = "../../drmem-api", version = "0.3" }
drmem-api = { path = "../../drmem-api", version = "0.4" }
27 changes: 17 additions & 10 deletions backends/drmem-db-redis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use tracing::{debug, error, info, info_span, warn};
use tracing_futures::Instrument;

type AioMplexConnection = aio::MultiplexedConnection;
type AioConnection = aio::Connection;
type SettingTable = HashMap<device::Name, TxDeviceSetting>;

pub mod config;
Expand Down Expand Up @@ -260,8 +259,9 @@ fn id_to_ts(id: &str) -> Result<time::SystemTime> {

type ReadFuture = Pin<
Box<
dyn Future<Output = (AioConnection, redis::RedisResult<redis::Value>)>
+ Send,
dyn Future<
Output = (AioMplexConnection, redis::RedisResult<redis::Value>),
> + Send,
>,
>;

Expand Down Expand Up @@ -305,7 +305,11 @@ impl ReadingStream {
// returns it with the result.) This is necessary because an
// AioConnection isn't clonable.

fn mk_fut(mut con: AioConnection, key: String, id: String) -> ReadFuture {
fn mk_fut(
mut con: AioMplexConnection,
key: String,
id: String,
) -> ReadFuture {
Box::pin(async move {
let result =
Self::read_next_cmd(&key, &id).query_async(&mut con).await;
Expand All @@ -315,7 +319,7 @@ impl ReadingStream {
}

pub fn new(
con: AioConnection,
con: AioMplexConnection,
key: &str,
id: Option<time::SystemTime>,
) -> Self {
Expand Down Expand Up @@ -456,15 +460,18 @@ impl RedisStore {
cfg: &config::Config,
name: Option<String>,
pword: Option<String>,
) -> Result<AioConnection> {
) -> Result<AioMplexConnection> {
let client = Self::make_client(cfg, name.as_ref(), pword.as_ref())?;

debug!("creating new redis connection");

client.get_tokio_connection().await.map_err(|e| {
error!("redis error: {}", &e);
xlat_err(e)
})
client
.get_multiplexed_tokio_connection()
.await
.map_err(|e| {
error!("redis error: {}", &e);
xlat_err(e)
})
}

// Creates a mulitplexed connection to redis.
Expand Down
4 changes: 2 additions & 2 deletions backends/drmem-db-simple/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "drmem-db-simple"
authors = ["Rich Neswold <[email protected]>"]
version = "0.3.1"
version = "0.4.0"
edition = "2021"
description = "Simple backend for DrMem control system"
homepage = "https://github.com/DrMemCS/drmem"
Expand Down Expand Up @@ -31,7 +31,7 @@ tracing.workspace = true
serde.workspace = true
serde_derive.workspace = true

drmem-api = { path = "../../drmem-api", version = "0.3" }
drmem-api = { path = "../../drmem-api", version = "0.4" }

[dev-dependencies]
tokio-stream = { workspace = true, features = ["sync", "time"] }
4 changes: 2 additions & 2 deletions drivers/drmem-drv-ntp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmem-drv-ntp"
version = "0.3.0"
version = "0.4.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
homepage = "https://github.com/DrMemCS/drmem"
Expand All @@ -21,4 +21,4 @@ tracing.workspace = true
tracing-futures.workspace = true
tracing-subscriber.workspace = true

drmem-api = { path = "../../drmem-api", version = "0.3" }
drmem-api = { path = "../../drmem-api", version = "0.4" }
4 changes: 2 additions & 2 deletions drivers/drmem-drv-sump/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmem-drv-sump"
version = "0.3.0"
version = "0.4.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
homepage = "https://github.com/DrMemCS/drmem"
Expand All @@ -23,4 +23,4 @@ tracing.workspace = true
tracing-futures.workspace = true
tracing-subscriber.workspace = true

drmem-api = { path = "../../drmem-api", version = "0.3" }
drmem-api = { path = "../../drmem-api", version = "0.4" }
4 changes: 2 additions & 2 deletions drivers/drmem-drv-tplink/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmem-drv-tplink"
version = "0.1.2"
version = "0.2.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
homepage = "https://github.com/DrMemCS/drmem"
Expand All @@ -25,4 +25,4 @@ serde = { workspace = true, features = ["derive"] }
serde_derive.workspace = true
serde_json = { workspace = true, features = ["std"] }

drmem-api = { path = "../../drmem-api", version = "0.3.1" }
drmem-api = { path = "../../drmem-api", version = "0.4" }
4 changes: 2 additions & 2 deletions drivers/drmem-drv-weather-wu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmem-drv-weather-wu"
version = "0.3.0"
version = "0.4.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
homepage = "https://github.com/DrMemCS/drmem"
Expand All @@ -24,4 +24,4 @@ tracing-subscriber.workspace = true
reqwest = { default-features = false, version = "0.11" }
weather-underground = "0.1"

drmem-api = { path = "../../drmem-api", version = "0.3" }
drmem-api = { path = "../../drmem-api", version = "0.4" }
2 changes: 1 addition & 1 deletion drmem-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmem-api"
version = "0.3.1"
version = "0.4.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
description = "Traits and types used internally by the DrMem control system"
Expand Down
27 changes: 14 additions & 13 deletions drmemd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drmemd"
version = "0.3.1"
version = "0.4.0"
authors = ["Rich Neswold <[email protected]>"]
edition = "2021"
description = "Main process of the DrMem control system"
Expand Down Expand Up @@ -33,15 +33,15 @@ tracing-subscriber = { workspace = true, features = ["ansi"] }
serde.workspace = true
serde_derive.workspace = true

clap = { version = "~4.4", features = ["cargo"] }
clap = { version = "4", features = ["cargo"] }

chrono = { workspace = true, features = ["clock"] }

palette.workspace = true

lazy_static = "1"

drmem-api = { path = "../drmem-api", version = "0.3" }
drmem-api = { path = "../drmem-api", version = "0.4" }

cfgrammar = "0.13"
lrlex = "0.13"
Expand All @@ -53,58 +53,59 @@ lrpar = "0.13"

[dependencies.drmem-drv-ntp]
path = "../drivers/drmem-drv-ntp"
version = "0.3"
version = "0.4"
optional = true

[dependencies.drmem-drv-sump]
path = "../drivers/drmem-drv-sump"
version = "0.3"
version = "0.4"
optional = true

[dependencies.drmem-drv-tplink]
path = "../drivers/drmem-drv-tplink"
version = "0.1"
version = "0.2"
optional = true

[dependencies.drmem-drv-weather-wu]
path = "../drivers/drmem-drv-weather-wu"
version = "0.3"
version = "0.4"
optional = true

# This section defines the optional dependencies for backend storage.

[dependencies.drmem-db-redis]
path = "../backends/drmem-db-redis"
version = "0.3"
version = "0.4"
optional = true

[dependencies.drmem-db-simple]
path = "../backends/drmem-db-simple"
version = "0.3.1"
version = "0.4"
optional = true

# This section defines the optional dependencies for the 'graphql'
# feature.

[dependencies.juniper]
version = "0.15"
version = "0.16"
features = ["chrono"]
optional = true

[dependencies.juniper_warp]
version = "0.7"
version = "0.8"
features = ["subscriptions"]
optional = true

[dependencies.juniper_graphql_ws]
version = "0.3"
version = "0.4"
optional = true

[dependencies.warp]
version = "0.3"
optional = true

[dependencies.libmdns]
version = "0.7"
version = "0.8"
optional = true

# These are features that can be enabled for drmem.
Expand Down
2 changes: 2 additions & 0 deletions drmemd/src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ impl DriverDb {
/// found, it extracts the information needed for the GraphQL
/// query and returns it.
#[cfg(feature = "graphql")]
pub fn find(
&self,
key: &str,
Expand All @@ -273,6 +274,7 @@ impl DriverDb {
/// Similar to `.find()`, but returns all the drivers'
/// information.
#[cfg(feature = "graphql")]
pub fn get_all(
&self,
) -> impl Iterator<Item = (driver::Name, &'static str, &'static str)> + '_
Expand Down
Loading

0 comments on commit 74174fa

Please sign in to comment.