::stf::fs::create_dir_all() takes any ref to `Path`, which is what we
have here, so we can leave out the allocation of a new PathBuf object
here.
Also remove the match by a `if let Some(_)`, which increases the
readability a bit.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
With this change, the cache is tested before accessing the filesystem,
which probably increases the speed if the cache has the entry, because
we avoid the slow IO operation.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This fixes a really ugly bug where the in-memory backend for the store
did not remove the entry from the in-memory hashmap on "move", but
simply copied it from the old location to the new one.
That caused tests to fail after the fixes introduced for the
Store::get() function which checked the filesystem and the internal
cache whether an entry exists before the actual "get" operation, because
an old entry would still exist after a move (only in the testcases).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Fixes: 09e8619cf5 ("libimagstore: Move from error-chain to failure")
This changes the implementation of Debug for the FileLockEntry to be
more explanatory of how the entry actually looks like. It does not only
print the path of the store anymore, but also the location of the Entry.
Printing header and content would be still too much, tho.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch simplifies the code to be not three nested matches but rather
one match and then some function chaining.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This does optimize the implementation of the list command implementation
(code-structure wise, not performance wise).
Functionality not altered.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
In the imag-contact crate we had to rewrite the ask_continue!{} macro
as a function for less headache, but besides that this is a rather
straight-forward patch for adapting to the new interface.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This way we can control where the input comes from and the output goes
to (like we want to with libimagrt).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This merge adds logging capabilities to the `imag` binaries.
For this, the libimagrt had to get a new compiletime feature which makes
the logging initialization public for this usecase.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This actually caused an error.
When executing `imag ids --verbose trace` for example, the `imag` binary
got the default value (as in `--verbose info`) supplied from clap. So
far, so good. Problem is that the implementation then forwarded that
flag to `imag-ids`, which resulted in the `--verbose` flag to be passed
_two times_ to `imag-ids`.
Somehow this is really strange, but it does not really matter. First of
all: A default of "Info" is still too high IMO. Default should be
warnings and errors, but no information printed. We like silent tools,
don't we?
Second is that the commandline argument forwarding mechanism of `imag`
is broken and this was a fix which helped debugging of the brokenness,
so this is acutally a step forward in this regard as well.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This is a bugfix. The old implementation did not forward simple
commandline flags (as in `--debug`, arguments with no value) because it
only used `ArgMatches::value_of()`. But if there is no value, the method
returns `None` and the flag is not forwarded.
This patch fixes that issue.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This feature is required for the `imag` binary. It allows the binary to
use the imag internal logger for logging its own log output.
We need to be able to initialize the logger from an external module (in
all imag modules, the Runtime::new() implementation takes care of this,
but as we cannot use that in the `imag` binary itself, we allow this
method to be public behind a feature flag).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
I'm so happy to finally be able to merge this patchset. After four days
of work, we finally convert the whole codebase from error_chain error
handling to failure.
Dependencies are now imported from "master" or even "failure" branches,
which will result in dependencies breaking the imag build as soon as the
"failure" branches vanish or the master breaks on the dependencies, but
we do it anyways until we are in release-shape.
Thanks goes to Kai for emotional support during the last weekend while
developing this patchset.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>