Skip to main content

FileStorage

Struct FileStorage 

Source
pub struct FileStorage { /* private fields */ }
Expand description

File-based storage implementation for tickets

This implementation stores tickets as YAML files in a directory structure within the project’s .vibe-ticket directory.

Implementations§

Source§

impl FileStorage

Source

pub fn new(base_dir: impl Into<PathBuf>) -> Self

Creates a new FileStorage instance

Source

pub fn ensure_directories(&self) -> Result<()>

Ensures the storage directories exist

Source

pub fn save_ticket(&self, ticket: &Ticket) -> Result<()>

Saves a ticket to storage with file locking for concurrent access protection

Source

pub fn load_ticket(&self, id: &TicketId) -> Result<Ticket>

Loads a ticket from storage by ID with read locking

Source

pub fn load_all_tickets(&self) -> Result<Vec<Ticket>>

Loads all tickets from storage

Source

pub fn delete_ticket(&self, id: &TicketId) -> Result<()>

Deletes a ticket from storage with locking

Source

pub fn set_active_ticket(&self, id: &TicketId) -> Result<()>

Sets the active ticket with locking

Source

pub fn get_active_ticket(&self) -> Result<Option<TicketId>>

Gets the active ticket ID

Source

pub fn clear_active_ticket(&self) -> Result<()>

Clears the active ticket with locking

Source

pub fn add_active_ticket(&self, id: &TicketId) -> Result<()>

Adds a ticket to the list of active tickets

This method adds a ticket ID to the active tickets list stored in active_tickets.yaml. If the file doesn’t exist, it creates it.

Source

pub fn remove_active_ticket(&self, id: &TicketId) -> Result<()>

Removes a ticket from the list of active tickets

Source

pub fn get_all_active_tickets(&self) -> Result<Vec<TicketId>>

Gets all active ticket IDs

This method reads from both the new active_tickets.yaml and legacy active_ticket files for backward compatibility.

Source

pub fn ticket_exists_with_slug(&self, slug: &str) -> Result<bool>

Checks if a ticket with the given slug already exists

Source

pub fn find_ticket_by_slug(&self, slug: &str) -> Result<Option<Ticket>>

Finds a ticket by its slug

Source§

impl FileStorage

Source

pub fn save_state(&self, state: &ProjectState) -> Result<()>

Saves the project state

Source

pub fn load_state(&self) -> Result<ProjectState>

Loads the project state

Trait Implementations§

Source§

impl ActiveTicketRepository for FileStorage

Source§

fn set_active(&self, id: &TicketId) -> Result<()>

Sets the active ticket ID (clears other active tickets)
Source§

fn get_active(&self) -> Result<Option<TicketId>>

Gets the active ticket ID (returns first active ticket for compatibility)
Source§

fn clear_active(&self) -> Result<()>

Clears all active tickets
Source§

fn add_active(&self, id: &TicketId) -> Result<()>

Adds a ticket to the list of active tickets
Source§

fn remove_active(&self, id: &TicketId) -> Result<()>

Removes a ticket from the list of active tickets
Source§

fn get_all_active(&self) -> Result<Vec<TicketId>>

Gets all active ticket IDs
Source§

impl Clone for FileStorage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl TicketRepository for FileStorage

Source§

fn save(&self, ticket: &Ticket) -> Result<()>

Saves a ticket to the repository
Source§

fn load(&self, id: &TicketId) -> Result<Ticket>

Loads a ticket by ID
Source§

fn load_all(&self) -> Result<Vec<Ticket>>

Loads all tickets
Source§

fn delete(&self, id: &TicketId) -> Result<()>

Deletes a ticket by ID
Source§

fn exists(&self, id: &TicketId) -> Result<bool>

Checks if a ticket exists by ID
Source§

fn find<F>(&self, predicate: F) -> Result<Vec<Ticket>>
where F: Fn(&Ticket) -> bool,

Finds tickets matching a predicate
Source§

fn count<F>(&self, predicate: F) -> Result<usize>
where F: Fn(&Ticket) -> bool,

Counts tickets matching a predicate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Repository for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more