pub struct DataLoader { /* private fields */ }Expand description
Data loader for discovering and streaming JSONL files
The DataLoader is responsible for finding Claude usage data files on the system and providing efficient streaming access to parse them.
Implementations§
Source§impl DataLoader
impl DataLoader
Sourcepub async fn new() -> Result<Self>
pub async fn new() -> Result<Self>
Create a new DataLoader by discovering Claude paths
This method automatically searches for Claude data directories in platform-specific locations.
§Errors
Returns an error if no Claude data directories are found
Sourcepub async fn find_jsonl_files(&self) -> Result<Vec<PathBuf>>
pub async fn find_jsonl_files(&self) -> Result<Vec<PathBuf>>
Find all JSONL files in the discovered directories
Recursively searches for .jsonl files in all discovered Claude directories.
§Returns
A vector of paths to JSONL files found
Sourcepub async fn find_recent_jsonl_files(
&self,
since: DateTime<Utc>,
) -> Result<Vec<PathBuf>>
pub async fn find_recent_jsonl_files( &self, since: DateTime<Utc>, ) -> Result<Vec<PathBuf>>
Find JSONL files modified since a given date
This is useful for performance optimization when you only need recent data, such as for statusline generation which only needs today’s data.
§Arguments
since- Only include files modified after this time
§Returns
A vector of paths to JSONL files modified since the given date
Sourcepub fn with_progress(self, show_progress: bool) -> Self
pub fn with_progress(self, show_progress: bool) -> Self
Enable or disable progress bars
Sourcepub fn with_interning(self, use_interning: bool) -> Self
pub fn with_interning(self, use_interning: bool) -> Self
Enable string interning for memory optimization
Sourcepub fn with_arena(self, use_arena: bool) -> Self
pub fn with_arena(self, use_arena: bool) -> Self
Enable arena allocation for parsing
Sourcepub fn load_usage_entries_parallel(
&self,
) -> impl Stream<Item = Result<UsageEntry>> + '_
pub fn load_usage_entries_parallel( &self, ) -> impl Stream<Item = Result<UsageEntry>> + '_
Load usage entries in parallel for better performance
This method uses Rayon to process multiple JSONL files concurrently, providing significant performance improvements for large datasets.
§Returns
An async stream of Result<UsageEntry> items processed in parallel
Sourcepub fn load_recent_usage_entries(
&self,
since: DateTime<Utc>,
) -> impl Stream<Item = Result<UsageEntry>> + '_
pub fn load_recent_usage_entries( &self, since: DateTime<Utc>, ) -> impl Stream<Item = Result<UsageEntry>> + '_
Load recent usage entries as an async stream
This method provides a stream of usage entries parsed from JSONL files modified since the given date. It’s optimized for scenarios where you only need recent data, such as statusline generation.
§Arguments
since- Only load entries from files modified after this time
§Returns
An async stream of Result<UsageEntry> items from recent files
Auto Trait Implementations§
impl Freeze for DataLoader
impl RefUnwindSafe for DataLoader
impl Send for DataLoader
impl Sync for DataLoader
impl Unpin for DataLoader
impl UnsafeUnpin for DataLoader
impl UnwindSafe for DataLoader
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more