mirror of
https://github.com/openai/codex.git
synced 2026-05-15 16:53:05 +00:00
Introduce a ThreadStore interface for mediating access to the filesystem (rollout jsonl files + sqlite db) based thread storage. In later PRs we'll move the existing fs code behind a "local" implementation of this ThreadStore interface. This PR should be a no-op behaviorally, it only introduces the interface.
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use codex_protocol::ThreadId;
|
|
|
|
/// Result type returned by thread-store operations.
|
|
pub type ThreadStoreResult<T> = Result<T, ThreadStoreError>;
|
|
|
|
/// Error type shared by thread-store implementations.
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum ThreadStoreError {
|
|
/// The requested thread does not exist in this store.
|
|
#[error("thread {thread_id} not found")]
|
|
ThreadNotFound {
|
|
/// Thread id requested by the caller.
|
|
thread_id: ThreadId,
|
|
},
|
|
|
|
/// The caller supplied invalid request data.
|
|
#[error("invalid thread-store request: {message}")]
|
|
InvalidRequest {
|
|
/// User-facing explanation of the invalid request.
|
|
message: String,
|
|
},
|
|
|
|
/// The operation conflicted with current store state.
|
|
#[error("thread-store conflict: {message}")]
|
|
Conflict {
|
|
/// User-facing explanation of the conflict.
|
|
message: String,
|
|
},
|
|
|
|
/// Catch-all for implementation failures that do not fit a more specific category.
|
|
#[error("thread-store internal error: {message}")]
|
|
Internal {
|
|
/// User-facing explanation of the implementation failure.
|
|
message: String,
|
|
},
|
|
}
|