Crate xvc_core

Source
Expand description

Xvc Core Library for common operations

Re-exports§

pub use types::hashalgorithm::HashAlgorithm;
pub use types::recheckmethod::RecheckMethod;
pub use types::xvcdigest::content_digest::ContentDigest;
pub use types::xvcdigest::path_collection_digest::PathCollectionDigest;
pub use types::xvcdigest::stdout_digest::StdoutDigest;
pub use types::xvcdigest::url_get_digest::UrlContentDigest;
pub use types::xvcdigest::xvc_metadata_digest::XvcMetadataDigest;
pub use types::xvcdigest::AttributeDigest;
pub use types::xvcdigest::XvcDigest;
pub use types::xvcdigest::XvcDigests;
pub use types::diff::Diff;
pub use types::diff::DiffStore;
pub use types::diff::DiffStore2;
pub use types::diff::DiffStore3;
pub use types::diff::DiffStore4;
pub use types::diff::apply_diff;
pub use types::diff::diff_store;
pub use types::diff::update_with_actual;
pub use types::xvcfiletype::XvcFileType;
pub use types::xvcmetadata::XvcMetadata;
pub use types::xvcpath::TextOrBinary;
pub use types::xvcpath::XvcCachePath;
pub use types::xvcpath::XvcPath;
pub use types::xvcroot::XvcRoot;
pub use error::Error;
pub use error::Result;
pub use util::git;
pub use util::file::all_paths_and_metadata;
pub use util::file::dir_includes;
pub use util::file::glob_includes;
pub use util::file::glob_paths;
pub use util::git::build_gitignore;
pub use util::git::exec_git;
pub use util::git::get_absolute_git_command;
pub use util::git::get_git_tracked_files;
pub use util::git::git_auto_commit;
pub use util::git::git_auto_stage;
pub use util::git::git_checkout_ref;
pub use util::git::git_ignored;
pub use util::git::handle_git_automation;
pub use util::git::inside_git;
pub use util::git::stash_user_staged_files;
pub use util::git::unstash_user_staged_files;
pub use util::pmp::XvcPathMetadataProvider;
pub use util::XvcPathMetadataMap;
pub use xvc_walker as walker;

Modules§

check_ignore
xvc check ignore CLI handling module
error
Error messages for Xvc core crate
root
Get the Xvc root directory for the current project
types
Xvc basic types used across the whole program
util
Various utility functions
walk_parallel
Parallel walk implementation
walk_serial
Serial directory walker without parallelization See [walk_parallel] for parallel version.

Macros§

attribute_digest
Specifies an attribute digest
conf
Binds a type with a configuration key.
debug
Either send XvcOutputLine::Debug to the given channel, or log via log crate
error
Either send a XvcOutputLine::Error value to the given channel, or log via log crate
info
Either send XvcOutputLine::Info to the given channel, or log via log crate
output
Either send XvcOutputLine::Output to the given channel, or print to stdout
panic
Either send XvcOutputLine::Panic to the given channel, or print to stdout
persist
Specifies the store name a type is stored. Usually it’s the string representation of a type. These strings are used to generate store locations for types. They must be unique across the project.
trace
Either send [XvcOutputLine::Trace] to the given channel, or log via log crate
uwo
Unwrap an option, and if it is an error, send it to the given channel and panic. This is mostly to be used in for_each blocks, where the error is not propagated.
uwr
Unwrap the result of an expression, and if it is an error, send it to the given channel and panic. This is mostly to be used in for_each blocks, where the error is not propagated.
warn
Either send XvcOutputLine::Warn to the given channel, or log via log crate
watch
Debugging macro to print the given expression and its value, with the module, function and line number

Structs§

AbsolutePath
A specialized path type for absolute paths.
EventLog
A series of Event values.
Glob
Glob represents a glob pattern matcher with support for multi-pattern matching.
HStore
This is a HashMap for more random access and less restrictions, no support for serialization
IgnoreRules
Complete set of ignore rules for a directory and its child directories.
PathSync
When multiple threads try to access the same path (especially in cache operations) we get weird race conditions, This structure is to make those operations atomic and thread safe.
R1NStore
RNStore is 1-N RelationStore, where we store one-to-many relationships between two entities. It doesn’t have any semantics except binding two entities together.
R11Store
Associates two XvcStores with two different type of components with a single XvcEntity. It’s like using the same primary key in two database tables.
RMNStore
RMNStore is M-N RelationStore, where we store arbitrary relationships between two entities. It doesn’t have any semantics except binding two entities together.
VStore
This is a tuple-vector for (XvcEntity, T) to enable faster serial access
WalkOptions
What’s the ignore file name and should we add directories to the result?
XvcConfig
Keeps track of all Xvc configuration.
XvcConfigParams
How should we initialize the configuration?
XvcEntity
Describes an entity in Entity Component System-sense.
XvcStore
A database table like store for type T

Enums§

Event
Records add and remove operations of a serializable component T.
MatchResult
Show whether a path matches to a glob rule
PathEvent
An walker-relevant event for changes in a directory. It packs newer std::fs::Metadata if there is.
XvcConfigError
Error enum that uses ThisError. The messages should be self-explanatory, so skipping the docs.
XvcConfigOptionSource
Define the source where an option is obtained
XvcEcsError
Error type for ECS. We allow missing docs, the names should be self-explanatory.
XvcOutputLine
Different channels of outputs Xvc can print
XvcVerbosity
Verbosity levels for Xvc CLI
XvcWalkerError
Error type for Xvc Walker

Constants§

CHANNEL_BOUND
Channel size for crossbeam_channel::bounded used across the library. TODO: This can be configurable for smaller/larger RAM sizes.
GITIGNORE_INITIAL_CONTENT
The initial content for .xvc/.gitignore to hide files in .xvc/
GIT_DIR
The Git directory for a project.
XVCIGNORE_FILENAME
The standard ignore filename
XVCIGNORE_INITIAL_CONTENT
Initial .xvgignore content when a project is initialized
XVC_DIR
The standard metadata directory

Traits§

FromConfigKey
A struct implementing this trait can instantiate itself from XvcConfig.
Storable
Marks the traits as storable in XvcStore
UpdateFromXvcConfig
Trait to update CLI options with defaults from configuration.

Functions§

content_to_patterns
convert a set of rules in content to glob patterns. patterns may come from source. the root directory of all search is in ignore_root.
default_project_config
Creates a new project configuration by writing all default values. This is used when initializing a new project. The repository GUID is created here.
make_polling_watcher
Create a notify::PollWatcher and a crossbeam_channel::Receiver to receive PathEvents. It creates the channel and [PathEventHandler] with its Sender, then returns the Receiver for consumption.
path_metadata_map_from_file_targets
Return path metadata only for the listed files to avoid recursing directories
setup_logging
Init logging if it’s not initialized before. Uses Once to run (non-public fn) init_logging once.
walk_parallel
Walk all child paths under dir and send non-ignored paths to path_sender. Newly found ignore rules are sent through ignore_sender. The ignore file name (.xvcignore, .gitignore, .ignore, …) is set by walk_options.
walk_serial
Walk dir with walk_options, with the given initial ignore_rules. Note that ignore rules are expanded with the rules given in the ignore_filename in walk_options. The result is added to given res_paths to reduce the number of memory inits for vec.

Type Aliases§

SharedHStore
A shared version of HStore for use in multithreaded environments.
SharedXStore
A shared version of XvcStore that we use to pass around for thread safety.
XvcConfigResult
Result type for xvc-config crate
XvcEcsResult
Result type for Xvc ECS functions that may return Error
XvcOutputSender
The channel type to send and receive output/log/debug messages
XvcWalkerResult
Result type for xvc-walker that may also return Error