Skip to content

Commit 28c33ab

Browse files
authored
Expose timestamp instrumentation API (#736)
* Add TimestampStack API * Add timestamp stack callback to Session API * Update zenoh git ref * Fix formatting * Fix clippy warning * Apply review comments * Add missing @Property to stubs * Apply upstream API changes * Fix file formatting
1 parent 8b85f00 commit 28c33ab

12 files changed

Lines changed: 798 additions & 47 deletions

File tree

Cargo.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ maintenance = { status = "actively-developed" }
4444
[dependencies]
4545
paste = "1.0.14"
4646
pyo3 = { version = "0.25.1", features = ["abi3-py39", "extension-module"] }
47-
zenoh = { version = "1.9.0", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
47+
zenoh = { version = "1.9.0", git = "https://github.com/zettascalelabs/zenoh.git", branch = "feat/routing-timestamps", features = [
4848
"internal",
4949
"unstable",
5050
], default-features = false }
51-
zenoh-ext = { version = "1.9.0", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
51+
zenoh-ext = { version = "1.9.0", git = "https://github.com/zettascalelabs/zenoh.git", branch = "feat/routing-timestamps", features = [
5252
"internal",
5353
], optional = true }

src/ext.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::{
2424
sample::{Locality, Sample},
2525
session::{EntityGlobalId, Session},
2626
time::Timestamp,
27+
timestamp_stack::TimestampInstrumentation,
2728
utils::{duration, generic, wait, MapInto},
2829
ZDeserializeError,
2930
};
@@ -492,30 +493,46 @@ impl AdvancedPublisher {
492493
Ok(self.get_ref()?.priority().into())
493494
}
494495

495-
#[pyo3(signature = (payload, *, encoding = None, attachment = None, timestamp = None))]
496+
#[pyo3(signature = (payload, *, encoding = None, attachment = None, timestamp = None, timestamp_instrumentation = None))]
496497
fn put(
497498
&self,
498499
py: Python,
499500
#[pyo3(from_py_with = ZBytes::from_py)] payload: ZBytes,
500501
#[pyo3(from_py_with = Encoding::from_py_opt)] encoding: Option<Encoding>,
501502
#[pyo3(from_py_with = ZBytes::from_py_opt)] attachment: Option<ZBytes>,
502503
timestamp: Option<Timestamp>,
504+
timestamp_instrumentation: Option<TimestampInstrumentation>,
503505
) -> PyResult<()> {
504506
let this = self.get_ref()?;
505507
wait(
506508
py,
507-
build!(this.put(payload), encoding, attachment, timestamp),
509+
build!(
510+
this.put(payload),
511+
encoding,
512+
attachment,
513+
timestamp,
514+
timestamp_instrumentation
515+
),
508516
)
509517
}
510518

511-
#[pyo3(signature = (*, attachment = None, timestamp = None))]
519+
#[pyo3(signature = (*, attachment = None, timestamp = None, timestamp_instrumentation = None))]
512520
fn delete(
513521
&self,
514522
py: Python,
515523
#[pyo3(from_py_with = ZBytes::from_py_opt)] attachment: Option<ZBytes>,
516524
timestamp: Option<Timestamp>,
525+
timestamp_instrumentation: Option<TimestampInstrumentation>,
517526
) -> PyResult<()> {
518-
wait(py, build!(self.get_ref()?.delete(), attachment, timestamp))
527+
wait(
528+
py,
529+
build!(
530+
self.get_ref()?.delete(),
531+
attachment,
532+
timestamp,
533+
timestamp_instrumentation
534+
),
535+
)
519536
}
520537

521538
fn undeclare(&mut self, py: Python) -> PyResult<()> {

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mod session;
3232
#[cfg(feature = "shared-memory")]
3333
mod shm;
3434
mod time;
35+
mod timestamp_stack;
3536
mod utils;
3637

3738
use pyo3::prelude::*;
@@ -77,6 +78,10 @@ pub(crate) mod zenoh {
7778
Transport, TransportEvent, TransportEventsListener,
7879
},
7980
time::{Timestamp, TimestampId, NTP64},
81+
timestamp_stack::{
82+
InterceptionPoint, TimestampContext, TimestampInstrumentation,
83+
TimestampInstrumentationBuilder, TimestampStack, TimestampStackRecord,
84+
},
8085
ZError,
8186
};
8287

0 commit comments

Comments
 (0)