1.9 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| runtime-sink-file-open-failures | api | runtime | 20260613 | Read the number of open failures recorded by a file-backed RuntimeSink. |
|
Runtime-sink-file-open-failures
Read the number of open failures recorded by a file-backed RuntimeSink. This helper is useful for direct runtime diagnostics around file availability and reopen behavior.
Interface
pub fn RuntimeSink::file_open_failures(self : RuntimeSink) -> Int {
input
self : RuntimeSink- Runtime sink whose open-failure counter should be inspected.
output
Int- Number of recorded open failures.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain
Fileruntime variants report the wrappedFileSinkopen-failure count. QueuedFileruntime variants forward the metric from the wrapped innerFileSink.- Non-file runtime variants return
0. - The counter is cumulative until
file_reset_failure_counters()clears it.
How to Use
Here are some specific examples provided.
When Need File Availability Diagnostics
When direct runtime support output should show whether file open or reopen failed:
let count = sink.file_open_failures()
In this example, the runtime sink exposes the open-failure metric directly.
When Validate Recovery Logic
When recovery code should inspect whether reopen attempts failed:
ignore(sink.file_open_failures())
In this example, the counter helps confirm whether file-open problems occurred during runtime.
Error Case
e.g.:
-
If the runtime sink is not file-backed, the method returns
0. -
If callers need the full file status snapshot rather than one counter,
file_state()is the better API.
Notes
-
Use this helper for focused direct runtime file-open diagnostics.
-
Pair it with
file_reopen(...)andfile_available()during recovery analysis.