Skip to content

Commit 4fa9093

Browse files
committed
removed mentions of channels and removed methods; removed claim about overhead
1 parent bd01915 commit 4fa9093

4 files changed

Lines changed: 13 additions & 18 deletions

File tree

aimdb-sync/src/consumer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ where
193193

194194
/// Get the latest value by draining all queued values.
195195
///
196-
/// This method drains the internal channel to get the most recent value,
196+
/// This method drains the buffer to get the most recent value,
197197
/// discarding any intermediate values. This is useful for SingleLatest-like
198198
/// semantics where you only care about the most recent data.
199199
///

aimdb-sync/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use aimdb_core::DbError;
55

66
/// Errors from the synchronous (blocking) API.
77
///
8-
/// Facade-specific failures (attach/detach, channel timeouts, runtime-thread
9-
/// shutdown) are their own variants; anything from the underlying database
10-
/// wraps a [`DbError`] via [`SyncError::Db`].
8+
/// Facade-specific failures (attach/detach, runtime-thread shutdown) are their
9+
/// own variants; anything from the underlying database wraps a [`DbError`]
10+
/// via [`SyncError::Db`].
1111
#[derive(Debug, thiserror::Error)]
1212
pub enum SyncError {
1313
/// Failed to attach the database to the runtime thread.

aimdb-sync/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//! ## Overview
77
//!
88
//! This crate provides a synchronous interface to AimDB by running the
9-
//! async runtime on a dedicated background thread and using channels
10-
//! to bridge between synchronous and asynchronous contexts.
9+
//! async runtime on a dedicated background thread, blocking on it directly
10+
//! for reads that must wait for data.
1111
//!
1212
//! ## Features
1313
//!
@@ -126,11 +126,9 @@
126126
//!
127127
//! - **User threads**: Unlimited - any number of threads can call operations concurrently
128128
//! - **Runtime thread**: One dedicated thread named "aimdb-sync-runtime"
129-
//! - **Channels**: Lock-free MPSC channels for efficient communication
130129
//!
131130
//! ## Performance
132131
//!
133-
//! - **Overhead**: ~100-500μs per operation vs pure async (channel + context switch)
134132
//! - **Latency**: Excellent for <50ms target, not suitable for hard low-latency requirements
135133
//!
136134
//! ## Error Handling

aimdb-sync/src/producer.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{fmt::Debug, marker::PhantomData};
88
/// Synchronous producer for records of type `T`.
99
///
1010
/// Thread-safe, can be cloned and shared across threads.
11-
/// Values are moved (not cloned) through channels for zero-copy performance.
11+
/// Values are moved (not cloned) directly into the record's buffer.
1212
///
1313
/// # Thread Safety
1414
///
@@ -29,7 +29,7 @@ use std::{fmt::Debug, marker::PhantomData};
2929
/// // Try to set (non-blocking)
3030
/// match producer.try_set(Temperature { celsius: 27.0 }) {
3131
/// Ok(()) => println!("Success"),
32-
/// Err(_) => println!("Channel full, try later"),
32+
/// Err(_) => println!("Buffer full, try later"),
3333
/// }
3434
/// # Ok(())
3535
/// # }
@@ -99,16 +99,13 @@ where
9999

100100
/// Try to set the value without blocking.
101101
///
102-
/// Attempts to send the value immediately. Returns an error if the channel is full
103-
/// or the runtime thread has shut down.
104-
///
105-
/// **Note**: This method returns immediately after sending to the channel, but does NOT
106-
/// wait for the produce operation to complete. Use `set()` if
107-
/// you need to know whether the produce operation succeeded.
102+
/// Pushes the value directly into the record's buffer. Unlike `set()`, this never
103+
/// blocks: it fails immediately if the buffer is full instead of waiting for space.
108104
///
109105
/// # Errors
110106
///
111-
/// Returns `SyncError::SetTimeout` if the channel is full.
107+
/// Returns `SyncError::SetTimeout` for bounded, non-overwriting buffer
108+
/// implementations if the buffer is full.
112109
/// Returns `SyncError::RuntimeShutdown` if the runtime thread has been detached.
113110
///
114111
/// # Example
@@ -129,7 +126,7 @@ where
129126
/// let producer = handle.producer::<MyData>("my_data")?;
130127
/// match producer.try_set(MyData { value: 42 }) {
131128
/// Ok(()) => println!("Sent immediately"),
132-
/// Err(_) => println!("Channel full or runtime shutdown"),
129+
/// Err(_) => println!("Buffer full or runtime shutdown"),
133130
/// }
134131
/// # Ok(())
135132
/// # }

0 commit comments

Comments
 (0)