pub struct LocalOutputLog { /* private fields */ }Expand description
A sink’s accumulating list of the local files it has opened.
Shared shape for every local-file sink (and for third-party ones): dedup by
path, pre_existing fixed by the first open of each path, insertion
order preserved for stable reporting. Cheap enough to call on every open —
a file open already costs a syscall.
Poisoned-lock safety: the accumulator is provenance metadata, never on the data path, so a poisoned mutex degrades to “record nothing” rather than panicking a sink mid-write. A lost record means the GC does not know about the file and leaves it on disk — the safe direction.
Implementations§
Source§impl LocalOutputLog
impl LocalOutputLog
pub fn new() -> Self
Sourcepub fn record_open(&self, path: impl Into<PathBuf>, pre_existing: bool)
pub fn record_open(&self, path: impl Into<PathBuf>, pre_existing: bool)
Record that the sink opened path, taking pre_existing from a probe
run before the open (see probe_pre_existing).
Idempotent per path: a re-open (the per-page flush() → reopen cycle the
file sinks perform, or a later run truncating the same path) keeps the
classification captured the first time.
Sourcepub fn record_open_with(
&self,
path: impl Into<PathBuf>,
pre_existing: bool,
truncates: bool,
)
pub fn record_open_with( &self, path: impl Into<PathBuf>, pre_existing: bool, truncates: bool, )
record_open, also saying whether this first open
truncates the file (see LocalOutput::replaced). First open wins for
both flags.
Sourcepub fn record_open_probing(&self, path: impl Into<PathBuf>)
pub fn record_open_probing(&self, path: impl Into<PathBuf>)
Record a first open of path, probing the filesystem for
pre_existing only if the path has not been recorded yet.
This is the entry point for sinks whose open path is async or runs inside
spawn_blocking: it keeps the stat off the hot path once the file is
known, and it cannot reclassify an already-recorded path.
Sourcepub fn record_open_probing_with(
&self,
path: impl Into<PathBuf>,
truncates: bool,
)
pub fn record_open_probing_with( &self, path: impl Into<PathBuf>, truncates: bool, )
record_open_probing for a first open that
truncates the file when truncates is set (see LocalOutput::replaced).
Sourcepub fn snapshot(&self) -> Vec<LocalOutput>
pub fn snapshot(&self) -> Vec<LocalOutput>
The files recorded so far, in first-seen order.
Trait Implementations§
Source§impl Debug for LocalOutputLog
impl Debug for LocalOutputLog
Auto Trait Implementations§
impl !Freeze for LocalOutputLog
impl RefUnwindSafe for LocalOutputLog
impl Send for LocalOutputLog
impl Sync for LocalOutputLog
impl Unpin for LocalOutputLog
impl UnsafeUnpin for LocalOutputLog
impl UnwindSafe for LocalOutputLog
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request