Interface ISessionRepository
Abstraction for session persistence. The existing SessionStore (SQLite) implements this interface. Distributed backends (PostgreSQL, Redis) can provide alternative implementations for multi-node deployments.
public interface ISessionRepository
Methods
CountAsync(string?, CancellationToken)
Returns the total number of sessions.
Task<long> CountAsync(string? projectPath = null, CancellationToken ct = default)
Parameters
projectPathstringctCancellationToken
Returns
CreateSessionAsync(SessionRecord, CancellationToken)
Creates a new session record.
Task CreateSessionAsync(SessionRecord session, CancellationToken ct = default)
Parameters
sessionSessionRecordctCancellationToken
Returns
DeleteSessionAsync(string, CancellationToken)
Deletes a session and all its related data.
Task DeleteSessionAsync(string sessionId, CancellationToken ct = default)
Parameters
sessionIdstringctCancellationToken
Returns
GetSessionAsync(string, CancellationToken)
Gets a session by ID.
Task<SessionRecord?> GetSessionAsync(string sessionId, CancellationToken ct = default)
Parameters
sessionIdstringctCancellationToken
Returns
ListSessionsAsync(string?, int, int, CancellationToken)
Lists sessions with optional filtering.
Task<IReadOnlyList<SessionRecord>> ListSessionsAsync(string? projectPath = null, int limit = 50, int offset = 0, CancellationToken ct = default)
Parameters
projectPathstringlimitintoffsetintctCancellationToken
Returns
UpdateSessionAsync(SessionRecord, CancellationToken)
Updates an existing session record.
Task UpdateSessionAsync(SessionRecord session, CancellationToken ct = default)
Parameters
sessionSessionRecordctCancellationToken