Files
BitLogger/docs/api/file-sink-open-failures.md
T
2026-06-13 22:29:11 +08:00

1.7 KiB

name, group, category, update-time, description, key-word
name group category update-time description key-word
file-sink-open-failures api sink 20260613 Read the number of open failures recorded by a FileSink.
file
sink
open
public

File-sink-open-failures

Read the number of open failures recorded by a FileSink. This helper is useful for diagnosing direct file-availability or reopen problems.

Interface

pub fn FileSink::open_failures(self : FileSink) -> Int {

input

  • self : FileSink - File sink whose open-failure counter should be inspected.

output

  • Int - Number of recorded open failures.

Explanation

Detailed rules explaining key parameters and behaviors

  • The sink reports its recorded open-failure count directly.
  • The counter is cumulative until reset.
  • This helper is observation-only and does not mutate sink state.

How to Use

Here are some specific examples provided.

When Need File Availability Diagnostics

When operators should see whether file open or reopen failed:

let count = sink.open_failures()

In this example, the direct sink exposes the open-failure metric directly.

When Validate Recovery Logic

When tests or support code should inspect whether reopen attempts failed:

ignore(sink.open_failures())

In this example, the counter helps confirm whether file-open problems occurred during runtime.

Error Case

e.g.:

  • If callers need the full file status snapshot rather than one counter, state() is the better API.

  • This counter does not tell you which particular reopen attempt failed.

Notes

  1. Use this helper for focused direct file-open diagnostics.

  2. Pair it with reopen(...) and is_available() during recovery analysis.