refactor: rename LogFile to AdminLog

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2024-01-15 18:00:52 +02:00
parent 7cab669cca
commit 3a56190257
3 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ use radicle_ci_broker::msg::{Id, Oid, Request, RunId, RunResult};
use radicle_native_ci::{
config::{Config, ConfigError},
logfile::{LogError, LogFile},
logfile::{AdminLog, LogError},
msg::{
read_request, write_errored, write_failed, write_succeeded, write_triggered,
NativeMessageError,
@@ -81,7 +81,7 @@ fn fallible_main() -> Result<(), NativeError> {
fn fallible_main_inner(
config: &Config,
logfile: &mut LogFile,
logfile: &mut AdminLog,
builder: &mut RunInfoBuilder,
) -> Result<(), NativeError> {
let (run_id, run_dir) = mkdir_run(config)?;
@@ -154,7 +154,7 @@ struct Runner<'a> {
repo: Id,
commit: Oid,
src: PathBuf,
log: &'a mut LogFile,
log: &'a mut AdminLog,
run_log: RunLog,
timeout: Option<usize>,
builder: &'a mut RunInfoBuilder,
@@ -252,7 +252,7 @@ struct RunnerBuilder<'a> {
repo: Option<Id>,
commit: Option<Oid>,
src: Option<PathBuf>,
log: Option<&'a mut LogFile>,
log: Option<&'a mut AdminLog>,
run_log: Option<RunLog>,
timeout: Option<usize>,
builder: Option<&'a mut RunInfoBuilder>,
@@ -284,7 +284,7 @@ impl<'a> RunnerBuilder<'a> {
self
}
fn log(mut self, log: &'a mut LogFile) -> Self {
fn log(mut self, log: &'a mut AdminLog) -> Self {
self.log = Some(log);
self
}
+3 -3
View File
@@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
use serde::Deserialize;
use crate::logfile::{LogError, LogFile};
use crate::logfile::{AdminLog, LogError};
const DEFAULT_TIMEOUT: usize = 3600;
@@ -30,8 +30,8 @@ impl Config {
Ok(config)
}
pub fn open_log(&self) -> Result<LogFile, ConfigError> {
Ok(LogFile::open(&self.log)?)
pub fn open_log(&self) -> Result<AdminLog, ConfigError> {
Ok(AdminLog::open(&self.log)?)
}
/// Read configuration specification from a file.
+2 -2
View File
@@ -5,12 +5,12 @@ use std::{
};
#[derive(Debug)]
pub struct LogFile {
pub struct AdminLog {
filename: PathBuf,
file: File,
}
impl LogFile {
impl AdminLog {
pub fn open(filename: &Path) -> Result<Self, LogError> {
let file = OpenOptions::new()
.append(true)