Radish alpha
r
rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE
Radicle CI adapter for native CI
Radicle
Git
refactor: rename LogFile to AdminLog
Lars Wirzenius committed 2 years ago
commit 3a56190257eb94ca7d95acf10cdac1f8f4d5435b
parent 7cab669
3 files changed +10 -10
modified src/bin/radicle-native-ci.rs
@@ -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
    }
modified src/config.rs
@@ -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.
modified src/logfile.rs
@@ -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)