pub struct StateStore { /* private fields */ }Expand description
Unified state store for .taskfast/ local files.
Implementations§
Source§impl StateStore
impl StateStore
Sourcepub fn from_config_path(config_path: &Path) -> Self
pub fn from_config_path(config_path: &Path) -> Self
Construct a store from a config path.
When config_path is /dev/null or within /dev/, creates an ephemeral
store that never touches the filesystem. Otherwise, creates a disk-backed
store rooted at the parent directory of config_path.
Sourcepub fn is_ephemeral(&self) -> bool
pub fn is_ephemeral(&self) -> bool
Return true if this store is ephemeral (no on-disk persistence).
Sourcepub fn path_for(&self, asset: StateAsset) -> Option<PathBuf>
pub fn path_for(&self, asset: StateAsset) -> Option<PathBuf>
Return the resolved path on disk for a state asset, or None if ephemeral.
Sourcepub fn ensure_dir(&self) -> Result<()>
pub fn ensure_dir(&self) -> Result<()>
Ensure the root directory exists with 0700 permissions and automatic .gitignore.
Sourcepub fn ensure_dir_path(dir: &Path) -> Result<()>
pub fn ensure_dir_path(dir: &Path) -> Result<()>
Ensure a directory exists. When the directory is named .taskfast, tightens
permissions to 0700 on Unix and provisions .gitignore.
Sourcepub fn atomic_write_file(path: &Path, contents: &[u8]) -> Result<()>
pub fn atomic_write_file(path: &Path, contents: &[u8]) -> Result<()>
Atomic file write: writes to sibling .tmp, 0600 on Unix from creation, flushes, renames.
Cleans up the temporary file if write or rename fails. Does not chmod the parent directory.
Sourcepub fn read_cursor(&self) -> Option<String>
pub fn read_cursor(&self) -> Option<String>
Read the pagination cursor if present and non-empty.
Sourcepub fn write_cursor(&self, next_cursor: Option<&str>) -> Result<()>
pub fn write_cursor(&self, next_cursor: Option<&str>) -> Result<()>
Write pagination cursor. A None cursor leaves the existing cursor untouched.
Sourcepub fn load_seen_lines(&self) -> Result<Vec<String>>
pub fn load_seen_lines(&self) -> Result<Vec<String>>
Load seen event IDs from events.seen.
Sourcepub fn append_seen_line(&self, id: &str) -> Result<()>
pub fn append_seen_line(&self, id: &str) -> Result<()>
Append a single seen ID to events.seen.
Sourcepub fn rewrite_seen_lines(&self, ids: &VecDeque<String>) -> Result<()>
pub fn rewrite_seen_lines(&self, ids: &VecDeque<String>) -> Result<()>
Rewrite events.seen with the given IDs, separated by newlines.
Sourcepub fn get_pending_fee_retry(&self, task_id: &Uuid) -> Option<String>
pub fn get_pending_fee_retry(&self, task_id: &Uuid) -> Option<String>
Read any pending fee retry transaction hash for task_id.
Sourcepub fn record_pending_fee_retry(
&self,
task_id: &Uuid,
tx_hash: &str,
) -> Result<()>
pub fn record_pending_fee_retry( &self, task_id: &Uuid, tx_hash: &str, ) -> Result<()>
Record a pending fee retry transaction hash for task_id.
Sourcepub fn clear_pending_fee_retry(&self, task_id: &Uuid) -> Result<()>
pub fn clear_pending_fee_retry(&self, task_id: &Uuid) -> Result<()>
Clear any pending fee retry transaction hash for task_id.
Trait Implementations§
Source§impl Clone for StateStore
impl Clone for StateStore
Auto Trait Implementations§
impl Forget for StateStore
impl Freeze for StateStore
impl Move for StateStore
impl RefUnwindSafe for StateStore
impl Send for StateStore
impl Sync for StateStore
impl Unpin for StateStore
impl UnsafeUnpin for StateStore
impl UnwindSafe for StateStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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