File tree Expand file tree Collapse file tree 3 files changed +4
-34
lines changed
Expand file tree Collapse file tree 3 files changed +4
-34
lines changed Original file line number Diff line number Diff line change @@ -51,36 +51,6 @@ impl std::error::Error for BatchError {}
5151
5252/// A batching mechanism that groups values by category and flushes them
5353/// based on size or time thresholds.
54- ///
55- /// # Guarantees
56- /// - Values within the same group are flushed in the order they were added.
57- /// - No ordering guarantees exist between different groups.
58- /// - On shutdown, all pending batches are flushed before the receiver closes.
59- ///
60- /// # Example
61- /// ```no_run
62- /// use std::time::Duration;
63- ///
64- /// # async fn example() {
65- /// let config = BatchConfig {
66- /// max_size: 10,
67- /// max_time: Duration::from_secs(1),
68- /// ..Default::default()
69- /// };
70- ///
71- /// let (batcher, mut receiver) = CategoricalBatcher::new(config);
72- ///
73- /// // Add values
74- /// let _ = batcher.add("group1", "value1").await.unwrap();
75- /// let _ = batcher.add("group1", "value2").await.unwrap();
76- /// let _ = batcher.add("group2", "value3").await.unwrap();
77- ///
78- /// // Receive batches
79- /// while let Some((group, values)) = receiver.recv().await {
80- /// println!("Received {} values for group {}", values.len(), group);
81- /// }
82- /// # }
83- /// ```
8454#[ derive( Clone ) ]
8555pub struct CategoricalBatcher < G , V > {
8656 tx : mpsc:: Sender < ( G , V ) > ,
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ pub struct UnstampedComputeUsageEvent {
5252}
5353
5454impl UnstampedComputeUsageEvent {
55- /// Makes a [`ComputeEvent `] out of a [`UnstampedComputeEvent `] with the
56- /// remaining information and timestamp.
55+ /// Makes a [`ComputeUsageEvent `] out of a [`UnstampedComputeUsageEvent `] with
56+ /// the remaining information and timestamp.
5757 pub fn stamp_with_now (
5858 self ,
5959 entry_id : RecordId < Entry > ,
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ pub struct UnstampedEgressUsageEvent {
5050}
5151
5252impl UnstampedEgressUsageEvent {
53- /// Makes an [`EgressEvent `] out of a [`UnstampedEgressEvent `] with the
54- /// remaining information and timestamp.
53+ /// Makes an [`EgressUsageEvent `] out of a [`UnstampedEgressUsageEvent `] with
54+ /// the remaining information and timestamp.
5555 pub fn stamp_with_now ( self , byte_count : u64 ) -> EgressUsageEvent {
5656 let timestamp = UtcDateTime :: now ( ) ;
5757 EgressUsageEvent {
You can’t perform that action at this time.
0 commit comments