pub struct AsyncConversationWatcher { /* private fields */ }Expand description
Async conversation watcher that uses filesystem events with a periodic fallback poll for reliability.
Implementations§
Source§impl AsyncConversationWatcher
impl AsyncConversationWatcher
Sourcepub fn new(file_path: PathBuf, config: Option<WatcherConfig>) -> Self
pub fn new(file_path: PathBuf, config: Option<WatcherConfig>) -> Self
Create a new async watcher for a conversation file.
§Arguments
file_path- Path to the JSONL conversation fileconfig- Optional configuration (uses defaults if None)
Sourcepub fn with_offset(
file_path: PathBuf,
offset: u64,
config: Option<WatcherConfig>,
) -> Self
pub fn with_offset( file_path: PathBuf, offset: u64, config: Option<WatcherConfig>, ) -> Self
Create a watcher starting from a specific byte offset. Useful for resuming watching after a restart.
Sourcepub async fn poll(&self) -> Result<Vec<ConversationEntry>>
pub async fn poll(&self) -> Result<Vec<ConversationEntry>>
Check for new entries since last read (non-blocking poll). Returns new entries and updates internal offset.
Sourcepub async fn start(
self,
tx: Sender<Vec<ConversationEntry>>,
) -> Result<WatcherHandle>
pub async fn start( self, tx: Sender<Vec<ConversationEntry>>, ) -> Result<WatcherHandle>
Start watching the file and send new entries to the provided channel. This spawns a background task that:
- Watches for filesystem modify events
- Polls periodically as a safety fallback
Returns a handle that can be used to stop the watcher.
Auto Trait Implementations§
impl Freeze for AsyncConversationWatcher
impl !RefUnwindSafe for AsyncConversationWatcher
impl Send for AsyncConversationWatcher
impl Sync for AsyncConversationWatcher
impl Unpin for AsyncConversationWatcher
impl UnsafeUnpin for AsyncConversationWatcher
impl !UnwindSafe for AsyncConversationWatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more