Struct cindy::Cindy

source ·
pub struct Cindy { /* private fields */ }

Implementations§

source§

impl Cindy

source

pub async fn new(options: &Options) -> Result<Self>

Create or open Cindy project, depending on command.

source

pub fn root(&self) -> &Path

Root of Cindy project.

source

pub fn cindy_folder(&self) -> PathBuf

Cindy folder

source

pub fn config_path(&self) -> PathBuf

source

pub fn database_path(&self) -> PathBuf

source

pub fn data_path(&self) -> PathBuf

source

pub fn thumbs_path(&self) -> PathBuf

source

pub fn config(&self) -> &Arc<Config>

Config of Cindy.

source

pub fn hasher(&self) -> &Arc<dyn Digester + Send + Sync>

Hasher, this is used to calculate hashes of files.

source

pub async fn database(&self) -> OwnedMutexGuard<Database>

Get a handle to the database.

source

pub fn hash_path(&self, hash: &Hash) -> PathBuf

Given a hash, determine a path.

source

pub async fn initialize(path: &Path, config: &Config) -> Result<Self>

Initialize new Cindy project.

source

pub async fn load(path: &Path) -> Result<Self>

Load Cindy project, will parse Config file.

source

pub async fn open(path: &Path, config: &Config) -> Result<Self>

Open Cindy project with supplied configuration.

source

pub async fn discover(path: &Path) -> Result<Self>

Discover a Cindy project starting at the supplied path.

source§

impl Cindy

source

pub async fn command_add(&self, command: &AddCommand) -> Result<()>

source

pub async fn add_files(&self, files: &[PathBuf], recursive: bool) -> Result<()>

source

pub fn hash_file(&self, path: &Path) -> Result<BoxHash>

Given a file, compute it’s hash.

source

pub fn data_add(&self, file: &Path, hash: &Hash) -> Result<()>

Given a path and a hash, add it to the data index.

source

pub async fn scan_metadata( &self, files: BTreeMap<BoxHash, (Metadata, BTreeSet<PathBuf>)> ) -> Result<BTreeMap<BoxHash, (Vec<Tag>, BTreeSet<PathBuf>)>>

Scan file metadata.

source

pub async fn skip_known( &self, files: BTreeMap<BoxHash, (Metadata, BTreeSet<PathBuf>)> ) -> Result<BTreeMap<BoxHash, (Metadata, BTreeSet<PathBuf>)>>

Skip known files

source

pub async fn hash_files( &self, files: BTreeMap<PathBuf, Metadata> ) -> Result<BTreeMap<BoxHash, (Metadata, BTreeSet<PathBuf>)>>

Hash files.

source

pub async fn list_files( &self, paths: &[PathBuf], recursive: bool ) -> Result<BTreeMap<PathBuf, Metadata>>

List files (recursively)

source§

impl Cindy

source

pub async fn command_query(&self, command: &QueryCommand) -> Result<()>

source§

impl Cindy

source

pub async fn command_serve(&self, command: &ServeCommand) -> Result<()>

source§

impl Cindy

source

pub async fn command_tags(&self, command: &TagsCommand) -> Result<()>

source

pub async fn command_tags_delete( &self, _command: &TagsDeleteCommand ) -> Result<()>

source

pub async fn command_tags_rename( &self, _command: &TagsRenameCommand ) -> Result<()>

source

pub async fn command_tags_create( &self, command: &TagsCreateCommand ) -> Result<()>

source

pub async fn command_tags_list(&self, command: &TagsListCommand) -> Result<()>

source§

impl Cindy

source

pub async fn command(&self, command: &Command) -> Result<()>

source§

impl Cindy

source

pub fn router(&self) -> Router

Trait Implementations§

source§

impl Clone for Cindy

source§

fn clone(&self) -> Cindy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Cindy

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cindy

§

impl Send for Cindy

§

impl Sync for Cindy

§

impl Unpin for Cindy

§

impl !UnwindSafe for Cindy

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> FromRef<T> for Twhere T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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 Twhere 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> Invalidatable<()> for T

source§

fn invalidated_by(&self, _mutation: &M) -> bool

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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