pub struct CodexSessionScanner<'a, S: Storage> { /* private fields */ }Expand description
Orchestrates Codex session file scanning with storage integration.
CodexSessionScanner provides a high-level API for scanning Codex CLI
session files and inserting events into storage. It handles:
- Incremental parsing (only reads new content since last scan)
- Deduplication by timestamp+type key
- Position tracking for future scans
Implementations§
Source§impl<'a, S: Storage> CodexSessionScanner<'a, S>
impl<'a, S: Storage> CodexSessionScanner<'a, S>
Sourcepub fn new(storage: &'a S, machine_id: impl Into<String>) -> Self
pub fn new(storage: &'a S, machine_id: impl Into<String>) -> Self
Create a new scanner with the given storage and machine ID.
Sourcepub fn scan_file(&self, path: &Path) -> Result<ScanResult, ScanError>
pub fn scan_file(&self, path: &Path) -> Result<ScanResult, ScanError>
Scan a Codex session file and insert events into storage.
This method:
- Extracts session ID from filename
- Loads the last scanned position for the file
- Parses new entries since that position
- Inserts new events
- Updates the position for future incremental scans
Sourcepub fn scan_session(&self, session_id: &str) -> Result<ScanResult, ScanError>
pub fn scan_session(&self, session_id: &str) -> Result<ScanResult, ScanError>
Scan a session file by session ID.
Looks up the session file path in the standard Codex sessions directory. After scanning, also updates the transcript_path for the provided session_id, which may differ from the UUID extracted from the filename. This ensures sessions created by hooks (using thread-id) get their transcript_path set.
Auto Trait Implementations§
impl<'a, S> Freeze for CodexSessionScanner<'a, S>
impl<'a, S> RefUnwindSafe for CodexSessionScanner<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for CodexSessionScanner<'a, S>where
S: Sync,
impl<'a, S> Sync for CodexSessionScanner<'a, S>where
S: Sync,
impl<'a, S> Unpin for CodexSessionScanner<'a, S>
impl<'a, S> UnwindSafe for CodexSessionScanner<'a, S>where
S: RefUnwindSafe,
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