From 8c8ad6b0fa12c850fc0c89340c9371d17a0348eb Mon Sep 17 00:00:00 2001 From: Brian Balser Date: Fri, 23 Jun 2023 11:44:11 -0400 Subject: [PATCH] Change FileSinkBuilder to not depend on FileType --- file_store/src/file_sink.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/file_store/src/file_sink.rs b/file_store/src/file_sink.rs index 51a26c1d0..709df524c 100644 --- a/file_store/src/file_sink.rs +++ b/file_store/src/file_sink.rs @@ -1,4 +1,4 @@ -use crate::{file_upload, Error, FileType, Result}; +use crate::{file_upload, Error, Result}; use async_compression::tokio::write::GzipEncoder; use bytes::Bytes; use chrono::{DateTime, Duration, Utc}; @@ -69,14 +69,17 @@ pub struct FileSinkBuilder { } impl FileSinkBuilder { - pub fn new( - file_type: FileType, + pub fn new

( + prefix: P, target_path: &Path, metric: &'static str, shutdown_listener: triggered::Listener, - ) -> Self { + ) -> Self + where + P: ToString, + { Self { - prefix: file_type.to_string(), + prefix: prefix.to_string(), target_path: target_path.to_path_buf(), tmp_path: target_path.join("tmp"), max_size: 50_000_000, @@ -503,7 +506,7 @@ fn file_name(path_buf: &Path) -> Result { #[cfg(test)] mod tests { use super::*; - use crate::{file_source, FileInfo}; + use crate::{file_source, FileInfo, FileType}; use futures::stream::StreamExt; use std::str::FromStr; use tempfile::TempDir;