pub struct Project { /* private fields */ }Expand description
A project (directory containing session JSONL files)
Implementations§
Source§impl Project
impl Project
Sourcepub fn load(storage_dir: &Path) -> Result<Project, Error>
pub fn load(storage_dir: &Path) -> Result<Project, Error>
Load project from storage directory
§Errors
Returns error if the directory does not exist, is not a directory, has an invalid or non-UTF-8 name, or if the encoded path cannot be decoded.
Sourcepub fn storage_dir(&self) -> &Path
pub fn storage_dir(&self) -> &Path
Get storage directory path
Sourcepub fn has_sessions(&self) -> Result<bool, Error>
pub fn has_sessions(&self) -> Result<bool, Error>
Sourcepub fn count_sessions(&self) -> Result<usize, Error>
pub fn count_sessions(&self) -> Result<usize, Error>
Sourcepub fn count_sessions_split(&self) -> Result<(usize, usize), Error>
pub fn count_sessions_split(&self) -> Result<(usize, usize), Error>
Count sessions by type using filename inspection only — no JSONL parsing.
Returns (main_sessions, agent_sessions). Agent sessions are identified by
the agent- filename prefix; all other sessions are main sessions.
§Performance
O(N) directory listing only. Suitable for status/stats commands that need session counts without entry-level detail.
§Errors
Returns error if the project directory cannot be read.
Sourcepub fn all_sessions(&self) -> Result<Vec<Session>, Error>
pub fn all_sessions(&self) -> Result<Vec<Session>, Error>
List all sessions including agent sessions
§Errors
Returns error if the project directory cannot be read.
Sourcepub fn project_stats(&self) -> Result<ProjectStats, Error>
pub fn project_stats(&self) -> Result<ProjectStats, Error>
Compute project statistics
Aggregates statistics from all sessions (main and agent) in this project.
§Errors
Returns error if the project directory cannot be read or if a session file cannot be parsed.
Sourcepub fn sessions_filtered(
&mut self,
filter: &SessionFilter,
) -> Result<Vec<Session>, Error>
pub fn sessions_filtered( &mut self, filter: &SessionFilter, ) -> Result<Vec<Session>, Error>
List sessions matching filter
§Filtering Logic
Returns only sessions that match ALL filter conditions (AND logic):
agent_only: Filter by agent/main session typemin_entries: Minimum entry countsession_id_substring: Session ID substring match (case-insensitive)
§Examples
use claude_storage_core::{ Storage, SessionFilter };
let storage = Storage::new().unwrap();
let mut project = storage.list_projects().unwrap().into_iter().next().unwrap();
// Filter for agent sessions with 10+ entries
let filter = SessionFilter
{
agent_only : Some( true ),
min_entries : Some( 10 ),
session_id_substring : None,
};
let sessions = project.sessions_filtered( &filter ).unwrap();§Errors
Returns error if the project directory cannot be read or if session filtering fails (e.g., cannot read a session file for entry count).
Sourcepub fn matches_filter(&self, filter: &ProjectFilter) -> Result<bool, Error>
pub fn matches_filter(&self, filter: &ProjectFilter) -> Result<bool, Error>
Check if project matches filter
§Filtering Logic
All filter conditions must match (AND logic):
path_substring: Path substring match (case-insensitive)min_entries: Minimum total entries across all sessionsmin_sessions: Minimum session count
§Examples
use claude_storage_core::{ Storage, ProjectFilter };
let storage = Storage::new().unwrap();
let project = storage.list_projects().unwrap().into_iter().next().unwrap();
let filter = ProjectFilter
{
path_substring : Some( "myproject".to_string() ),
min_entries : None,
min_sessions : Some( 5 ),
};
assert!( project.matches_filter( &filter ).unwrap() );§Errors
Returns error if reading session counts or project statistics fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnsafeUnpin for Project
impl UnwindSafe for Project
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<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
impl<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
Source§type Val = <C as Collection>::Val
type Val = <C as Collection>::Val
Entry in complex collections.
For example, in a HashMap, while Entry might be a ( key, value ) tuple, Val might only be the value part.Source§fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
Source§impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
Source§fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
Invokes the val_to_entry function of the CollectionValToEntry trait to convert the value to an entry.
Source§type Entry = <C as CollectionValToEntry<Val>>::Entry
type Entry = <C as CollectionValToEntry<Val>>::Entry
Entry is defined by the Collection trait.