Runtime-sink-file-runtime-state
Read combined file and queue runtime state from a RuntimeSink. This helper is the richest file-specific diagnostics API on direct runtime sink values.
Interface
pub fn RuntimeSink::file_runtime_state(self : RuntimeSink) -> RuntimeFileState? {input
self : RuntimeSink- Runtime sink whose file runtime state should be inspected.
output
RuntimeFileState?- Combined file and queue diagnostics when the runtime sink is file-backed, otherwiseNone.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain
Fileruntime variants returnSome(RuntimeFileState::new(sink.state())), so queue metadata stays at its default non-queued shape. QueuedFileruntime variants returnSome(RuntimeFileState)with the wrapped file state plusqueued=true,pending_count=sink.pending_count(), anddropped_count=sink.dropped_count().- Non-file runtime variants return
None. - This helper is richer than
file_state()because it can also surface queued backlog and dropped counts.
How to Use
Here are some specific examples provided.
When Need Rich File Runtime Diagnostics
When support output should include both file and queue state:
let state = sink.file_runtime_state()In this example, callers can inspect availability, failure counters, and queue metrics together.
When Need To Branch On File-backed Runtime Shape
When code should behave differently for file-backed direct sinks:
match sink.file_runtime_state() {
Some(state) => ignore(state)
None => ()
}In this example, the optional return value reflects whether the runtime sink is file-backed.
Error Case
e.g.:
If the runtime sink is not file-backed, the method returns
None.If callers only need raw file status without queue context,
file_state()may be the simpler API.
Notes
Use this helper for the richest file-backed runtime diagnostics on direct sink values.
It is especially useful for queued file sinks where file health and queue state both matter.