pub struct InlineChain { /* private fields */ }Expand description
One trace.jsonl’s chain, shared by every appender holding the same file.
Every append locks the state, takes the file’s flock, re-reads the real last line when the
file’s length is not what this state last wrote (another process appended, or this is the
first write), terminates a torn last line, and writes its line with "prev_hash" in one
write_all.
Implementations§
Source§impl InlineChain
impl InlineChain
Sourcepub fn open(root: &WorkdirRoot, rel: &str) -> Result<Arc<Self>>
pub fn open(root: &WorkdirRoot, rel: &str) -> Result<Arc<Self>>
The chain of rel in root, opened for appending without following a link, and shared
with every other holder of the same file in this process.
Sourcepub fn append_event(&self, event: &impl Serialize) -> Result<()>
pub fn append_event(&self, event: &impl Serialize) -> Result<()>
Appends event as one line ending in "prev_hash".
Sourcepub fn append_json(&self, json: &str) -> Result<()>
pub fn append_json(&self, json: &str) -> Result<()>
Appends one serialized JSON object as one line ending in "prev_hash".
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for InlineChain
impl Forget for InlineChain
impl Move for InlineChain
impl RefUnwindSafe for InlineChain
impl Send for InlineChain
impl Sync for InlineChain
impl Unpin for InlineChain
impl UnsafeUnpin for InlineChain
impl UnwindSafe for InlineChain
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
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> ⓘ
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 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> ⓘ
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