pub struct ProvenanceLedger { /* private fields */ }Implementations§
Source§impl ProvenanceLedger
impl ProvenanceLedger
pub fn new(path: impl Into<PathBuf>) -> Self
Sourcepub fn append(&self, entry: &ProvenanceEntry) -> Result<()>
pub fn append(&self, entry: &ProvenanceEntry) -> Result<()>
Append one entry as a single JSON line. Atomic via flock. Creates the parent directory if missing.
Note on the open mode: we deliberately use write(true) +
explicit seek(SeekFrom::End(0)) rather than append(true).
On Windows, append(true) requests FILE_APPEND_DATA only,
which is not sufficient for LockFileEx (used internally by
fs2::FileExt::lock_exclusive) — Windows demands GENERIC_WRITE
access, otherwise the lock call fails with ERROR_ACCESS_DENIED.
Manual seek-to-end gives us append semantics on every platform
while keeping the flock contract intact.
Auto Trait Implementations§
impl Freeze for ProvenanceLedger
impl RefUnwindSafe for ProvenanceLedger
impl Send for ProvenanceLedger
impl Sync for ProvenanceLedger
impl Unpin for ProvenanceLedger
impl UnsafeUnpin for ProvenanceLedger
impl UnwindSafe for ProvenanceLedger
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
Mutably borrows from an owned value. Read more