pub async fn write_atomic(
location: &StorageLocation,
rel_path: &Path,
contents: &[u8],
) -> StorageResult<()>Expand description
Write contents to rel_path inside location using an atomic write.
This performs a write-then-rename sequence on the local filesystem:
it writes the payload to a temporary file next to the target path,
syncs the file, and then renames it into place to provide an atomic
replacement. Currently only StorageLocation::Local is supported.
§Parameters
location: the table root location to resolve the relative path.rel_path: the relative path (underlocation) to write the file to.contents: the bytes to write.
§Errors
Returns StorageError::LocalIo when filesystem I/O fails; other internal
helpers may add context to the returned error.