Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rocksdb to use timestamp_rework #126

Merged
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ serde_json = "1.0.114"
tracing = "0.1"
uhlc = "0.7.0"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", features = [
"unstable",
"internal",
"plugins"
"unstable",
"internal",
"plugins",
] }
zenoh_backend_traits = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" }
zenoh-plugin-trait = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" }
Expand Down
24 changes: 4 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use zenoh::{
internal::{bail, zenoh_home, zerror, Value},
key_expr::OwnedKeyExpr,
query::Parameters,
time::{new_timestamp, Timestamp},
time::Timestamp,
try_init_log_from_env, Error, Result as ZResult,
};
use zenoh_backend_traits::{
Expand Down Expand Up @@ -464,26 +464,10 @@ fn get_kv(db: &DB, key: Option<OwnedKeyExpr>) -> ZResult<Option<(Value, Timestam
Ok(Some((Value::new(payload, encoding), timestamp)))
}
}
(Ok(Some(payload)), Ok(None)) => {
(Ok(_), Ok(None)) => {
trace!("second ok");
// Only the payload is present in DB!
// Possibly legacy data. Consider as encoding as APP_OCTET_STREAM and create timestamp from now()

match std::num::NonZeroU128::new(1u128)
.map(new_timestamp)
.map(|timestamp| {
(
Value::new(payload, Encoding::APPLICATION_OCTET_STREAM),
timestamp,
)
})
.map(|x| Ok(Some(x)))
{
Some(x) => x,
None => {
bail!("Error Creating Timestamp ID for 0x01");
}
}
warn!("no {CF_DATA_INFO} in database, however payload data exists. Possible Legacy / Dirty state of Database. Unsupported in case of Replication");
Ok(None)
}
(Ok(None), _) => Ok(None),
(Err(err), _) | (_, Err(err)) => Err(rocksdb_err_to_zerr(err)),
Expand Down