Skip to content

Commit

Permalink
Update rocksdb to use timestamp_rework (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Schleich authored Jul 5, 2024
1 parent 53b9fa0 commit 324b22b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
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

0 comments on commit 324b22b

Please sign in to comment.