Skip to main content

OriginImportArgs

Struct OriginImportArgs 

Source
pub struct OriginImportArgs {
Show 14 fields pub input: PathBuf, pub to: Option<PathBuf>, pub move_source: bool, pub bundle: Option<PathBuf>, pub force: bool, pub follow_symlinks: bool, pub exclude: Vec<String>, pub subfolder: Option<String>, pub json: bool, pub optimize: bool, pub chunk_avg: Option<u64>, pub chunk_min: Option<u64>, pub chunk_max: Option<u64>, pub dry_run: bool,
}
Expand description

decdn origin import — seed a cache origin store from a local file or tree.

Fields§

§input: PathBuf

Local file or directory to import. A directory is walked recursively (see --follow-symlinks / --exclude); every regular file becomes a content-addressed blob in the target.

§to: Option<PathBuf>

Directory to populate — a local filesystem origin store rooted here, created if absent. This is the only write backend; pass the path directly (--to /var/lib/decdn/origin), with no scheme prefix.

To populate an S3 origin, import to a local directory and then aws s3 sync <dir> s3://<bucket>/<prefix>: the fs and S3 object layouts are byte-identical, so the sync needs no renaming. An s3:// or http(s):// value is rejected with that recipe rather than treated as a path.

Required unless --dry-run.

A PathBuf, not a String, so a non-UTF-8 directory path is accepted on Unix like --input is. Prefix sniffing (s3:// / http(s):// / fs:) runs on the UTF-8 view; a non-UTF-8 path cannot be one of those, so it is unambiguously a filesystem directory.

§move_source: bool

Move each source file into the target instead of copying it. Across filesystems this falls back to copy-then-unlink. A source whose content is already present in the target is removed too (the blob is there).

§bundle: Option<PathBuf>

When importing a directory, also write the canonical bundle manifest to this file (in addition to importing the manifest blob into the target). Ignored for a single-file import.

§force: bool

Overwrite a target object even when one already exists at its hash. By default an existing object is left in place (content-addressed: the same hash is the same bytes); a size mismatch is refused unless --force.

§follow_symlinks: bool

Follow symlinks during a directory walk. Off by default. Even when on, a symlink resolving outside the input root is a hard error: a manifest’s relative-path field cannot describe an external target.

§exclude: Vec<String>

Glob pattern of paths to exclude during a directory walk, matched against the POSIX relative path (a/b.txt, never the absolute path). Repeatable — every pattern is OR-ed together.

§subfolder: Option<String>

Prefix every manifest entry’s path with this folder, so a bundle pull materializes the whole bundle under one directory (<out>/<subfolder>/…) rather than spilling its files directly into the output root. Must be a relative POSIX path with / separators — .., absolute paths, root prefixes, and backslashes are rejected; nesting (a/b) is allowed. Applies to a single-file import too (the one entry becomes <subfolder>/<name>).

§json: bool

Emit a one-line JSON status report instead of a human summary. Written to stdout normally; under --dry-run it goes to stderr, because stdout then carries the canonical manifest bytes. origin is the --to target, or the literal (dry-run) when a dry run runs without --to. Shape: {"imported":<n>,"bytes":<total>,"origin":"<target>","files":{"<path>":"b3:<hex>",...},"bundle_hash":"b3:<hex>"|null,"moved":<bool>,"optimized":<bool>,"chunks_total":<n>,"skipped_symlinks":<n>}.

§optimize: bool

Content-defined-chunk each file and record the chunk boundaries as {hash,size} hints in the manifest entry; each file is still stored as one whole-file blob. A pull uses the hints to splice ranges it already holds instead of re-fetching them. Off by default (no hints).

§chunk_avg: Option<u64>

Target average chunk size (--optimize only). The primary dial. Must be a power of two, at most 4 MiB (fastcdc’s ceiling). Defaults to 4 MiB when --optimize is set (applied in the import wiring, not by clap, so an explicit --chunk-avg without --optimize is a detectable error).

§chunk_min: Option<u64>

Minimum chunk size override (--optimize only). Defaults to avg/4. At least 1 MiB (the payment interval), at most 1 MiB (fastcdc’s ceiling).

§chunk_max: Option<u64>

Maximum chunk size override (--optimize only). Defaults to 2*avg. At most 16 MiB (fastcdc’s ceiling).

§dry_run: bool

Compute and emit the manifest without writing any blobs. Prints the canonical manifest bytes to stdout (status goes to stderr). Makes --to optional — this is the local “just make me a manifest” path.

Trait Implementations§

Source§

impl Args for OriginImportArgs

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Debug for OriginImportArgs

Source§

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

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for OriginImportArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T
where T: Send,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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