Skip to content

Commit

Permalink
Change FileSinkBuilder to not depend on FileType
Browse files Browse the repository at this point in the history
  • Loading branch information
bbalser committed Jun 23, 2023
1 parent be6ba55 commit 8c8ad6b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions file_store/src/file_sink.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -69,14 +69,17 @@ pub struct FileSinkBuilder {
}

impl FileSinkBuilder {
pub fn new(
file_type: FileType,
pub fn new<P>(
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,
Expand Down Expand Up @@ -503,7 +506,7 @@ fn file_name(path_buf: &Path) -> Result<String> {
#[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;
Expand Down

0 comments on commit 8c8ad6b

Please sign in to comment.