genpac 0.1.0

Sandbox for Gentoo ebuild development using bubblewrap
// Copyright (C) 2023 Gokul Das B
// SPDX-License-Identifier: GPL-3.0-or-later
//! None Backend
//!
//! This module defines the default None backend for cases where the user hasn't specified a
//! backend in the config file.

use super::{BackendMarker, BackendOps, Snapshot};
use crate::global::ChrootVerified;
use anyhow::Result as AResult;

pub(super) struct NoneMarker;
impl BackendMarker for NoneMarker {}
pub(super) type NoneBackend = Snapshot<NoneMarker>;

const NONEMSG: &str = "No backend specified in config file";

impl BackendOps for NoneBackend {
    fn make_blank(&mut self) -> AResult<()> {
        log::error!("{NONEMSG}");
        anyhow::bail!(NONEMSG);
    }

    fn duplicate(&mut self, _source: ChrootVerified) -> AResult<()> {
        log::error!("{NONEMSG}");
        anyhow::bail!(NONEMSG);
    }

    fn delete(&mut self) -> AResult<()> {
        log::error!("{NONEMSG}");
        anyhow::bail!(NONEMSG);
    }
}