MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / execute_file

Method execute_file

atomic-repository/src/repository/switch.rs:197–215  ·  view source on GitHub ↗
(
        &self,
        path: &str,
        content: &[u8],
    )

Source from the content-addressed store, hash-verified

195 }
196
197 fn execute_file(
198 &self,
199 path: &str,
200 content: &[u8],
201 ) -> Result<super::operation::PendingFilesystemEffect, RepositoryError> {
202 let content_hash = Hash::of(content);
203 let effect = self
204 .effect_for_expected_new(path, |value| {
205 matches!(
206 value,
207 EffectValue::File(state)
208 if state.kind != FileKind::Directory && state.content == content_hash
209 )
210 })
211 .ok_or_else(|| RepositoryError::InvalidOperation {
212 message: format!("switch operation omitted file lease for '{path}'"),
213 })?;
214 self.execute_effect(effect, Some(content))
215 }
216
217 fn record(
218 &self,

Callers 1

write_fileMethod · 0.80

Calls 2

execute_effectMethod · 0.80

Tested by

no test coverage detected