pub struct FileTaskStore { /* private fields */ }Expand description
File-based task store with atomic writes
Stores tasks in a JSON file with the following features:
- Advisory file locking during read-modify-write operations
- Atomic writes via temp file + rename
- Thread-safe concurrent access via internal mutex
§Example
use meerkat_tools::builtin::{FileTaskStore, TaskStore, NewTask};
use std::path::PathBuf;
let store = FileTaskStore::new(PathBuf::from("/path/to/.rkat/tasks.json"));
let task = store.create(
NewTask {
subject: "Test task".to_string(),
description: "A test task".to_string(),
priority: None,
labels: None,
blocks: None,
},
None
).await.unwrap();Implementations§
Trait Implementations§
Source§impl TaskStore for FileTaskStore
impl TaskStore for FileTaskStore
Source§fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all tasks in the store
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a single task by ID Read more
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
new_task: NewTask,
session_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
new_task: NewTask,
session_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new task Read more
Source§fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
update: TaskUpdate,
session_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
update: TaskUpdate,
session_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Update an existing task Read more
Auto Trait Implementations§
impl !Freeze for FileTaskStore
impl !RefUnwindSafe for FileTaskStore
impl !UnwindSafe for FileTaskStore
impl Send for FileTaskStore
impl Sync for FileTaskStore
impl Unpin for FileTaskStore
impl UnsafeUnpin for FileTaskStore
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
Converts
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>
Converts
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