-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feat for media server #165
Conversation
…xt-hop which include it-self
WalkthroughWalkthroughThe recent modifications across multiple files introduce significant changes to type parameters, pattern matching, and data structures. These include updates to the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #165 +/- ##
==========================================
- Coverage 83.62% 83.59% -0.04%
==========================================
Files 68 68
Lines 8972 9019 +47
==========================================
+ Hits 7503 7539 +36
- Misses 1469 1480 +11 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 49
Out of diff range and nitpick comments (4)
packages/network/src/data_plane/connection.rs (1)
Line range hint
29-37
: Avoid magic numbers in buffer size calculations.- buf.ensure_back(12 + 16); //TODO remove magic numbers + const HEADER_SIZE: usize = 12; + const ENCRYPTION_OVERHEAD: usize = 16; + buf.ensure_back(HEADER_SIZE + ENCRYPTION_OVERHEAD);Using named constants instead of magic numbers improves code readability and maintainability.
packages/network/src/services/visualization.rs (1)
Line range hint
74-85
: Consider adding a comment to explain the purpose of theVisualizationService
implementation block.+ // Implementation block for VisualizationService impl<UserData: Copy, SC, SE, TC, TW> VisualizationService<UserData, SC, SE, TC, TW> where SC: From<Control> + TryInto<Control>, SE: From<Event> + TryInto<Event>, { pub fn new() -> Self { Self { broadcast_seq: 0, last_ping: 0, conns: BTreeMap::new(), network_nodes: BTreeMap::new(), queue: VecDeque::from([ServiceOutput::FeatureControl(FeaturesControl::Data(data::Control::DataListen(DATA_PORT)))]), subscribers: Vec::new(), _tmp: std::marker::PhantomData, } } fn fire_event(&mut self, event: Event) { for sub in self.subscribers.iter() { self.queue.push_back(ServiceOutput::Event(*sub, event.clone().into())); } } }
packages/network/src/data_plane.rs (1)
Line range hint
129-149
: Theon_input
method doesn't need a mutable reference forself.switcher
.- self.features.input(&mut self.switcher).on_input(&mut self.feature_ctx, feature, now_ms, FeatureWorkerInput::Control(actor, control)); + self.features.input(&self.switcher).on_input(&mut self.feature_ctx, feature, now_ms, FeatureWorkerInput::Control(actor, control));packages/network/src/features/pubsub/controller/source_hint.rs (1)
28-28
: Consider adding a brief comment explaining the purpose of thederivative
crate for better code readability.use derivative::Derivative; // Used for deriving default implementations with custom bounds
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (4)
Cargo.toml
is excluded by!**/*.toml
examples/whip-whep/Cargo.toml
is excluded by!**/*.toml
packages/network/Cargo.toml
is excluded by!**/*.toml
packages/runner/Cargo.toml
is excluded by!**/*.toml
Files selected for processing (57)
- bin/src/main.rs (4 hunks)
- examples/quic-tunnel/src/sdn.rs (4 hunks)
- examples/quic-tunnel/src/vnet/mod.rs (2 hunks)
- examples/quic-tunnel/src/vnet/socket.rs (1 hunks)
- examples/whip-whep/src/main.rs (4 hunks)
- examples/whip-whep/src/sfu/cluster.rs (2 hunks)
- examples/whip-whep/src/sfu/mod.rs (6 hunks)
- examples/whip-whep/src/sfu/whep.rs (9 hunks)
- examples/whip-whep/src/sfu/whip.rs (8 hunks)
- examples/whip-whep/src/worker.rs (9 hunks)
- packages/network/src/base/feature.rs (4 hunks)
- packages/network/src/base/mod.rs (1 hunks)
- packages/network/src/base/msg.rs (9 hunks)
- packages/network/src/base/secure.rs (3 hunks)
- packages/network/src/base/service.rs (4 hunks)
- packages/network/src/controller_plane.rs (3 hunks)
- packages/network/src/controller_plane/features.rs (1 hunks)
- packages/network/src/controller_plane/neighbours.rs (3 hunks)
- packages/network/src/controller_plane/neighbours/connection.rs (14 hunks)
- packages/network/src/controller_plane/services.rs (1 hunks)
- packages/network/src/data_plane.rs (5 hunks)
- packages/network/src/data_plane/connection.rs (3 hunks)
- packages/network/src/data_plane/features.rs (1 hunks)
- packages/network/src/data_plane/services.rs (2 hunks)
- packages/network/src/features/alias.rs (17 hunks)
- packages/network/src/features/data.rs (4 hunks)
- packages/network/src/features/dht_kv/client.rs (4 hunks)
- packages/network/src/features/dht_kv/client/map.rs (15 hunks)
- packages/network/src/features/dht_kv/internal.rs (4 hunks)
- packages/network/src/features/dht_kv/mod.rs (4 hunks)
- packages/network/src/features/mod.rs (3 hunks)
- packages/network/src/features/neighbours.rs (4 hunks)
- packages/network/src/features/pubsub/controller.rs (9 hunks)
- packages/network/src/features/pubsub/controller/consumers.rs (12 hunks)
- packages/network/src/features/pubsub/controller/feedbacks.rs (8 hunks)
- packages/network/src/features/pubsub/controller/local_relay.rs (3 hunks)
- packages/network/src/features/pubsub/controller/remote_relay.rs (18 hunks)
- packages/network/src/features/pubsub/controller/source_hint.rs (25 hunks)
- packages/network/src/features/pubsub/mod.rs (5 hunks)
- packages/network/src/features/pubsub/msg.rs (3 hunks)
- packages/network/src/features/pubsub/worker.rs (9 hunks)
- packages/network/src/features/router_sync.rs (7 hunks)
- packages/network/src/features/socket.rs (4 hunks)
- packages/network/src/features/vpn.rs (2 hunks)
- packages/network/src/lib.rs (4 hunks)
- packages/network/src/secure/encryption/x25519_dalek_aes.rs (6 hunks)
- packages/network/src/services/manual_discovery.rs (11 hunks)
- packages/network/src/services/visualization.rs (14 hunks)
- packages/network/src/worker.rs (5 hunks)
- packages/network/tests/feature_alias.rs (9 hunks)
- packages/network/tests/feature_dht_kv.rs (1 hunks)
- packages/network/tests/feature_neighbours.rs (2 hunks)
- packages/network/tests/feature_pubsub.rs (1 hunks)
- packages/network/tests/feature_router_sync.rs (7 hunks)
- packages/network/tests/feature_socket.rs (3 hunks)
- packages/network/tests/service_manual_discovery.rs (2 hunks)
- packages/network/tests/service_visualization.rs (4 hunks)
Files not processed due to max files limit (7)
- packages/network/tests/simulator.rs
- packages/runner/examples/simple_kv.rs
- packages/runner/examples/simple_node.rs
- packages/runner/src/builder.rs
- packages/runner/src/lib.rs
- packages/runner/src/worker_inner.rs
- packages/runner/tests/feature_dht_kv.rs
Files not reviewed due to errors (5)
- examples/quic-tunnel/src/vnet/mod.rs (no review received)
- examples/quic-tunnel/src/sdn.rs (no review received)
- packages/network/src/lib.rs (no review received)
- packages/network/src/controller_plane/services.rs (no review received)
- packages/network/src/data_plane/services.rs (no review received)
Files skipped from review due to trivial changes (1)
- packages/network/src/base/mod.rs
Additional Context Used
GitHub Check Runs (2)
codecov/patch failure (30)
bin/src/main.rs: [warning] 238-238: bin/src/main.rs#L238
Added line #L238 was not covered by tests
bin/src/main.rs: [warning] 261-261: bin/src/main.rs#L261
Added line #L261 was not covered by tests
bin/src/main.rs: [warning] 289-289: bin/src/main.rs#L289
Added line #L289 was not covered by tests
bin/src/main.rs: [warning] 303-303: bin/src/main.rs#L303
Added line #L303 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 113-113: packages/network/src/controller_plane.rs#L113
Added line #L113 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 137-137: packages/network/src/controller_plane.rs#L137
Added line #L137 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 148-148: packages/network/src/controller_plane.rs#L148
Added line #L148 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 151-153: packages/network/src/controller_plane.rs#L151-L153
Added lines #L151 - L153 were not covered by tests
packages/network/src/controller_plane.rs: [warning] 163-164: packages/network/src/controller_plane.rs#L163-L164
Added lines #L163 - L164 were not covered by tests
packages/network/src/controller_plane.rs: [warning] 167-167: packages/network/src/controller_plane.rs#L167
Added line #L167 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 186-186: packages/network/src/controller_plane.rs#L186
Added line #L186 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 189-189: packages/network/src/controller_plane.rs#L189
Added line #L189 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 220-220: packages/network/src/controller_plane.rs#L220
Added line #L220 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 235-235: packages/network/src/controller_plane.rs#L235
Added line #L235 was not covered by tests
packages/network/src/controller_plane.rs: [warning] 237-237: packages/network/src/controller_plane.rs#L237
Added line #L237 was not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 62-66: packages/network/src/controller_plane/features.rs#L62-L66
Added lines #L62 - L66 were not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 68-69: packages/network/src/controller_plane/features.rs#L68-L69
Added lines #L68 - L69 were not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 74-75: packages/network/src/controller_plane/features.rs#L74-L75
Added lines #L74 - L75 were not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 83-83: packages/network/src/controller_plane/features.rs#L83
Added line #L83 was not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 85-85: packages/network/src/controller_plane/features.rs#L85
Added line #L85 was not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 87-87: packages/network/src/controller_plane/features.rs#L87
Added line #L87 was not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 89-89: packages/network/src/controller_plane/features.rs#L89
Added line #L89 was not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 93-95: packages/network/src/controller_plane/features.rs#L93-L95
Added lines #L93 - L95 were not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 97-97: packages/network/src/controller_plane/features.rs#L97
Added line #L97 was not covered by tests
packages/network/src/controller_plane/features.rs: [warning] 99-99: packages/network/src/controller_plane/features.rs#L99
Added line #L99 was not covered by tests
packages/network/src/controller_plane/neighbours/connection.rs: [warning] 129-135: packages/network/src/controller_plane/neighbours/connection.rs#L129-L135
Added lines #L129 - L135 were not covered by tests
packages/network/src/controller_plane/neighbours/connection.rs: [warning] 153-160: packages/network/src/controller_plane/neighbours/connection.rs#L153-L160
Added lines #L153 - L160 were not covered by tests
packages/network/src/controller_plane/neighbours/connection.rs: [warning] 194-200: packages/network/src/controller_plane/neighbours/connection.rs#L194-L200
Added lines #L194 - L200 were not covered by tests
packages/network/src/controller_plane/neighbours/connection.rs: [warning] 353-353: packages/network/src/controller_plane/neighbours/connection.rs#L353
Added line #L353 was not covered by tests
packages/network/src/controller_plane/services.rs: [warning] 61-61: packages/network/src/controller_plane/services.rs#L61
Added line #L61 was not covered by testsclippy success (30)
packages/network/src/base/feature.rs: [warning] 129-129:
this lifetime isn't used in the impl
packages/network/src/base/feature.rs: [warning] 154-154:
the following explicit lifetimes could be elided: 'a
packages/network/src/base/feature.rs: [warning] 154-154:
the following explicit lifetimes could be elided: 'a
packages/network/src/base/feature.rs: [warning] 187-187:
this lifetime isn't used in the impl
packages/network/src/base/secure.rs: [warning] 49-49:
this lifetime isn't used in the function definition
packages/network/src/base/secure.rs: [warning] 68-68:
this lifetime isn't used in the function definition
packages/network/src/controller_plane.rs: [warning] 48-48:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/controller_plane.rs: [warning] 60-60:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/controller_plane/features.rs: [warning] 59-59:
the following explicit lifetimes could be elided: 'a
packages/network/src/controller_plane/features.rs: [warning] 59-59:
the following explicit lifetimes could be elided: 'a
packages/network/src/controller_plane/neighbours.rs: [warning] 126-126:
unused variable:now
packages/network/src/controller_plane/services.rs: [warning] 13-18:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/controller_plane/services.rs: [warning] 23-23:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/data_plane.rs: [warning] 77-77:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/data_plane.rs: [warning] 87-87:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/data_plane.rs: [warning] 125-125:
the methodon_tick
doesn't need a mutable reference
packages/network/src/data_plane.rs: [warning] 149-149:
the methodon_input
doesn't need a mutable reference
packages/network/src/data_plane.rs: [warning] 179-179:
the methodon_input
doesn't need a mutable reference
packages/network/src/data_plane.rs: [warning] 199-199:
useless conversion to the same type:sans_io_runtime::Buffer
packages/network/src/data_plane.rs: [warning] 276-276:
useless conversion to the same type:sans_io_runtime::Buffer
packages/network/src/data_plane.rs: [warning] 325-325:
the methodon_input
doesn't need a mutable reference
packages/network/src/data_plane.rs: [warning] 334-334:
useless conversion to the same type:sans_io_runtime::Buffer
packages/network/src/data_plane/features.rs: [warning] 59-59:
this function has too many arguments (8/7)
packages/network/src/data_plane/services.rs: [warning] 13-18:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/data_plane/services.rs: [warning] 24-24:
very complex type used. Consider factoring parts intotype
definitions
packages/network/src/features/alias.rs: [warning] 259-259:
the following explicit lifetimes could be elided: 'a
packages/network/src/features/alias.rs: [warning] 259-259:
the following explicit lifetimes could be elided: 'a
packages/network/src/features/data.rs: [warning] 88-88:
the following explicit lifetimes could be elided: 'a
packages/network/src/features/data.rs: [warning] 88-88:
the following explicit lifetimes could be elided: 'a
packages/network/src/features/dht_kv/mod.rs: [warning] 106-106:
the following explicit lifetimes could be elided: 'a
Additional comments not posted (236)
packages/network/tests/feature_neighbours.rs (2)
20-21
: Ensure type parameters are correctly used inExtIn::FeaturesControl
.The addition of type parameters to
ExtIn::FeaturesControl
aligns with the updated type requirements.
40-47
: Ensure type parameters are correctly used inExtOut::FeaturesEvent
.The addition of type parameters to
ExtOut::FeaturesEvent
aligns with the updated type requirements.packages/network/src/data_plane/connection.rs (2)
5-5
: Ensure theBuffer
type is correctly imported and used.The import and usage of
Buffer
in the struct definition are correct.
Line range hint
44-52
: Ensure consistency in encryption and decryption logic.The decryption logic is consistent with the encryption logic and correctly uses the
Buffer
type.packages/network/tests/service_manual_discovery.rs (3)
33-33
: Ensure type parameters are correctly used inExtIn::FeaturesControl
.The addition of type parameters to
ExtIn::FeaturesControl
aligns with the updated type requirements.
45-48
: Ensure type parameters are correctly used inExtOut::FeaturesEvent
.The addition of type parameters to
ExtOut::FeaturesEvent
aligns with the updated type requirements.
52-55
: Ensure type parameters are correctly used inExtOut::FeaturesEvent
.The addition of type parameters to
ExtOut::FeaturesEvent
aligns with the updated type requirements.packages/network/src/features/dht_kv/internal.rs (6)
14-15
: Ensure theUserData
type parameter is correctly used inInternalOutput
.The addition of the
UserData
type parameter inInternalOutput
is correct and aligns with the updated type requirements.
19-21
: Ensure theUserData
type parameter is correctly used inDhtKvInternal
.The addition of the
UserData
type parameter inDhtKvInternal
is correct and aligns with the updated type requirements.
Line range hint
35-37
: Ensure theon_tick
method correctly updates local and remote storage.The
on_tick
method correctly updates the local and remote storage.
39-41
: Ensure theon_local
method correctly handles local commands withUserData
.The
on_local
method correctly handles local commands with theUserData
type parameter.
Line range hint
43-51
: Ensure theon_remote
method correctly handles remote commands.The
on_remote
method correctly handles remote commands and logs the actions.
Line range hint
53-61
: Ensure thepop_action
method correctly pops actions from local and remote storage.The
pop_action
method correctly pops actions from local and remote storage and logs the actions.packages/network/src/features/pubsub/mod.rs (3)
Line range hint
46-56
: Ensure theUserData
type parameter is correctly used inRelayWorkerControl
.The addition of the
UserData
type parameter inRelayWorkerControl
is correct and aligns with the updated type requirements.
75-76
: Ensure theUserData
type parameter is correctly used inToWorker
.The addition of the
UserData
type parameter inToWorker
is correct and aligns with the updated type requirements.
87-88
: Ensure theUserData
type parameter is correctly used inOutput
andWorkerOutput
.The addition of the
UserData
type parameter inOutput
andWorkerOutput
is correct and aligns with the updated type requirements.packages/network/src/features/pubsub/controller/local_relay.rs (2)
14-17
: TheLocalRelay
struct definition looks good with the newUserData
type parameter.
Line range hint
20-72
: TheGenericRelay
trait implementation forLocalRelay
has been correctly updated to handle theUserData
type parameter. The logic within each method is consistent with their intended functionality.packages/network/tests/feature_socket.rs (3)
22-23
: Changes are consistent with the new type parameter requirements.Also applies to: 26-26, 31-34
54-55
: Changes are consistent with the new type parameter requirements.Also applies to: 59-59, 64-67
91-92
: Changes are consistent with the new type parameter requirements.Also applies to: 96-96, 101-104
packages/network/src/features/mod.rs (2)
95-103
: Changes are consistent with the new type parameter requirements.
106-106
: Changes are consistent with the new type parameter requirements.packages/network/src/features/pubsub/msg.rs (1)
129-136
: TheInto<Buffer>
implementation is consistent with the new type parameter requirements and correctly convertsPubsubMessage
intoBuffer
.examples/quic-tunnel/src/vnet/socket.rs (1)
56-56
: The conversion oftransmit.contents
toBuffer
is consistent with the new type parameter requirements.packages/network/src/features/vpn.rs (6)
32-36
: Changes are consistent with the new type parameter requirements.
51-55
: Changes are consistent with the new type parameter requirements.
38-42
: Changes are consistent with the new type parameter requirements.
44-46
: Changes are consistent with the new type parameter requirements.
87-94
: Changes are consistent with the new type parameter requirements.
98-103
: Changes are consistent with the new type parameter requirements.packages/network/src/base/service.rs (8)
12-14
: Changes are consistent with the new type parameter requirements.
24-25
: Changes are consistent with the new type parameter requirements.
31-32
: Changes are consistent with the new type parameter requirements.
62-63
: Changes are consistent with the new type parameter requirements.
68-73
: Changes are consistent with the new type parameter requirements.
42-49
: Changes are consistent with the new type parameter requirements.
80-86
: Changes are consistent with the new type parameter requirements.
98-105
: Changes are consistent with the new type parameter requirements.examples/whip-whep/src/main.rs (5)
11-17
: Update import paths to reflect module changes.
70-70
: Service initialization updated to include an additional type parameter()
.
73-73
: IP address updated inaddr_builder.add_protocol
.
81-81
:sfu
address updated inICfg
.Also applies to: 104-104
124-125
: Consider re-enabling signal handling for graceful shutdown.Is there a specific reason for commenting out the signal handling code? Re-enabling it can ensure graceful shutdown on receiving SIGINT.
Also applies to: 131-133
packages/network/src/features/dht_kv/client.rs (3)
24-25
: AddedUserData
type parameter toLocalStorageOutput
enum.
29-33
: UpdatedLocalStorage
struct to includeUserData
type parameter.
Line range hint
37-127
: UpdatedLocalStorage
implementation to handleUserData
type parameter.packages/network/tests/feature_router_sync.rs (5)
Line range hint
19-32
: UpdatedMockService
implementation to includeUserData
type parameter.
39-54
: UpdatedMockServiceWorker
implementation to handleUserData
type parameter.
Line range hint
59-72
: UpdatedMockServiceBuilder
implementation to handleUserData
type parameter.
89-107
: Updatedfeature_router_sync_single_node
test case to handleUserData
type parameter.
116-128
: Updatedfeature_router_sync_two_nodes
andfeature_router_sync_three_nodes
test cases to handleUserData
type parameter.Also applies to: 151-153
examples/whip-whep/src/sfu/cluster.rs (2)
Line range hint
37-37
: AddedDefault
derive toClusterLogic
struct.
Line range hint
41-41
: UpdatedClusterLogic::on_input
method to handle new input and output types.packages/network/src/features/neighbours.rs (5)
32-39
: UpdatedNeighboursFeature
struct to includeUserData
type parameter.
Line range hint
42-86
: UpdatedNeighboursFeature
implementation to handleUserData
type parameter.
95-99
: UpdatedNeighboursFeatureWorker
struct to includeUserData
type parameter.
101-114
: UpdatedNeighboursFeatureWorker
implementation to handleUserData
type parameter.
88-121
: UpdatedTaskSwitcherChild
implementation forNeighboursFeature
andNeighboursFeatureWorker
to handleUserData
type parameter.packages/network/tests/service_visualization.rs (8)
13-16
: The addition of the type parameter()
in thenode_changed
function is consistent with the new type parameter requirements. The function logic remains unchanged and correct.
41-41
: The inclusion of the type parameter()
in theExtIn::ServicesControl
variant is consistent with the new type parameter requirements. The test logic remains unchanged and correct.
48-52
: The inclusion of the type parameter()
in theExtOut::ServicesEvent
variant is consistent with the new type parameter requirements. The test logic remains unchanged and correct.
81-82
: The inclusion of the type parameter()
in theExtIn::ServicesControl
variant is consistent with the new type parameter requirements. The test logic remains unchanged and correct.
89-98
: The inclusion of the type parameter()
in theExtOut::ServicesEvent
variant is consistent with the new type parameter requirements. The test logic remains unchanged and correct.
121-123
: The inclusion of the type parameter()
in theExtOut::ServicesEvent
variant within theget_key
lambda function is consistent with the new type parameter requirements. The function logic remains unchanged and correct.
121-123
: The sorting ofnode1_events
andnode2_events
using the updatedget_key
lambda function is consistent with the new type parameter requirements. The sorting logic remains unchanged and correct.
121-123
: The inclusion of the type parameter()
in thenode_changed
function calls within theassert_eq!
statements is consistent with the new type parameter requirements. The assertions remain unchanged and correct.examples/whip-whep/src/sfu/whip.rs (6)
3-3
: The import ofBuffer
fromatm0s_sdn::sans_io_runtime
is appropriate and aligns with the changes in the rest of the codebase whereBuffer
is used instead ofVec<u8>
. This change improves type safety and consistency.
20-21
: TheWhipInput
enum now usesBuffer
instead ofVec<u8>
for theUdpPacket
variant. This change is consistent with the overall shift to usingBuffer
for data handling, enhancing type safety and performance.
26-26
: TheWhipOutput
enum now usesBuffer
instead ofVec<u8>
for theUdpPacket
variant. This change is consistent with the overall shift to usingBuffer
for data handling, enhancing type safety and performance.
39-39
: The addition of thequeue
field to theWhipTask
struct is a good design choice. It allows for better management of output events, improving the modularity and maintainability of the code.
81-81
: The conversion ofsend.contents
toBuffer
using.to_vec().into()
is correct and aligns with the new data handling approach. This ensures that the data is properly encapsulated in theBuffer
type.
117-117
: TheTask
trait implementation forWhipTask
has been updated to use theBuffer
type. This change is consistent with the overall shift to usingBuffer
for data handling, enhancing type safety and performance.packages/network/tests/feature_dht_kv.rs (4)
13-14
: Thecontrol
function now returnsExtIn<(), ()>
, reflecting the addition of type parameters to theExtIn
enum. This change is consistent with the updated type handling in the codebase.
17-18
: Theevent
function now returnsExtOut<(), ()>
, reflecting the addition of type parameters to theExtOut
enum. This change is consistent with the updated type handling in the codebase.
Line range hint
93-94
: Thefeature_dht_kv_single_node
test now usesExtIn::FeaturesControl((), FeaturesControl::DhtKv(control))
andExtIn::FeaturesControl((), FeaturesControl::DhtKv(control))
, reflecting the addition of type parameters to theExtIn
enum. This change is consistent with the updated type handling in the codebase.
Line range hint
115-115
: Thefeature_alias_timeout
test now usesExtIn::FeaturesControl((), FeaturesControl::Alias(alias::Control::Query { alias: alias_v, service, level }))
, reflecting the addition of type parameters to theExtIn
enum. This change is consistent with the updated type handling in the codebase.packages/network/src/features/dht_kv/mod.rs (6)
9-10
: The addition ofDebug
to the imports is appropriate, given that theUserData
type parameter now requires theDebug
trait. This change ensures that the code can properly handle and logUserData
instances.
81-83
: TheOutput
andWorkerOutput
type aliases now include theUserData
type parameter. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly propagated through the system.
84-85
: TheDhtKvFeature
struct now includes theUserData
type parameter. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly encapsulated within the feature.
88-88
: TheDhtKvFeature
implementation now includes theUserData
type parameter and requiresUserData
to implementEq
,Copy
, andDebug
. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly managed within the feature.
146-150
: TheDhtKvFeatureWorker
struct now includes theUserData
type parameter and usesDynamicDeque
for thequeue
field. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly managed within the worker.
152-163
: TheFeatureWorker
trait implementation forDhtKvFeatureWorker
now includes theUserData
type parameter. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly managed within the worker.packages/network/tests/feature_alias.rs (4)
19-19
: TheMockService
implementation now includes theUserData
type parameter. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly managed within the service.
39-39
: TheMockServiceWorker
implementation now includes theUserData
type parameter. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly managed within the service worker.
59-59
: TheMockServiceBuilder
implementation now includes theUserData
type parameter. This change is consistent with the updated type handling in the codebase and ensures thatUserData
is properly managed within the service builder.
93-94
: Thefeature_alias_single_node
test now usesExtIn::FeaturesControl((), FeaturesControl::Alias(alias::Control::Register { alias, service, level }))
andExtIn::FeaturesControl((), FeaturesControl::Alias(alias::Control::Query { alias, service, level }))
, reflecting the addition of type parameters to theExtIn
enum. This change is consistent with the updated type handling in the codebase.examples/whip-whep/src/sfu/whep.rs (6)
3-5
: Imports updated to includeBuffer
andDynamicDeque
.
24-24
:WhepInput
enum updated to useBuffer
for theUdpPacket
variant.
29-29
:WhepOutput
enum updated to useBuffer
for theUdpPacket
variant.
42-42
:WhepTask
struct updated to include aqueue
field.
Line range hint
75-85
:pop_event_inner
method updated to useBuffer
instead ofVec<u8>
for thedata
field in theUdpPacket
variant.
Line range hint
121-185
: Methodson_tick
,on_event
,pop_output
, andon_shutdown
updated to use thequeue
field andBuffer
type.packages/network/src/features/pubsub/controller/feedbacks.rs (6)
1-2
: No significant changes to imports.
8-9
:FeedbackSource
enum updated to include aUserData
type parameter.
14-16
:SingleFeedbackKind
struct updated to include aUserData
type parameter.
70-73
:FeedbacksAggerator
struct updated to include aUserData
type parameter.
Line range hint
77-114
: Methods inFeedbacksAggerator
updated to use theUserData
type parameter.
Line range hint
140-207
: Tests updated to use theUserData
type parameter.packages/network/src/features/data.rs (6)
1-4
: Imports look good and appropriate for the changes.Also applies to: 8-9, 12-14
22-24
: The new variants inControl
andEvent
enums are correctly added and follow the existing pattern.Also applies to: 30-30
43-43
: The updates to theDataMsg
enum and the new type aliases are appropriate and consistent.Also applies to: 46-47
49-54
: The updates to theDataFeature
struct and its implementation are correctly implemented and follow the existing pattern.Also applies to: 56-64, 67-137, 145-145
154-172
: The updates to theDataFeatureWorker
struct and its implementation are correctly implemented and follow the existing pattern.
147-149
: The updates to theTaskSwitcherChild
implementations are correctly implemented and follow the existing pattern.Also applies to: 175-179
packages/network/src/controller_plane/neighbours.rs (3)
8-8
: The import ofTaskSwitcherChild
is appropriate and consistent with the rest of the code.
122-122
: The updates to theNeighboursManager
struct and its methods are correctly implemented and follow the existing pattern.
124-126
: The updates to theTaskSwitcherChild
implementation are correctly implemented and follow the existing pattern.packages/network/src/worker.rs (5)
1-1
: The updates to the imports and enum definitions are appropriate and consistent with the rest of the code.Also applies to: 4-4, 13-16, 19-23, 28-32, 37-42
44-48
: The updates to theSdnWorkerCfg
struct are appropriate and consistent with the rest of the code.
51-70
: The updates to theSdnWorker
struct and its implementation are correctly implemented and follow the existing pattern.Also applies to: 88-130
Line range hint
157-186
: The updates to theprocess_controller_out
andprocess_data_out
methods are correctly implemented and follow the existing pattern.
201-209
: The updates to theTaskSwitcherChild
implementation are correctly implemented and follow the existing pattern.packages/network/src/base/feature.rs (6)
85-87
: The addition of theUserData
type parameter to theFeatureControlActor
enum looks good and aligns with the overall update to include additional type parameters.
91-102
: Theinto2
method for converting between differentUserData
types in theFeatureControlActor
impl block looks good and aligns with the overall update to include additional type parameters.
111-115
: The addition of theUserData
type parameter to theFeatureInput
enum looks good and aligns with the overall update to include additional type parameters.
119-138
: The addition of theUserData
type parameter to theFeatureOutput
enum looks good and aligns with the overall update to include additional type parameters.
160-167
: The addition of theUserData
type parameter to theFeatureWorkerInput
enum looks good and aligns with the overall update to include additional type parameters.
171-184
: The addition of theUserData
type parameter to theFeatureWorkerOutput
enum looks good and aligns with the overall update to include additional type parameters.packages/network/src/secure/encryption/x25519_dalek_aes.rs (3)
96-96
: The update to useBufferMut
for encryption in theEncryptorXDA
implementation looks good and aligns with the overall update to useBufferMut
for data handling.
134-134
: The update to useBufferMut
for decryption in theDecryptorXDA
implementation looks good and aligns with the overall update to useBufferMut
for data handling.
Line range hint
157-184
: The addition of theBufferMut2
implementation to adaptBufferMut
for use with the AES-GCM library looks good and is necessary for integratingBufferMut
with the AES-GCM library.bin/src/main.rs (4)
238-238
: The update to useSdnBuilder::<(), SC, SE, TC, TW>::new(...)
for initialization looks good and aligns with the overall update to include additional type parameters.
261-261
: The update to usecontroller.send_to(0, SdnExtIn::ServicesControl(...))
looks good and aligns with the overall update to use additional parameters.
289-289
: The update to the pattern matching forSdnExtOut::ServicesEvent
to include additional parameters looks good and aligns with the overall update to include additional parameters.
303-303
: The update to the pattern matching forSdnExtOut::FeaturesEvent
to include additional parameters looks good and aligns with the overall update to include additional parameters.packages/network/src/features/router_sync.rs (7)
30-36
: Ensure consistent usage of the newUserData
type parameter.Verify that the
UserData
type parameter is used consistently across the entire codebase, especially in theFeatureOutput
andFeatureWorkerOutput
types.
Line range hint
40-50
: LGTM! Thenew
method correctly initializes theRouterSyncFeature
struct.
Line range hint
52-58
: LGTM! Thesend_sync_to
method correctly serializes the sync message and pushes it to the queue.
Line range hint
62-123
: LGTM! Theon_shared_input
andon_input
methods correctly handle their respective inputs and update the router state.
160-164
: Ensure consistent usage of the newUserData
type parameter.Verify that the
UserData
type parameter is used consistently across the entire codebase, especially in theFeatureWorkerOutput
type.
166-183
: LGTM! Theon_input
method correctly handles its inputs and updates the router state.
186-191
: LGTM! Thepop_output
method correctly returns the next output from the queue.packages/network/tests/feature_pubsub.rs (7)
13-18
: LGTM! Thefeature_pubsub_manual_single_node
test function correctly simulates the scenario and verifies the expected outcomes.
20-20
: LGTM! Thefeature_pubsub_auto_single_node
test function correctly simulates the scenario and verifies the expected outcomes.
Line range hint
22-22
: LGTM! Thefeature_pubsub_auto_single_node_worker
test function correctly simulates the scenario and verifies the expected outcomes.
Line range hint
24-24
: LGTM! Thefeature_pubsub_manual_two_nodes
test function correctly simulates the scenario and verifies the expected outcomes.
Line range hint
26-26
: LGTM! Thefeature_pubsub_auto_two_nodes
test function correctly simulates the scenario and verifies the expected outcomes.
Line range hint
28-28
: LGTM! Thefeature_pubsub_manual_three_nodes
test function correctly simulates the scenario and verifies the expected outcomes.
Line range hint
30-30
: LGTM! Thefeature_pubsub_auto_three_nodes
test function correctly simulates the scenario and verifies the expected outcomes.examples/whip-whep/src/sfu/mod.rs (8)
7-7
: Import statement forBuffer
looks good.
38-42
: Changes to theInput
enum to useBuffer
instead ofVec<u8>
are appropriate.
49-49
: Changes to theOutput
enum to useBuffer
instead ofVec<u8>
are appropriate.
63-63
: Updates to theSfuWorker
struct to useTaskGroup
andWhepTaskGroup
are appropriate.
170-183
: Theprocess_cluster_output
method is well-implemented and handles various cluster outputs appropriately.
189-208
: Theprocess_whip_out
method is well-implemented and integrates WHIP task outputs with the cluster logic effectively.
214-235
: Theprocess_whep_out
method is well-implemented and integrates WHEP task outputs with the cluster logic effectively.
261-328
: Updates to theon_tick
,on_event
,pop_output
, andon_shutdown
methods are consistent with the new task management approach and are correctly implemented.packages/network/src/features/pubsub/controller/consumers.rs (6)
7-8
: Import statement forFeatureControlActor
with a type parameter looks good.
21-26
: Changes to theRelayConsumers
struct to include a type parameter forUserData
are appropriate.
Line range hint
29-113
: Updates to theRelayConsumers
implementation to use the new type parameter are consistent and correctly implemented.
132-142
: Updates to therelay_local_should_work_single_sub
test to use the new type parameter are appropriate.
152-167
: Updates to therelay_local_should_work_multi_subs
test to use the new type parameter are appropriate.
Line range hint
184-209
: Updates to therelay_remote_should_work_single_sub
andrelay_remote_should_work_multi_subs
tests to use the new type parameter are appropriate.examples/whip-whep/src/worker.rs (8)
3-6
: Update import statements to reflect changes in module paths and type names.Also applies to: 14-14
40-40
: TheExtIn
enum now includesSdn(SdnExtIn<(), SC>)
.
46-46
: TheExtOut
enum now includesSdn(SdnExtOut<(), SE>)
.
58-58
: TheEvent
enum now includesSdn(SdnEvent<(), SC, SE, TC, TW>)
.
73-73
: TheSdnInnerCfg
struct now includes a new type parameter()
forServiceBuilder
.
101-107
: TheRunnerWorker
struct now includes aqueue
field of typeVecDeque<WorkerInnerOutput<RunnerOwner, ExtOut, ChannelId, Event, SCfg>>
.
138-138
: TheRunnerWorker
implementation includes changes to thebuild
,on_tick
,on_event
,pop_output
, andon_shutdown
methods.Also applies to: 163-163, 167-171, 174-224, 230-243, 252-256
Line range hint
261-303
: Theprocess_sdn
andprocess_sfu
methods now include new type parameters and modified event handling logic.Also applies to: 307-315
packages/network/src/features/pubsub/worker.rs (7)
1-5
: Update import statements to reflect changes in module paths and type names.
14-20
: TheWorkerRelay
struct now includes a new type parameterUserData
.
27-29
: ThePubSubFeatureWorker
struct now includes a new type parameterUserData
.
32-36
: TheDefault
implementation forPubSubFeatureWorker
now includes a new type parameterUserData
.
Line range hint
41-227
: TheFeatureWorker
implementation forPubSubFeatureWorker
now includes a new type parameterUserData
and modifies the event handling logic.
237-239
: TheTaskSwitcherChild
implementation forPubSubFeatureWorker
now includes a new type parameterUserData
and modifies the task processing logic.
239-239
: Thepop_output
method now includes a new type parameterUserData
and modifies the output processing logic.packages/network/src/controller_plane.rs (5)
79-92
: The initialization ofControllerPlane
looks good.
95-105
: The implementation ofon_tick
looks good.
172-189
: The implementation ofpop_neighbours
looks good.
193-223
: The implementation ofpop_features
looks good.
242-262
: The implementation ofTaskSwitcherChild
forControllerPlane
looks good.packages/network/src/features/socket.rs (7)
57-60
: The implementation ofsend_to
looks good.
Line range hint
73-183
: The implementation ofon_input
looks good.
186-191
: The implementation ofpop_output
looks good.
199-213
: The implementation ofprocess_incoming
looks good.
227-283
: The implementation ofon_input
looks good.
288-291
: The implementation ofTaskSwitcherChild
forSocketFeatureWorker
looks good.
295-310
: The implementation ofembed_meta
andextract_meta
looks good.packages/network/src/features/pubsub/controller.rs (8)
28-28
: Ensure theTaskSwitcherChild
import is necessary.The
TaskSwitcherChild
trait is imported but not used until the end of the file. Ensure that this import is necessary and correctly used in the implementation.
31-34
: Review theGenericRelayOutput
enum for correctness.The
GenericRelayOutput
enum is well-defined with appropriate variants forToWorker
,RouteChanged
, andFeedback
. Ensure that these variants are correctly used in the file.
37-48
: Review theGenericRelay
trait for correctness.The
GenericRelay
trait is well-defined with appropriate methods for handling relay operations. Ensure that these methods are correctly implemented in the file.
51-54
: Review thePubSubFeature
struct for correctness.The
PubSubFeature
struct is well-defined with appropriate fields for relays, source hints, and a queue. Ensure that these fields are correctly used in the file.
Line range hint
57-88
: Review thePubSubFeature
implementation for correctness.The
PubSubFeature
implementation is well-defined with appropriate methods for handling relay and source hint operations. Ensure that these methods are correctly implemented and tested in the file.
Line range hint
216-233
: Review thepop_single_relay
method for correctness.The
pop_single_relay
method is well-defined with appropriate logic for handling relay outputs. Ensure that this method is correctly used in the file.
Line range hint
235-256
: Review thepop_single_source_hint
method for correctness.The
pop_single_source_hint
method is well-defined with appropriate logic for handling source hint outputs. Ensure that this method is correctly used in the file.
Line range hint
258-322
: Review theFeature
andTaskSwitcherChild
trait implementations for correctness.The
Feature
andTaskSwitcherChild
trait implementations forPubSubFeature
are well-defined with appropriate methods for handling feature inputs and task switching. Ensure that these methods are correctly implemented and tested in the file.packages/network/src/base/msg.rs (6)
286-286
: ReplacingVec<u8>
withBuffer
in theTransportMsg
struct improves type safety and performance. Good change!
309-314
: The use ofBuffer
in thebuild_raw
method aligns with the updatedTransportMsg
struct and ensures consistent use ofBuffer
. Looks good!
335-338
: Updating thebuild
method to useBuffer
instead ofVec<u8>
is consistent with the previous changes and improves type safety. Good job!
392-398
: The change to useBuffer
in thefrom_payload_bincode
method ensures consistency with the updatedTransportMsg
struct. Looks good!
412-412
: ConvertingVec<u8>
toBuffer
in theTryFrom<Vec<u8>>
implementation maintains consistency with the updatedTransportMsg
struct. Good change!
424-424
: Converting&[u8]
toBuffer
in theTryFrom<&[u8]>
implementation ensures consistency with the updatedTransportMsg
struct. Looks good!packages/network/src/data_plane.rs (7)
1-15
: Imports and initial declarations look good and are consistent with the overall updates in the codebase.
26-35
: The updates to theNetInput
andCrossWorker
enums are consistent with the overall changes in the codebase.
39-52
: The updates to theInput
andNetOutput
enums are consistent with the overall changes in the codebase.
56-67
: The updates to theOutput
enum are consistent with the overall changes in the codebase.
68-77
: The updates to theTaskType
enum andDataPlaneCfg
struct are consistent with the overall changes in the codebase.
81-90
: The updates to theDataPlane
struct are consistent with the overall changes in the codebase.
Line range hint
94-113
: The updates to theDataPlane
implementation are consistent with the overall changes in the codebase.packages/network/src/features/alias.rs (12)
1-4
: Imports look good and necessary for the new functionality.
8-12
: The new imports and type definitions are appropriate and align with the changes in the code.
61-62
: The addition of theUserData
type parameter toQuerySlot
is correctly integrated and enhances the flexibility of the struct.
74-75
: The updates toOutput
andWorkerOutput
type definitions to include theUserData
type parameter are correctly integrated.
77-83
: The addition of theUserData
type parameter toAliasFeature
is correctly integrated and enhances the flexibility of the struct.
Line range hint
87-210
: The new logic for handling various control and remote messages inAliasFeature
is well-implemented and efficient. The use of theUserData
type parameter is correctly integrated.
210-212
: Thesend_to
method is correctly implemented and efficiently handles message serialization and queueing.
Line range hint
222-275
: TheFeature
trait implementation forAliasFeature
is correctly updated to include theUserData
type parameter and handle various inputs efficiently.
277-288
: The addition of theUserData
type parameter toAliasFeatureWorker
is correctly integrated and enhances the flexibility of the struct.
290-302
: The new logic for handling various inputs inAliasFeatureWorker
is well-implemented and efficient. The use of theUserData
type parameter is correctly integrated.
305-310
: TheTaskSwitcherChild
trait implementation forAliasFeatureWorker
is correctly updated to include theUserData
type parameter and handle output efficiently.
Line range hint
315-574
: The tests are correctly updated to include theUserData
type parameter and cover the new logic comprehensively.packages/network/src/features/pubsub/controller/remote_relay.rs (10)
18-22
: IntroduceUserData
type parameter toRelayState
enum.The addition of the
UserData
type parameter to theRelayState
enum is correctly implemented and enhances the flexibility of the state management.
37-40
: IntroduceUserData
type parameter toRemoteRelay
struct.The addition of the
UserData
type parameter to theRemoteRelay
struct is correctly implemented and enhances the flexibility of the relay logic.
Line range hint
43-58
: IntroduceUserData
type parameter toRemoteRelay
implementation.The addition of the
UserData
type parameter to theRemoteRelay
implementation is correctly implemented and enhances the flexibility of the relay logic.
Line range hint
65-141
: IntroduceUserData
type parameter toGenericRelay
trait implementation forRemoteRelay
.The addition of the
UserData
type parameter to theGenericRelay
trait implementation forRemoteRelay
is correctly implemented and enhances the flexibility of the relay logic.
141-145
: IntroduceUserData
type parameter toon_pub_start
andon_pub_stop
methods.The addition of the
UserData
type parameter to theon_pub_start
andon_pub_stop
methods is correctly implemented and enhances the flexibility of the relay logic.
Line range hint
151-180
: IntroduceUserData
type parameter toon_local_sub
method.The addition of the
UserData
type parameter to theon_local_sub
method is correctly implemented and enhances the flexibility of the relay logic.
Line range hint
180-195
: IntroduceUserData
type parameter toon_local_feedback
method.The addition of the
UserData
type parameter to theon_local_feedback
method is correctly implemented and enhances the flexibility of the relay logic.
Line range hint
195-343
: IntroduceUserData
type parameter toon_local_unsub
method.The addition of the
UserData
type parameter to theon_local_unsub
method is correctly implemented and enhances the flexibility of the relay logic.
343-347
: IntroduceUserData
type parameter topop_output
andrelay_dests
methods.The addition of the
UserData
type parameter to thepop_output
andrelay_dests
methods is correctly implemented and enhances the flexibility of the relay logic.
Line range hint
374-599
: IntroduceUserData
type parameter to test functions.The addition of the
UserData
type parameter to the test functions is correctly implemented and ensures that the tests cover the new functionality.packages/network/src/features/dht_kv/client/map.rs (5)
1-4
: The addition ofDebug
to theuse
statements is appropriate and necessary for theLocalMap
implementation.
209-211
: The addition of theUserData
type parameter to theLocalMapOutput
enum enhances flexibility and type safety.
223-228
: The addition of theUserData
type parameter to theLocalMap
struct improves flexibility and type safety.
Line range hint
231-509
: The changes to theLocalMap
implementation are consistent with the addition of theUserData
type parameter and enhance the overall functionality.
Line range hint
684-904
: The updates to the test cases ensure that the new functionality is properly tested.packages/network/src/features/pubsub/controller/source_hint.rs (7)
43-46
: TheOutput
enum now includes aUserData
type parameter. Ensure that all usages of this enum are updated accordingly throughout the codebase.Verification successful
All usages of the
Output
enum have been updated with the newUserData
type parameter throughout the codebase.
- Verified instances in multiple files such as
worker.rs
,controller_plane.rs
,vpn.rs
,features.rs
,socket.rs
,router_sync.rs
,neighbours.rs
,data.rs
,alias.rs
,pubsub.rs
,dht_kv.rs
,services.rs
,data_plane.rs
, andvisualization.rs
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all usages of the `Output` enum are updated with the new `UserData` type parameter. # Test: Search for the `Output` enum usage. Expect: Only occurrences with the new type parameter. rg --type rust $'Output<'Length of output: 24289
49-59
: TheSourceHintLogic
struct now includeslocal_sources
andlocal_subscribers
fields with theUserData
type parameter. Ensure that these fields are correctly initialized and used throughout the code.Verification successful
The
local_sources
andlocal_subscribers
fields in theSourceHintLogic
struct are correctly initialized and used throughout the code.
- The
SourceHintLogic
struct is used with theUserData
type parameter in multiple places.- The
local_sources
andlocal_subscribers
fields are actively managed and manipulated in various methods within theSourceHintLogic
implementation.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all usages of the `SourceHintLogic` struct are updated with the new `UserData` type parameter. # Test: Search for the `SourceHintLogic` struct usage. Expect: Only occurrences with the new type parameter. rg --type rust $'SourceHintLogic<'Length of output: 577
Script:
#!/bin/bash # Description: Verify initialization and usage of `local_sources` and `local_subscribers` fields in `SourceHintLogic`. # Search for the initialization of `SourceHintLogic`. rg --type rust 'SourceHintLogic<' --context 10 # Search for methods that interact with `local_sources` and `local_subscribers`. rg --type rust 'local_sources' rg --type rust 'local_subscribers'Length of output: 13929
62-62
: TheSourceHintLogic
implementation block now requiresUserData
to implementEq
,Copy
, andDebug
. Ensure that allUserData
types used in this context satisfy these trait bounds.Verification successful
All instances of
UserData
used in the context ofSourceHintLogic
and related structures consistently implement the required traitsEq
,Copy
, andDebug
.
UserData
is used in various contexts across multiple files, and in all instances, it implements the necessary traits.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all `UserData` types used in `SourceHintLogic` satisfy the required trait bounds. # Test: Search for the `SourceHintLogic` struct instantiation. Expect: Only occurrences with `UserData` types implementing `Eq`, `Copy`, and `Debug`. rg --type rust $'SourceHintLogic<'Length of output: 577
Script:
#!/bin/bash # Description: Verify the definition of `UserData` in the relevant files to ensure it implements `Eq`, `Copy`, and `Debug`. # Test: Search for the definition or type alias of `UserData` in `controller.rs` and `source_hint.rs`. rg --type rust 'type UserData' packages/network/src/features/pubsub/controller.rs packages/network/src/features/pubsub/controller/source_hint.rs rg --type rust 'struct UserData' packages/network/src/features/pubsub/controller.rs packages/network/src/features/pubsub/controller/source_hint.rs rg --type rust 'enum UserData' packages/network/src/features/pubsub/controller.rs packages/network/src/features/pubsub/controller/source_hint.rsLength of output: 442
Script:
#!/bin/bash # Description: Verify the definition of `UserData` in the entire repository to ensure it implements `Eq`, `Copy`, and `Debug`. # Test: Search for the definition or type alias of `UserData` across the entire repository. rg --type rust 'type UserData' rg --type rust 'struct UserData' rg --type rust 'enum UserData'Length of output: 100
Script:
#!/bin/bash # Description: Trace the origin of `UserData` by searching for its usage and imports in the relevant files. # Test: Search for `UserData` usage and imports in `controller.rs` and `source_hint.rs`. rg --type rust 'UserData' packages/network/src/features/pubsub/controller.rs packages/network/src/features/pubsub/controller/source_hint.rsLength of output: 5105
Script:
#!/bin/bash # Description: Trace the origin of `UserData` by searching for import statements in the relevant files. # Test: Search for import statements in `controller.rs` and `source_hint.rs`. rg --type rust 'use ' packages/network/src/features/pubsub/controller.rs packages/network/src/features/pubsub/controller/source_hint.rsLength of output: 2851
Script:
#!/bin/bash # Description: Trace the origin and context of `UserData` by searching for its usage in the entire repository. # Test: Search for `UserData` usage in the entire repository. rg --type rust 'UserData'Length of output: 65866
351-351
: Thepop_output
method now returnsOutput<UserData>
. Ensure that all usages of this method handle theUserData
type correctly.
375-375
: The test caselocal_subscribe_should_send_event
now usesFeatureControlActor<UserData>
. Ensure that all test cases are updated to handle theUserData
type correctly.
450-450
: The test caseremote_subscribe_should_send_event
now usesFeatureControlActor<UserData>
. Ensure that all test cases are updated to handle theUserData
type correctly.#!/bin/bash # Description: Verify all test cases are updated to handle the `UserData` type correctly. # Test: Search for the `FeatureControlActor` usage in test cases. Expect: Only occurrences with the correct `UserData` type. rg --type rust --test $'FeatureControlActor<'
822-838
: The test casereject_loop_register
now usesFeatureControlActor<UserData>
. Ensure that all test cases are updated to handle theUserData
type correctly.#!/bin/bash # Description: Verify all test cases are updated to handle the `UserData` type correctly. # Test: Search for the `FeatureControlActor` usage in test cases. Expect: Only occurrences with the correct `UserData` type. rg --type rust --test $'FeatureControlActor<'
@@ -64,7 +64,7 @@ | |||
#[derive(Debug, PartialEq)] | |||
pub enum Output { | |||
Event(ConnectionEvent), | |||
Net(SocketAddr, NeighboursControlCmds), | |||
Net(u64, SocketAddr, NeighboursControlCmds), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test coverage for the new Output::Net
variant.
The new Output::Net
variant should be covered by tests to ensure it works as expected. Would you like assistance in writing these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please
@@ -91,7 +91,7 @@ | |||
node, | |||
remote, | |||
state, | |||
output: VecDeque::from([Output::Net(remote, NeighboursControlCmds::ConnectRequest { to: node, session, handshake })]), | |||
output: VecDeque::from([Output::Net(now_ms, remote, NeighboursControlCmds::ConnectRequest { to: node, session, handshake })]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test coverage for the new_outgoing
method's initialization logic.
The new_outgoing
method's initialization logic should be covered by tests to ensure it correctly initializes the output
field with a ConnectRequest
command. Would you like assistance in writing these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please
self.output.push_back(self.generate_control( | ||
now_ms, | ||
NeighboursControlCmds::DisconnectRequest { | ||
session: self.conn.session(), | ||
reason: NeighboursDisconnectReason::Other, | ||
}, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test coverage for the disconnect
method.
The disconnect
method should be covered by tests to ensure it correctly pushes a DisconnectRequest
command to the output
queue. Would you like assistance in writing these tests?
self.output.push_back(self.generate_control( | ||
now_ms, | ||
NeighboursControlCmds::ConnectRequest { | ||
to: self.node, | ||
session: self.conn.session(), | ||
handshake: request_buf, | ||
}, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test coverage for the on_tick
method's ConnectRequest
resending logic.
The on_tick
method's logic for resending ConnectRequest
commands should be covered by tests to ensure it works as expected. Would you like assistance in writing these tests?
self.output.push_back(self.generate_control( | ||
now_ms, | ||
NeighboursControlCmds::DisconnectRequest { | ||
session: self.conn.session(), | ||
reason: NeighboursDisconnectReason::Other, | ||
}, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test coverage for the on_tick
method's DisconnectRequest
resending logic.
The on_tick
method's logic for resending DisconnectRequest
commands should be covered by tests to ensure it works as expected. Would you like assistance in writing these tests?
@@ -20,10 +20,12 @@ | |||
|
|||
use std::{ | |||
collections::{BTreeMap, VecDeque}, | |||
fmt::Debug, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the redundant import of fmt::Debug
since it is already included in the impl
block.
- fmt::Debug,
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
fmt::Debug, |
@@ -119,7 +122,7 @@ | |||
} | |||
} | |||
|
|||
pub fn on_local(&mut self, _now_ms: u64, actor: FeatureControlActor, cmd: LocalCmd) { | |||
pub fn on_local(&mut self, _now_ms: u64, actor: FeatureControlActor<UserData>, cmd: LocalCmd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Several files in the codebase still use the old function signature.
The on_local
method calls in various files, such as source_hint.rs
, controller.rs
, and others, use FeatureControlActor::Controller(())
and FeatureControlActor::Worker(1, ())
. These instances need to be reviewed to ensure they pass the correct UserData
type.
packages/network/src/features/pubsub/controller/source_hint.rs
packages/network/src/features/pubsub/controller.rs
packages/network/src/features/dht_kv/mod.rs
packages/network/src/features/dht_kv/internal.rs
packages/network/src/features/alias.rs
packages/network/src/features/pubsub/controller/remote_relay.rs
packages/network/src/features/pubsub/controller/feedbacks.rs
packages/network/src/features/pubsub/controller/consumers.rs
packages/network/src/features/dht_kv/client/map.rs
Please review these instances to ensure they are updated to use the correct UserData
type.
Analysis chain
The on_local
method now handles FeatureControlActor<UserData>
correctly. Ensure that all calls to this method pass the correct UserData
type.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify all calls to the `on_local` method pass the correct `UserData` type.
# Test: Search for the `on_local` method calls. Expect: Only occurrences with the correct `UserData` type.
rg --type rust $'.on_local('
Length of output: 100
Script:
#!/bin/bash
# Description: Verify all calls to the `on_local` method pass the correct `UserData` type.
# Test: Search for the `on_local` method calls. Expect: Only occurrences with the correct `UserData` type.
rg --type rust '\.on_local\('
Length of output: 3635
Script:
#!/bin/bash
# Description: Verify the `FeatureControlActor` type definitions to ensure they align with the expected `UserData` type.
# Test: Search for the `FeatureControlActor` type definition.
rg --type rust 'enum FeatureControlActor'
Length of output: 121
Script:
#!/bin/bash
# Description: Verify the `UserData` type used in `FeatureControlActor` instances.
# Test: Search for the `UserData` type definition.
rg --type rust 'type UserData'
Length of output: 32
Script:
#!/bin/bash
# Description: Verify the `FeatureControlActor` enum definition to understand the usage of `UserData`.
# Test: Search for the `FeatureControlActor` enum definition.
rg --type rust 'pub enum FeatureControlActor'
Length of output: 125
Script:
#!/bin/bash
# Description: Verify the instantiations of `FeatureControlActor` to check the `UserData` types.
# Test: Search for instantiations of `FeatureControlActor`.
rg --type rust 'FeatureControlActor::'
Length of output: 17335
// We dont accept register from local source, this ocurs when subscribe and next-hop reply with all sources include it self | ||
if source == self.node_id { | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical error: "ocurs" should be "occurs".
- // We dont accept register from local source, this ocurs when subscribe and next-hop reply with all sources include it self
+ // We don't accept register from local source, this occurs when subscribe and next-hop reply with all sources include itself
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
// We dont accept register from local source, this ocurs when subscribe and next-hop reply with all sources include it self | |
if source == self.node_id { | |
return; | |
} | |
// We don't accept register from local source, this occurs when subscribe and next-hop reply with all sources include itself | |
if source == self.node_id { | |
return; | |
} | |
// We dont accept unregister from local source, this ocurs when subscribe and next-hop reply with all sources include it self | ||
if source == self.node_id { | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical error: "ocurs" should be "occurs".
- // We dont accept unregister from local source, this ocurs when subscribe and next-hop reply with all sources include it self
+ // We don't accept unregister from local source, this occurs when subscribe and next-hop reply with all sources include itself
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
// We dont accept unregister from local source, this ocurs when subscribe and next-hop reply with all sources include it self | |
if source == self.node_id { | |
return; | |
} | |
// We don't accept unregister from local source, this occurs when subscribe and next-hop reply with all sources include itself | |
if source == self.node_id { | |
return; | |
} | |
// We dont accept register from local source, this ocurs when subscribe and next-hop reply with all sources include it self | ||
if source != self.node_id && self.remote_sources.insert(source, now_ms).is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical error: "ocurs" should be "occurs".
- // We dont accept register from local source, this ocurs when subscribe and next-hop reply with all sources include it self
+ // We don't accept register from local source, this occurs when subscribe and next-hop reply with all sources include itself
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
// We dont accept register from local source, this ocurs when subscribe and next-hop reply with all sources include it self | |
if source != self.node_id && self.remote_sources.insert(source, now_ms).is_none() { | |
// We don't accept register from local source, this occurs when subscribe and next-hop reply with all sources include itself | |
if source != self.node_id && self.remote_sources.insert(source, now_ms).is_none() { |
…ntralized-sdn into feat-for-media-server
This PR updates and implement more features for working with media-server