-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
83 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: fmt | ||
name: fmt | ||
entry: cargo fmt -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" | ||
language: system | ||
types: [rust] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,30 +12,33 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
use std::{ | ||
convert::{TryFrom, TryInto}, | ||
str::FromStr, | ||
time::{Duration, Instant}, | ||
}; | ||
|
||
use async_std::task; | ||
use async_trait::async_trait; | ||
use base64::{engine::general_purpose::STANDARD as b64_std_engine, Engine}; | ||
use influxdb::{ | ||
Client, ReadQuery as InfluxRQuery, Timestamp as InfluxTimestamp, WriteQuery as InfluxWQuery, | ||
}; | ||
use serde::Deserialize; | ||
use std::convert::{TryFrom, TryInto}; | ||
use std::str::FromStr; | ||
use std::time::{Duration, Instant}; | ||
use tracing::{debug, error, warn}; | ||
use uuid::Uuid; | ||
use zenoh::encoding::Encoding; | ||
use zenoh::internal::{bail, buffers::ZBuf, zerror, Timed, TimedEvent, TimedHandle, Timer, Value}; | ||
use zenoh::key_expr::KeyExpr; | ||
use zenoh::key_expr::{keyexpr, OwnedKeyExpr}; | ||
use zenoh::selector::{Parameters, TimeBound, TimeExpr, TimeRange}; | ||
use zenoh::time::Timestamp; | ||
use zenoh::{try_init_log_from_env, Error, Result as ZResult}; | ||
use zenoh_backend_traits::config::{ | ||
PrivacyGetResult, PrivacyTransparentGet, StorageConfig, VolumeConfig, | ||
use zenoh::{ | ||
bytes::Encoding, | ||
internal::{bail, buffers::ZBuf, zerror, Timed, TimedEvent, TimedHandle, Timer, Value}, | ||
key_expr::{keyexpr, KeyExpr, OwnedKeyExpr}, | ||
query::{Parameters, TimeBound, TimeExpr, TimeRange}, | ||
time::Timestamp, | ||
try_init_log_from_env, Error, Result as ZResult, | ||
}; | ||
use zenoh_backend_traits::{ | ||
config::{PrivacyGetResult, PrivacyTransparentGet, StorageConfig, VolumeConfig}, | ||
StorageInsertionResult, *, | ||
}; | ||
use zenoh_backend_traits::StorageInsertionResult; | ||
use zenoh_backend_traits::*; | ||
use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin}; | ||
|
||
// Properties used by the Backend | ||
|
@@ -922,8 +925,9 @@ fn clauses_from_parameters(p: &str) -> ZResult<String> { | |
} | ||
|
||
fn write_timeexpr(s: &mut String, t: TimeExpr) { | ||
use humantime::format_rfc3339; | ||
use std::fmt::Write; | ||
|
||
use humantime::format_rfc3339; | ||
match t { | ||
TimeExpr::Fixed(t) => write!(s, "'{}'", format_rfc3339(t)), | ||
TimeExpr::Now { offset_secs } => write!(s, "now(){offset_secs:+}s"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,35 +12,39 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
use std::{ | ||
convert::{TryFrom, TryInto}, | ||
str::FromStr, | ||
time::{Duration, Instant, UNIX_EPOCH}, | ||
}; | ||
|
||
use async_std::task; | ||
use async_trait::async_trait; | ||
use base64::{engine::general_purpose::STANDARD as b64_std_engine, Engine}; | ||
use chrono::{NaiveDateTime, SecondsFormat}; | ||
use futures::prelude::*; | ||
use influxdb2::api::buckets::ListBucketsRequest; | ||
use influxdb2::models::Query; | ||
use influxdb2::models::{DataPoint, PostBucketRequest}; | ||
use influxdb2::Client; | ||
use influxdb2::FromDataPoint; | ||
use std::convert::{TryFrom, TryInto}; | ||
use std::str::FromStr; | ||
use std::time::{Duration, Instant, UNIX_EPOCH}; | ||
use influxdb2::{ | ||
api::buckets::ListBucketsRequest, | ||
models::{DataPoint, PostBucketRequest, Query}, | ||
Client, FromDataPoint, | ||
}; | ||
use uuid::Uuid; | ||
use zenoh::encoding::Encoding; | ||
use zenoh::internal::{ | ||
bail, | ||
buffers::{SplitBuffer, ZBuf}, | ||
zerror, Timed, TimedEvent, TimedHandle, Timer, Value, | ||
use zenoh::{ | ||
bytes::Encoding, | ||
internal::{ | ||
bail, | ||
buffers::{SplitBuffer, ZBuf}, | ||
zerror, Timed, TimedEvent, TimedHandle, Timer, Value, | ||
}, | ||
key_expr::{keyexpr, OwnedKeyExpr}, | ||
query::{Parameters, TimeExpr}, | ||
time::{new_timestamp, Timestamp}, | ||
try_init_log_from_env, Error, Result as ZResult, | ||
}; | ||
use zenoh::key_expr::{keyexpr, OwnedKeyExpr}; | ||
use zenoh::selector::{Parameters, TimeExpr}; | ||
use zenoh::time::{new_timestamp, Timestamp}; | ||
use zenoh::{try_init_log_from_env, Error, Result as ZResult}; | ||
use zenoh_backend_traits::config::{ | ||
PrivacyGetResult, PrivacyTransparentGet, StorageConfig, VolumeConfig, | ||
use zenoh_backend_traits::{ | ||
config::{PrivacyGetResult, PrivacyTransparentGet, StorageConfig, VolumeConfig}, | ||
StorageInsertionResult, *, | ||
}; | ||
use zenoh_backend_traits::StorageInsertionResult; | ||
use zenoh_backend_traits::*; | ||
use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin}; | ||
|
||
// Properties used by the Backend | ||
|
@@ -847,7 +851,7 @@ fn key_exprs_to_influx_regex(path_exprs: &[&keyexpr]) -> String { | |
} | ||
|
||
fn timerange_from_parameters(p: &str) -> ZResult<Option<String>> { | ||
use zenoh::selector::{TimeBound, TimeRange}; | ||
use zenoh::query::{TimeBound, TimeRange}; | ||
let time_range = TimeRange::from_str(p); | ||
let mut result = String::new(); | ||
match time_range { | ||
|