Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make logrotate_fs a generator #1066

Merged
merged 9 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY . /app
RUN cargo build --release --locked --bin lading

FROM docker.io/debian:bullseye-20240701-slim
RUN apt-get update && apt-get install -y libfuse3-dev=3.10.3-2 && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/lading /usr/bin/lading

# smoke test
Expand Down
13 changes: 12 additions & 1 deletion lading/src/generator/file_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//!

pub mod logrotate;
pub mod model;
pub mod logrotate_fs;
pub mod traditional;

use std::str;
Expand All @@ -31,6 +31,9 @@ pub enum Error {
/// Wrapper around [`logrotate::Error`].
#[error(transparent)]
Logrotate(#[from] logrotate::Error),
/// Wrapper around [`logrotate_fs::Error`].
#[error(transparent)]
LogrotateFs(#[from] logrotate_fs::Error),
}

/// Configuration of [`FileGen`]
Expand All @@ -42,6 +45,8 @@ pub enum Config {
Traditional(traditional::Config),
/// See [`logrotate::Config`].
Logrotate(logrotate::Config),
/// See [`logrotate_fs::Config`].
LogrotateFs(logrotate_fs::Config),
}

#[derive(Debug)]
Expand All @@ -54,6 +59,8 @@ pub enum FileGen {
Traditional(traditional::Server),
/// See [`logrotate::Server`] for details.
Logrotate(logrotate::Server),
/// See [`logrotate_fs::Server`] for details.
LogrotateFs(logrotate_fs::Server),
}

impl FileGen {
Expand All @@ -78,6 +85,9 @@ impl FileGen {
Self::Traditional(traditional::Server::new(general, c, shutdown)?)
}
Config::Logrotate(c) => Self::Logrotate(logrotate::Server::new(general, c, shutdown)?),
Config::LogrotateFs(c) => {
Self::LogrotateFs(logrotate_fs::Server::new(general, c, shutdown)?)
}
};
Ok(srv)
}
Expand All @@ -98,6 +108,7 @@ impl FileGen {
match self {
Self::Traditional(inner) => inner.spin().await?,
Self::Logrotate(inner) => inner.spin().await?,
Self::LogrotateFs(inner) => inner.spin().await?,
};

Ok(())
Expand Down
Loading
Loading