13
13
//
14
14
use serde:: { Deserialize , Serialize } ;
15
15
use zenoh_keyexpr:: keyexpr_tree:: { IKeyExprTreeMut , KeBoxTree } ;
16
- use zenoh_protocol:: core:: { key_expr:: OwnedKeyExpr , CongestionControl , Reliability } ;
16
+ use zenoh_protocol:: core:: { key_expr:: OwnedKeyExpr , CongestionControl , Priority , Reliability } ;
17
17
18
18
#[ derive( Debug , Deserialize , Default , Serialize , Clone ) ]
19
19
pub struct PublisherQoSConfList ( pub ( crate ) Vec < PublisherQoSConf > ) ;
@@ -39,32 +39,32 @@ pub(crate) struct PublisherQoSConf {
39
39
40
40
#[ derive( Debug , Default , Deserialize , Serialize , Clone ) ]
41
41
pub struct PublisherQoSConfig {
42
- pub congestion_control : Option < PublisherCongestionControlConf > ,
43
- pub priority : Option < PublisherPriorityConf > ,
42
+ pub congestion_control : Option < CongestionControlConf > ,
43
+ pub priority : Option < PriorityConf > ,
44
44
pub express : Option < bool > ,
45
45
#[ cfg( feature = "unstable" ) ]
46
- pub reliability : Option < PublisherReliabilityConf > ,
46
+ pub reliability : Option < ReliabilityConf > ,
47
47
#[ cfg( feature = "unstable" ) ]
48
48
pub allowed_destination : Option < PublisherLocalityConf > ,
49
49
}
50
50
51
51
#[ derive( Debug , Deserialize , Serialize , Clone , Copy ) ]
52
52
#[ serde( rename_all = "lowercase" ) ]
53
- pub enum PublisherCongestionControlConf {
53
+ pub enum CongestionControlConf {
54
54
Drop ,
55
55
Block ,
56
56
}
57
57
58
- impl From < PublisherCongestionControlConf > for CongestionControl {
59
- fn from ( value : PublisherCongestionControlConf ) -> Self {
58
+ impl From < CongestionControlConf > for CongestionControl {
59
+ fn from ( value : CongestionControlConf ) -> Self {
60
60
match value {
61
- PublisherCongestionControlConf :: Drop => Self :: Drop ,
62
- PublisherCongestionControlConf :: Block => Self :: Block ,
61
+ CongestionControlConf :: Drop => Self :: Drop ,
62
+ CongestionControlConf :: Block => Self :: Block ,
63
63
}
64
64
}
65
65
}
66
66
67
- impl From < CongestionControl > for PublisherCongestionControlConf {
67
+ impl From < CongestionControl > for CongestionControlConf {
68
68
fn from ( value : CongestionControl ) -> Self {
69
69
match value {
70
70
CongestionControl :: Drop => Self :: Drop ,
@@ -75,7 +75,7 @@ impl From<CongestionControl> for PublisherCongestionControlConf {
75
75
76
76
#[ derive( Debug , Deserialize , Serialize , Clone , Copy ) ]
77
77
#[ serde( rename_all = "snake_case" ) ]
78
- pub enum PublisherPriorityConf {
78
+ pub enum PriorityConf {
79
79
RealTime = 1 ,
80
80
InteractiveHigh = 2 ,
81
81
InteractiveLow = 3 ,
@@ -85,23 +85,37 @@ pub enum PublisherPriorityConf {
85
85
Background = 7 ,
86
86
}
87
87
88
+ impl From < PriorityConf > for Priority {
89
+ fn from ( value : PriorityConf ) -> Self {
90
+ match value {
91
+ PriorityConf :: RealTime => Self :: RealTime ,
92
+ PriorityConf :: InteractiveHigh => Self :: InteractiveHigh ,
93
+ PriorityConf :: InteractiveLow => Self :: InteractiveLow ,
94
+ PriorityConf :: DataHigh => Self :: DataHigh ,
95
+ PriorityConf :: Data => Self :: Data ,
96
+ PriorityConf :: DataLow => Self :: DataLow ,
97
+ PriorityConf :: Background => Self :: Background ,
98
+ }
99
+ }
100
+ }
101
+
88
102
#[ derive( Debug , Deserialize , Serialize , Clone , Copy ) ]
89
103
#[ serde( rename_all = "snake_case" ) ]
90
- pub enum PublisherReliabilityConf {
104
+ pub enum ReliabilityConf {
91
105
BestEffort ,
92
106
Reliable ,
93
107
}
94
108
95
- impl From < PublisherReliabilityConf > for Reliability {
96
- fn from ( value : PublisherReliabilityConf ) -> Self {
109
+ impl From < ReliabilityConf > for Reliability {
110
+ fn from ( value : ReliabilityConf ) -> Self {
97
111
match value {
98
- PublisherReliabilityConf :: BestEffort => Self :: BestEffort ,
99
- PublisherReliabilityConf :: Reliable => Self :: Reliable ,
112
+ ReliabilityConf :: BestEffort => Self :: BestEffort ,
113
+ ReliabilityConf :: Reliable => Self :: Reliable ,
100
114
}
101
115
}
102
116
}
103
117
104
- impl From < Reliability > for PublisherReliabilityConf {
118
+ impl From < Reliability > for ReliabilityConf {
105
119
fn from ( value : Reliability ) -> Self {
106
120
match value {
107
121
Reliability :: BestEffort => Self :: BestEffort ,
@@ -117,3 +131,13 @@ pub enum PublisherLocalityConf {
117
131
Remote ,
118
132
Any ,
119
133
}
134
+
135
+ #[ derive( Debug , Default , Deserialize , Serialize , Clone ) ]
136
+ pub struct QosOverwrites {
137
+ pub congestion_control : Option < CongestionControlConf > ,
138
+ pub priority : Option < PriorityConf > ,
139
+ pub express : Option < bool > ,
140
+ // TODO: Add support for reliability overwrite (it is not possible right now, since reliability is not a part of RoutingContext, nor NetworkMessage)
141
+ // #[cfg(feature = "unstable")]
142
+ // pub reliability: Option<ReliabilityConf>,
143
+ }
0 commit comments