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.
Git(GitFileTools)
turbovault-git substrate — every change is a commit.
Implementations§
Source§impl WriteTools
impl WriteTools
Sourcepub fn legacy(manager: Arc<VaultManager>) -> Self
pub fn legacy(manager: Arc<VaultManager>) -> Self
Construct the legacy dispatch wrapping the existing VaultManager-backed
tools.
Sourcepub fn git(
manager: Arc<VaultManager>,
vault_path: PathBuf,
commit_locks: Arc<CommitLocks>,
) -> Self
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).
Sourcepub fn git_with_hook(
manager: Arc<VaultManager>,
vault_path: PathBuf,
commit_locks: Arc<CommitLocks>,
commit_hook: CommitHook,
) -> Self
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.
Sourcepub fn git_with_hook_and_flush(
manager: Arc<VaultManager>,
vault_path: PathBuf,
commit_locks: Arc<CommitLocks>,
commit_hook: CommitHook,
flush_on_collision: CasCollisionFlush,
) -> Self
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.
Sourcepub fn with_include_ignored(self, include_ignored: bool) -> Self
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.
Sourcepub fn with_cached_repo(self, cached_repo: CachedRepo) -> Self
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).
pub async fn read_file(&self, path: &str) -> Result<String>
pub async fn get_notes_info(&self, paths: &[String]) -> Result<Vec<NoteInfo>>
pub async fn write_file_with_mode( &self, path: &str, content: &str, mode: WriteMode, expected_hash: Option<&str>, ) -> Result<()>
pub async fn write_file(&self, path: &str, content: &str) -> Result<()>
Sourcepub async fn create_file(&self, path: &str, content: &str) -> Result<()>
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).
pub async fn write_file_with_mode_and_message( &self, path: &str, content: &str, mode: WriteMode, expected_hash: Option<&str>, message: &str, ) -> Result<()>
pub async fn create_file_with_message( &self, path: &str, content: &str, message: &str, ) -> Result<()>
pub async fn edit_file_with_message( &self, path: &str, edits: &str, expected_hash: Option<&str>, dry_run: bool, message: &str, ) -> Result<EditResult>
pub async fn delete_file_with_hash_and_message( &self, path: &str, expected_hash: Option<&str>, message: &str, ) -> Result<()>
pub async fn move_file_with_hash_and_message( &self, from: &str, to: &str, expected_hash: Option<&str>, message: &str, ) -> Result<()>
Sourcepub async fn list_inbound_backlinks(&self, path: &str) -> Result<Vec<String>>
pub async fn list_inbound_backlinks(&self, path: &str) -> Result<Vec<String>>
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).
Sourcepub async fn delete_file_with_link_rewrite_to_stale(
&self,
path: &str,
expected_hash: Option<&str>,
message: &str,
) -> Result<MoveWithLinksResult>
pub async fn delete_file_with_link_rewrite_to_stale( &self, path: &str, expected_hash: Option<&str>, message: &str, ) -> Result<MoveWithLinksResult>
turbovault-oz6: atomic delete + inbound-wikilink wrap-as-stale. Git backend only — legacy refuses loudly (no atomic multi-file primitive).
Sourcepub async fn move_file_with_link_updates(
&self,
from: &str,
to: &str,
expected_hash: Option<&str>,
message: &str,
) -> Result<MoveWithLinksResult>
pub async fn move_file_with_link_updates( &self, from: &str, to: &str, expected_hash: Option<&str>, message: &str, ) -> Result<MoveWithLinksResult>
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).
pub async fn batch_execute_with_message( &self, operations: Vec<BatchOperation>, message: &str, ) -> Result<BatchResult>
pub async fn edit_file( &self, path: &str, edits: &str, expected_hash: Option<&str>, dry_run: bool, ) -> Result<EditResult>
pub async fn delete_file(&self, path: &str) -> Result<()>
pub async fn delete_file_with_hash( &self, path: &str, expected_hash: Option<&str>, ) -> Result<()>
pub async fn move_file(&self, from: &str, to: &str) -> Result<()>
pub async fn move_file_with_hash( &self, from: &str, to: &str, expected_hash: Option<&str>, ) -> Result<()>
pub async fn copy_file(&self, from: &str, to: &str) -> Result<()>
pub async fn batch_execute( &self, operations: Vec<BatchOperation>, ) -> Result<BatchResult>
Trait Implementations§
Source§impl Clone for WriteTools
impl Clone for WriteTools
Source§fn clone(&self) -> WriteTools
fn clone(&self) -> WriteTools
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WriteTools
impl !UnwindSafe for WriteTools
impl Freeze for WriteTools
impl Send for WriteTools
impl Sync for WriteTools
impl Unpin for WriteTools
impl UnsafeUnpin for WriteTools
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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