Skip to content

Commit 2d4f13a

Browse files
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

4 files changed

+276
-132
lines changed

file_store/src/error.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use std::path::{Path, PathBuf};
22

33
use thiserror::Error;
44

5-
use crate::{file_info::FileInfoError, gzipped_framed_file::GzippedFramedFileError};
5+
use crate::{
6+
file_info::FileInfoError, gzipped_framed_file::GzippedFramedFileError,
7+
rolling_file_sink::RollingFileSinkError,
8+
};
69

710
pub use aws_error::AwsError;
811

@@ -35,6 +38,9 @@ pub enum Error {
3538
#[error("error write data to file on disk: {0}")]
3639
FileWriteError(#[from] GzippedFramedFileError),
3740

41+
#[error("rolling file sink error: {0}")]
42+
RollingFileSink(#[from] RollingFileSinkError),
43+
3844
// Generic error wrapper for external (out of that repository) traits implementations.
3945
// Not recommended for internal use!
4046
#[error("external error")]

0 commit comments

Comments
 (0)