Skip to main content

FileManager

Struct FileManager 

Source
pub struct FileManager {}
Expand description

Manages all the file system interactions

Implementations§

Source§

impl FileManager

Source

pub fn boot_url() -> &'static str

Source

pub async fn from_url(url: &str) -> Result<bool, Error>

Bootstraps the reload manager from a URL.

§Arguments
  • url - The location of the configuration
Source

pub fn file_exists(path: &str) -> bool

Source

pub fn job_folder() -> &'static str

gets the name of the job folder

Source

pub fn is_local() -> &'static str

Source

pub fn job_path() -> &'static str

Gets the root to the root of the job path folder.

Source

pub fn readfile(file_path: String) -> Result<String, Error>

Simple wrapper around the read_to_string

Source

pub fn resolve_quadit_config_location() -> String

Generates the location of the quadit config.

Source

pub fn job_exists(uuid: Uuid) -> bool

Test to see if the job folder exists. Used to validate if this is the first time the job has ran.

§Arguments

uuid - The uuid of the job - Usually xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx.

Source

pub fn quadit_home() -> String

Gets the home location of the user currently running quadit

Source

pub fn load_quadit_config() -> Result<String, Error>

Loads the quadit config based on the resolved location.

Source

pub fn filename_to_unit_name(target_path: &str) -> Result<String, String>

converts the quadlet file name to a service name with some additional checks.

Source

pub fn container_file_deployed(job_path: &str, target_path: &str) -> bool

Test to see if a file exists in the container deployment location Currently ~/.config/containers/systemd/ but this may be expanded in later releases.

§Arguments

job_path - The path to the job - Usually jobs/xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx. target_path - The path of the file in the git repo

Source

pub fn get_files_in_directory(path: &str) -> Result<Vec<String>, Error>

Collects a directory contents as a vector of strings

Source

pub fn are_identical(file_name1: &str, file_name2: &str) -> bool

Compare the bytes of two files incrementally to see if they differ.

§Arguments

file_name1 - The first file to compare. file_name2 - The second file to compare.

Source

pub fn deploy_container_file( job_path: &str, target_path: &str, ) -> Result<String, String>

Copy to the users ~/.config/containers/systemd/

§Arguments

job_path - The location that the repo has been copied to target_path - The location of the .container file in the repo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more