Skip to main content

MetadataStore

Struct MetadataStore 

Source
pub struct MetadataStore { /* private fields */ }

Implementations§

Source§

impl MetadataStore

Source

pub fn at(project_root: impl Into<Utf8PathBuf>) -> Self

Source

pub fn init( project_root: impl Into<Utf8PathBuf>, project_name: &str, source: SourceSubstrate, ) -> Result<Self>

Source

pub fn discover(cwd: &Utf8Path) -> Result<Context>

Walk upward from cwd to find the governing metadata. A workspace is recognized by its gitignored marker and resolves to the store it was cloned from; a directory with a committed .newgit/config.toml and no marker is the store itself.

Source

pub fn paths(&self) -> &NewgitPaths

Source

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

Source

pub fn load_config(&self) -> Result<ProjectConfig>

Source

pub fn write_config(&self, config: &ProjectConfig) -> Result<()>

Source

pub fn branch_record_path(&self, slug: &str) -> Utf8PathBuf

Source

pub fn create_branch_record( &self, branch: &BranchInstance, ) -> Result<Utf8PathBuf>

Write a brand-new binding record; fails on slug collision.

Source

pub fn save_branch_record(&self, branch: &BranchInstance) -> Result<Utf8PathBuf>

Overwrite an existing binding record (e.g. after a tracker capture).

Source

pub fn load_tracker_definitions(&self) -> Result<Vec<TrackerDefinition>>

Tracker definitions, one per file in .newgit/trackers/; the name comes from the filename. Lanes are validated as disjoint.

Source

pub fn create_tracker_definition( &self, definition: &TrackerDefinition, ) -> Result<Utf8PathBuf>

Source

pub fn save_tracker_definition( &self, definition: &TrackerDefinition, ) -> Result<Utf8PathBuf>

Source

pub fn load_resource_definitions(&self) -> Result<Vec<ResourceDefinition>>

Resource definitions, one per file in .newgit/resources/.

Source

pub fn write_resource_file( &self, name: &str, contents: &str, ) -> Result<Utf8PathBuf>

Source

pub fn instance_state_dir(&self, slug: &str) -> Utf8PathBuf

Source

pub fn checkpoint_dir(&self, slug: &str) -> Utf8PathBuf

Per-instance checkpoint records: .newgit/checkpoints/<slug>/.

Source

pub fn checkpointed_slugs(&self) -> Result<Vec<String>>

Every slug with a checkpoint directory, including instances whose binding record has been archived. Checkpoints outlive removal, so snapshot pruning has to consult all of them, not just live records.

Source

pub fn state_dirs(&self) -> Result<Vec<Utf8PathBuf>>

Per-instance runtime state directories that exist on disk.

Source

pub fn action_log_path(&self, slug: &str, label: &str) -> Utf8PathBuf

Timestamped log path for one action run.

Source

pub fn append_gitignore(&self, label: &str, patterns: &[String]) -> Result<()>

Append patterns to the store repo’s .gitignore under a labeled block.

Source

pub fn load_branches(&self) -> Result<Vec<BranchInstance>>

Source

pub fn find_branch(&self, name: &str) -> Result<BranchInstance>

Look an instance up by name or slug.

Source

pub fn archive_branch_record( &self, branch: &BranchInstance, ) -> Result<Utf8PathBuf>

The binding record outlives the workspace: removal archives it rather than deleting it.

Trait Implementations§

Source§

impl Clone for MetadataStore

Source§

fn clone(&self) -> MetadataStore

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 Debug for MetadataStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MetadataStore

Source§

impl PartialEq for MetadataStore

Source§

fn eq(&self, other: &MetadataStore) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MetadataStore

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
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.