2.4 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| runtime-sink-file-rotation-config | api | runtime | 20260613 | Read the current rotation configuration used by a file-backed RuntimeSink. |
|
Runtime-sink-file-rotation-config
Read the current rotation configuration used by a file-backed RuntimeSink. This helper exposes active direct runtime rotation parameters when rotation is enabled.
The returned FileRotation value is owned by src/file_model; this method belongs to the runtime facade layer and reads rotation policy through src/runtime over file-backed variants that ultimately use src/file_runtime.FileSink.
Interface
pub fn RuntimeSink::file_rotation_config(self : RuntimeSink) -> FileRotation? {
input
self : RuntimeSink- Runtime sink whose file rotation config should be inspected.
output
FileRotation?- Current rotation config, orNoneif rotation is disabled or the sink is not file-backed.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain
Fileruntime variants return the current rotation config from the wrappedFileSink. QueuedFileruntime variants forward the config from the wrapped innerFileSink.- The returned rotation object itself is the shared
@file_model.FileRotationmodel, not a runtime-owned concrete type. - Non-file runtime variants return
None. - This helper is useful when callers need the active direct runtime policy rather than only a boolean flag.
How to Use
Here are some specific examples provided.
When Need Direct Runtime Rotation Parameters
When diagnostics should include the active file rotation policy:
let rotation = sink.file_rotation_config()
In this example, the runtime sink exposes live rotation parameters directly.
When Branch On Optional Rotation Presence
When code should react differently for rotating file sinks:
match sink.file_rotation_config() {
Some(cfg) => ignore(cfg)
None => ()
}
In this example, the optional return shape reflects whether rotation is active.
Error Case
e.g.:
-
If the runtime sink is not file-backed, the method returns
None. -
If callers only need to know whether rotation is enabled,
file_rotation_enabled()is the simpler API.
Notes
-
Use this helper when current direct runtime rotation parameters matter.
-
It is useful after policy updates or recovery flows.