Files
BitLogger/docs/api/runtime-sink-file-flush-failures.md
T
2026-06-13 23:14:22 +08:00

1.9 KiB

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

Runtime-sink-file-flush-failures

Read the number of flush failures recorded by a file-backed RuntimeSink. This helper is useful for direct runtime diagnostics around durability-path problems.

Interface

pub fn RuntimeSink::file_flush_failures(self : RuntimeSink) -> Int {

input

  • self : RuntimeSink - Runtime sink whose flush-failure counter should be inspected.

output

  • Int - Number of recorded flush failures.

Explanation

Detailed rules explaining key parameters and behaviors

  • Plain File runtime variants report the wrapped FileSink flush-failure count.
  • QueuedFile runtime variants forward the metric from the wrapped inner FileSink.
  • 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 Durability-path Diagnostics

When support output should show flush-path instability:

let count = sink.file_flush_failures()

In this example, the runtime sink exposes whether file flush attempts have been failing.

When Inspect Effects Of Auto-flush Policy

When runtime durability tuning should be inspected operationally:

ignore(sink.file_flush_failures())

In this example, callers can correlate flush failures with direct runtime file policy choices.

Error Case

e.g.:

  • If the runtime sink is not file-backed, the method returns 0.

  • If callers need current policy and counters together, file_state() is the better API.

Notes

  1. Use this helper when direct runtime flush-path reliability matters.

  2. Pair it with file_auto_flush() and file_flush() when diagnosing durability behavior.