Skip to main content

FileCardStore

Struct FileCardStore 

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

File-backed implementation of CardStore.

Implementations§

Source§

impl FileCardStore

Source

pub fn new(root: PathBuf) -> Self

Construct a store rooted at an explicit path.

Source

pub fn root(&self) -> &Path

Return the root directory this store writes under.

Source

pub fn create(&self, input: Json) -> Result<(String, PathBuf), String>

Source

pub fn get(&self, card_id: &str) -> Result<Option<Json>, String>

Source

pub fn list(&self, pkg_filter: Option<&str>) -> Result<Vec<Summary>, String>

Source

pub fn append(&self, card_id: &str, fields: Json) -> Result<Json, String>

Source

pub fn alias_set( &self, name: &str, card_id: &str, pkg: Option<&str>, note: Option<&str>, ) -> Result<Alias, String>

Source

pub fn alias_list(&self, pkg_filter: Option<&str>) -> Result<Vec<Alias>, String>

Source

pub fn get_by_alias(&self, name: &str) -> Result<Option<Json>, String>

Source

pub fn find(&self, q: FindQuery) -> Result<Vec<Summary>, String>

Source

pub fn write_samples( &self, card_id: &str, samples: Vec<Json>, ) -> Result<PathBuf, String>

Source

pub fn read_samples( &self, card_id: &str, q: SamplesQuery, ) -> Result<Vec<Json>, String>

Source

pub fn lineage(&self, q: LineageQuery) -> Result<Option<LineageResult>, String>

Source

pub fn card_sink_backfill( &self, sink: &str, dry_run: bool, ) -> Result<SinkBackfillReport, String>

Trait Implementations§

Source§

impl CardStore for FileCardStore

Source§

fn write_new_card( &self, pkg: &str, card_id: &str, toml_text: &str, ) -> Result<PathBuf, String>

Write a new Card (Tier 1 TOML). Read more
Source§

fn overwrite_card( &self, card_id: &str, toml_text: &str, ) -> Result<PathBuf, String>

Overwrite an existing Card (append flow). Read more
Source§

fn find_card_locator(&self, card_id: &str) -> Result<Option<PathBuf>, String>

Locate a Card file by id. Returns None if not found.
Source§

fn read_card_text(&self, card_id: &str) -> Result<Option<String>, String>

Read a Card’s raw TOML text by id. Returns None if missing.
Source§

fn list_card_locators( &self, pkg_filter: Option<&str>, ) -> Result<Vec<(String, PathBuf)>, String>

List (pkg, locator) pairs for every Card file in the store. Read more
Source§

fn read_locator_text(&self, locator: &Path) -> Result<Option<String>, String>

Read raw TOML text from a locator returned by Self::list_card_locators. Ok(None) on read failure so scans can skip corrupt files without aborting.
Source§

fn read_aliases(&self) -> Result<Vec<Alias>, String>

Source§

fn write_aliases(&self, aliases: &[Alias]) -> Result<(), String>

Source§

fn samples_exists(&self, card_id: &str) -> Result<bool, String>

Check whether a samples sidecar exists for card_id.
Source§

fn write_samples_text( &self, card_id: &str, jsonl_text: &str, ) -> Result<PathBuf, String>

Write a samples sidecar (write-once). Read more
Source§

fn read_samples_text(&self, card_id: &str) -> Result<Option<String>, String>

Read a samples sidecar as raw JSONL text. Returns None when no sidecar exists (samples are optional).
Source§

fn import_from_dir( &self, source_dir: &Path, pkg: &str, ) -> Result<(Vec<String>, Vec<String>), String>

Import Card files from source_dir into the store under pkg. First-writer wins (existing Cards are skipped). Returns (imported, skipped) card_id lists.

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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