From 74a0e044e74ae41910819c92610fecbaa11fd02d Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Tue, 16 Jul 2024 09:34:12 -0500 Subject: [PATCH] Missing function docs --- .../src/network_json/network_json_counting.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rust/lqos_config/src/network_json/network_json_counting.rs b/src/rust/lqos_config/src/network_json/network_json_counting.rs index abd3ef15..787ace04 100644 --- a/src/rust/lqos_config/src/network_json/network_json_counting.rs +++ b/src/rust/lqos_config/src/network_json/network_json_counting.rs @@ -2,11 +2,19 @@ use log::warn; use lqos_utils::units::DownUpOrder; use crate::NetworkJsonNode; +/// Type used while updating the network tree with new data. +/// Rather than have a race condition while the updates are performed +/// (and potentially new requests come in, and receive invalid data), +/// we copy the network tree into this structure, and then update this +/// structure. Once the updates are complete, we copy the data back +/// into the main network tree. pub struct NetworkJsonCounting { pub(super) nodes: Vec, } impl NetworkJsonCounting { + /// Starts an update cycle. This clones the nodes into + /// the `NetworkJsonCounting` structure - work will be performed on the clone. pub fn begin_update_cycle(nodes: Vec) -> Self { Self { nodes } } @@ -56,6 +64,7 @@ impl NetworkJsonCounting { } } + /// Record TCP Retransmits in the tree. pub fn add_retransmit_cycle(&mut self, targets: &[usize], tcp_retransmits: DownUpOrder) { for idx in targets { // Safety first; use "get" to ensure that the node exists @@ -67,6 +76,7 @@ impl NetworkJsonCounting { } } + /// Adds a series of CAKE marks and drops to the tree structure. pub fn add_queue_cycle(&mut self, targets: &[usize], marks: &DownUpOrder, drops: &DownUpOrder) { for idx in targets { // Safety first; use "get" to ensure that the node exists