Commit 2d4f13a
authored
Rolling File Sink (#1121)
* Add RollingFileSink
Handles knowing when to roll a file based on time or space.
Also creates a new GzippedFramedFile when the first write comes
through. It ensures there is always an active file, making the act of
writing to it much easier.
* Replace manual Sink management with RollingFileSink
This file sink is now mostly conerned with collectig files for the
manifest, or forwarding to FileUpload.
* Remove unnecessary `tokio::select!`
* simplify init
there are patterns for reading from streams until they’re exhausted,
let’s use them.
* Avoid unwrap with early return
* avoid dangling false return with combinators
* Fix typo in inspect
We could also instrument the function, but we don’t have a strong usage
of spans in this library yet. I feel if we get to a point where we have
more complete span tracing for this library, we could come back and
consider properly instrumenting functions like
```rs
#[instrument(
skip(self),
err(Debug),
fields(action = “write”, prefix = self.prefix)
)]
```
Until then, it kind of feels like an abuse of the macro.1 parent 8a061bc commit 2d4f13a
File tree
4 files changed
+276
-132
lines changed- file_store/src
4 files changed
+276
-132
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
0 commit comments