Skip to main content

WriteTools

Enum WriteTools 

Source
pub enum WriteTools {
    Legacy {
        files: FileTools,
        batch: BatchTools,
    },
    Git(GitFileTools),
}
Expand description

Per-vault write surface. One dispatch site per method; the MCP layer is backend-agnostic.

Variants§

§

Legacy

Pre-cutover VaultManager mutators + BatchExecutor. Deletion target at GWS.15.

Fields

§

Git(GitFileTools)

turbovault-git substrate — every change is a commit.

Implementations§

Source§

impl WriteTools

Source

pub fn is_git(&self) -> bool

Whether this dispatcher is backed by the atomic Git substrate.

Source

pub fn legacy(manager: Arc<VaultManager>) -> Self

Construct the legacy dispatch wrapping the existing VaultManager-backed tools.

Source

pub fn git( manager: Arc<VaultManager>, vault_path: PathBuf, commit_locks: Arc<CommitLocks>, ) -> Self

Construct the git-backed dispatch. manager is shared with the read path; vault_path + commit_locks open a VaultRepo per call (libgit2 is !Sync; see GitFileTools for why).

Source

pub fn git_with_hook( manager: Arc<VaultManager>, vault_path: PathBuf, commit_locks: Arc<CommitLocks>, commit_hook: CommitHook, ) -> Self

Git-backed dispatch WITH a GWS.14 reindex hook installed on every per-call VaultRepo. The MCP server uses this; bare Self::git stays for tests / migrations that don’t run the reindex stack.

Source

pub fn git_with_hook_and_flush( manager: Arc<VaultManager>, vault_path: PathBuf, commit_locks: Arc<CommitLocks>, commit_hook: CommitHook, flush_on_collision: CasCollisionFlush, ) -> Self

Git-backed dispatch with reindex hook AND CAS-collision flush (GWS.14b). The flush runs before apply_txn returns a ConcurrencyError, so the agent’s re-read sees coherent derived state.

Source

pub fn with_include_ignored(self, include_ignored: bool) -> Self

turbovault-lri: builder-style override for the underlying GitFileTools::include_ignored policy. No-op on the legacy arm (the legacy backend doesn’t consult .gitignore at all). When false, every mutation pre-checks each touched path against the worktree’s .gitignore matcher and refuses the changeset with a typed error if any path would be ignored. Default true.

Source

pub fn with_cached_repo(self, cached_repo: CachedRepo) -> Self

turbovault-a0l (PERF-1): install the cached per-vault VaultRepo handle on the git arm so writes reuse it instead of opening per call. No-op on the legacy arm (no substrate handle).

Source

pub async fn read_file(&self, path: &str) -> Result<String>

Source

pub async fn get_notes_info(&self, paths: &[String]) -> Result<Vec<NoteInfo>>

Source

pub async fn write_file_with_mode( &self, path: &str, content: &str, mode: WriteMode, expected_hash: Option<&str>, ) -> Result<()>

Source

pub async fn write_file(&self, path: &str, content: &str) -> Result<()>

Source

pub async fn create_file(&self, path: &str, content: &str) -> Result<()>

Strict create (turbovault-947 / write-note CAS-by-default).

Git backend: the substrate’s Changeset::create carries an expect_absent precondition — a concurrent winner makes the loser’s CAS fail loudly with ConcurrencyError. This is the safety the MCP layer’s pre-check cannot provide on its own (TOCTOU window).

Legacy backend: delegates to write_file (best-effort; legacy has no atomic create primitive). The MCP layer’s pre-check is the only protection — concurrent creates can still race. Known limit of the legacy path; documented, not fixed (per the legacy-stays direction).

Source

pub async fn write_file_with_mode_and_message( &self, path: &str, content: &str, mode: WriteMode, expected_hash: Option<&str>, message: &str, ) -> Result<()>

Source

pub async fn create_file_with_message( &self, path: &str, content: &str, message: &str, ) -> Result<()>

Source

pub async fn edit_file_with_message( &self, path: &str, edits: &str, expected_hash: Option<&str>, dry_run: bool, message: &str, ) -> Result<EditResult>

Source

pub async fn delete_file_with_hash_and_message( &self, path: &str, expected_hash: Option<&str>, message: &str, ) -> Result<()>

Source

pub async fn move_file_with_hash_and_message( &self, from: &str, to: &str, expected_hash: Option<&str>, message: &str, ) -> Result<()>

turbovault-oz6: list inbound backlinks for a path. Both backends resolve via the same in-memory link graph (kept coherent by the substrate’s CommitHook + drainer / external-ref listener for git; kept manually-coherent by VaultManager mutators for legacy).

turbovault-oz6: atomic delete + inbound-wikilink wrap-as-stale. Git backend only — legacy refuses loudly (no atomic multi-file primitive).

turbovault-lqr: atomic move + inbound-wikilink rewrite. Git backend only — legacy refuses loudly (no atomic multi-file primitive; the substrate’s killer feature that the legacy path cannot match).

Source

pub async fn batch_execute_with_message( &self, operations: Vec<BatchOperation>, message: &str, ) -> Result<BatchResult>

Source

pub async fn edit_file( &self, path: &str, edits: &str, expected_hash: Option<&str>, dry_run: bool, ) -> Result<EditResult>

Source

pub async fn delete_file(&self, path: &str) -> Result<()>

Source

pub async fn delete_file_with_hash( &self, path: &str, expected_hash: Option<&str>, ) -> Result<()>

Source

pub async fn move_file(&self, from: &str, to: &str) -> Result<()>

Source

pub async fn move_file_with_hash( &self, from: &str, to: &str, expected_hash: Option<&str>, ) -> Result<()>

Source

pub async fn copy_file(&self, from: &str, to: &str) -> Result<()>

Source

pub async fn batch_execute( &self, operations: Vec<BatchOperation>, ) -> Result<BatchResult>

Trait Implementations§

Source§

impl Clone for WriteTools

Source§

fn clone(&self) -> WriteTools

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Fruit for T
where T: Send + Downcast,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = 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