📝 Add 1.0.1(0.6.1) change notes for wide file rotation

This commit is contained in:
Nanaloveyuki
2026-07-05 21:32:11 +08:00
parent 6e3cc165b6
commit b90481186f
14 changed files with 234 additions and 10 deletions
+15 -2
View File
@@ -33,8 +33,9 @@ pub fn file_rotation_config_to_json(config : FileRotation) -> @json_parser.JsonV
Detailed rules explaining key parameters and behaviors
- The output includes `max_bytes` and `max_backups`.
- Both numeric fields are exported as JSON numbers.
- The output always includes `max_bytes` and `max_backups`.
- Both of those compatibility fields are exported as JSON numbers.
- If the policy carries a wide threshold from `file_rotation_i64(...)`, the output also includes `max_bytes_i64` as a JSON string for exact roundtrip transport.
- This helper serializes the rotation config object itself rather than sink availability, failure counters, or file state.
- The same JSON shape is reused by `sink_config_to_json(...)`, file sink state export helpers, and larger logger config serialization paths.
@@ -61,6 +62,16 @@ let rotation_json = file_rotation_config_to_json(rotation)
In this example, callers can carry the nested rotation shape without exporting a full sink config.
#### When Need Exact Wide-threshold Roundtrip
When a native large-file policy should preserve the original `Int64` threshold in JSON:
```moonbit
let rotation = file_rotation_i64(4294967296L, max_backups=2)
let rotation_json = file_rotation_config_to_json(rotation)
```
In this example, the JSON value includes the compatibility `max_bytes` view plus `max_bytes_i64` as a string.
### Error Case
e.g.:
@@ -73,3 +84,5 @@ e.g.:
1. Use this helper when downstream code expects `JsonValue` rather than a typed `FileRotation` value.
2. Pair it with `file_rotation(...)` when building rotation policy in code before export.
3. For `file_rotation_i64(...)`, treat `max_bytes_i64` as the exact roundtrip field and `max_bytes` as the compatibility view.