Skip to content

Commit 0ece88f

Browse files
committed
feat(s2n-quic-core): implement nominal timers
1 parent 799921c commit 0ece88f

26 files changed

+1839
-891
lines changed

dc/s2n-quic-dc/events/common.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
struct ConnectionMeta {
55
id: u64,
6+
timestamp: Timestamp,
67
}
78

8-
struct EndpointMeta {}
9+
struct EndpointMeta {
10+
timestamp: Timestamp,
11+
}
912

1013
struct ConnectionInfo {}

dc/s2n-quic-dc/events/map.rs

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ struct PathSecretMapUninitialized {
1919
/// The number of entries in the map
2020
#[measure("entries")]
2121
entries: usize,
22+
23+
#[measure("lifetime")]
24+
lifetime: core::time::Duration,
2225
}
2326

2427
#[event("path_secret_map:background_handshake_requested")]

dc/s2n-quic-dc/src/event.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#[cfg(any(test, feature = "testing"))]
55
use s2n_quic_core::event::snapshot;
66

7-
pub use s2n_quic_core::event::{Event, IntoEvent};
7+
pub use s2n_quic_core::event::{Event, IntoEvent, Timestamp};
88

99
/// Provides metadata related to an event
1010
pub trait Meta: core::fmt::Debug {

dc/s2n-quic-dc/src/event/generated.rs

+31-8
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,27 @@ pub mod api {
1818
#[non_exhaustive]
1919
pub struct ConnectionMeta {
2020
pub id: u64,
21+
pub timestamp: Timestamp,
2122
}
2223
#[cfg(any(test, feature = "testing"))]
2324
impl crate::event::snapshot::Fmt for ConnectionMeta {
2425
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2526
let mut fmt = fmt.debug_struct("ConnectionMeta");
2627
fmt.field("id", &self.id);
28+
fmt.field("timestamp", &self.timestamp);
2729
fmt.finish()
2830
}
2931
}
3032
#[derive(Clone, Debug)]
3133
#[non_exhaustive]
32-
pub struct EndpointMeta {}
34+
pub struct EndpointMeta {
35+
pub timestamp: Timestamp,
36+
}
3337
#[cfg(any(test, feature = "testing"))]
3438
impl crate::event::snapshot::Fmt for EndpointMeta {
3539
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3640
let mut fmt = fmt.debug_struct("EndpointMeta");
41+
fmt.field("timestamp", &self.timestamp);
3742
fmt.finish()
3843
}
3944
}
@@ -133,13 +138,15 @@ pub mod api {
133138
pub capacity: usize,
134139
#[doc = " The number of entries in the map"]
135140
pub entries: usize,
141+
pub lifetime: core::time::Duration,
136142
}
137143
#[cfg(any(test, feature = "testing"))]
138144
impl crate::event::snapshot::Fmt for PathSecretMapUninitialized {
139145
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
140146
let mut fmt = fmt.debug_struct("PathSecretMapUninitialized");
141147
fmt.field("capacity", &self.capacity);
142148
fmt.field("entries", &self.entries);
149+
fmt.field("lifetime", &self.lifetime);
143150
fmt.finish()
144151
}
145152
}
@@ -637,8 +644,12 @@ pub mod tracing {
637644
event: &api::PathSecretMapUninitialized,
638645
) {
639646
let parent = self.parent(meta);
640-
let api::PathSecretMapUninitialized { capacity, entries } = event;
641-
tracing :: event ! (target : "path_secret_map_uninitialized" , parent : parent , tracing :: Level :: DEBUG , capacity = tracing :: field :: debug (capacity) , entries = tracing :: field :: debug (entries));
647+
let api::PathSecretMapUninitialized {
648+
capacity,
649+
entries,
650+
lifetime,
651+
} = event;
652+
tracing :: event ! (target : "path_secret_map_uninitialized" , parent : parent , tracing :: Level :: DEBUG , capacity = tracing :: field :: debug (capacity) , entries = tracing :: field :: debug (entries) , lifetime = tracing :: field :: debug (lifetime));
642653
}
643654
#[inline]
644655
fn on_path_secret_map_background_handshake_requested(
@@ -921,23 +932,29 @@ pub mod builder {
921932
#[derive(Clone, Debug)]
922933
pub struct ConnectionMeta {
923934
pub id: u64,
935+
pub timestamp: Timestamp,
924936
}
925937
impl IntoEvent<api::ConnectionMeta> for ConnectionMeta {
926938
#[inline]
927939
fn into_event(self) -> api::ConnectionMeta {
928-
let ConnectionMeta { id } = self;
940+
let ConnectionMeta { id, timestamp } = self;
929941
api::ConnectionMeta {
930942
id: id.into_event(),
943+
timestamp: timestamp.into_event(),
931944
}
932945
}
933946
}
934947
#[derive(Clone, Debug)]
935-
pub struct EndpointMeta {}
948+
pub struct EndpointMeta {
949+
pub timestamp: Timestamp,
950+
}
936951
impl IntoEvent<api::EndpointMeta> for EndpointMeta {
937952
#[inline]
938953
fn into_event(self) -> api::EndpointMeta {
939-
let EndpointMeta {} = self;
940-
api::EndpointMeta {}
954+
let EndpointMeta { timestamp } = self;
955+
api::EndpointMeta {
956+
timestamp: timestamp.into_event(),
957+
}
941958
}
942959
}
943960
#[derive(Clone, Debug)]
@@ -1030,14 +1047,20 @@ pub mod builder {
10301047
pub capacity: usize,
10311048
#[doc = " The number of entries in the map"]
10321049
pub entries: usize,
1050+
pub lifetime: core::time::Duration,
10331051
}
10341052
impl IntoEvent<api::PathSecretMapUninitialized> for PathSecretMapUninitialized {
10351053
#[inline]
10361054
fn into_event(self) -> api::PathSecretMapUninitialized {
1037-
let PathSecretMapUninitialized { capacity, entries } = self;
1055+
let PathSecretMapUninitialized {
1056+
capacity,
1057+
entries,
1058+
lifetime,
1059+
} = self;
10381060
api::PathSecretMapUninitialized {
10391061
capacity: capacity.into_event(),
10401062
entries: entries.into_event(),
1063+
lifetime: lifetime.into_event(),
10411064
}
10421065
}
10431066
}

0 commit comments

Comments
 (0)