Commit Graph

5840 Commits

Author SHA1 Message Date
Matthias Beyer 860c58cbdf Add ID reporting in imag-log 2018-11-06 20:35:18 +01:00
Matthias Beyer eceae358f8 Add ID reporting in imag-notes 2018-11-06 20:35:18 +01:00
Matthias Beyer 2ca6be8322 Add id reporting in imag-diary 2018-11-06 20:35:18 +01:00
Matthias Beyer 8523ae2120 Add id reporting in imag-contact 2018-11-06 20:34:46 +01:00
Matthias Beyer 344aae5f92 Add ID reporting in imag-bookmark 2018-11-06 20:33:30 +01:00
Matthias Beyer d1f087eb57 Change libimag{bookmark, entrylink} external linking
...to report newly created entries, so that we can re-use these new
entries in the library-using code (for example for ID reporting).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:33:30 +01:00
Matthias Beyer 1e6d58bf4c Add ID reporting in imag-view 2018-11-06 20:33:30 +01:00
Matthias Beyer d3400167df Add ID reporting in imag-tag 2018-11-06 20:33:30 +01:00
Matthias Beyer aef969f8bb Add ID reporting in imag-link 2018-11-06 20:33:30 +01:00
Matthias Beyer 4e5315b0e5 Add ID reporting in imag-grep 2018-11-06 20:33:30 +01:00
Matthias Beyer ff809a3750 Add ID reporting in imag-gps 2018-11-06 20:33:30 +01:00
Matthias Beyer 3a6443b3ef Add ID reporting in imag-ids
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:33:30 +01:00
Matthias Beyer 274811243f Move imag-view to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer f83d72033f Move imag-tag to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 527e0310ae Move imag-link to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 4856541f5a Move imag-gps to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 70014e04b1 Move imag-ids to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer a805db2a88 Move imag-edit to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 30036d5628 Move imag-category to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 01de94a387 Move imag-annotate to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer c1c74973e3 Implement ID providing in libimagrt
With this patch, IDs can be fetched from the CLI via libimagrt. This
gives us the possibility to automatically handle "stdin provides IDs" in
libimagrt with less boilerplate in the binaries codebases.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:33:30 +01:00
Matthias Beyer db4e83f18f Implement ID reporting
This patch adds the id reporting feature to libimagrt::runtime::Runtime,
where processed ("touched") ids can be reported to the Runtime and then
get printed to stdout if stdout is a pipe.

Other output is automatically redirected to stderr if stdout is a pipe
now.
2018-11-06 20:33:00 +01:00
Matthias Beyer 8552843796 doc: Add note on IO conventions 2018-11-06 20:32:34 +01:00
Matthias Beyer 8c597d2c4d doc: Document new IO story with libimagrt 2018-11-06 20:32:34 +01:00
Matthias Beyer 7fd3350146 Merge branch 'minor'
This merges some important fixes:

* libimagstore: Remove calls to filesystem-accessing functions but use
  abstractions instead.
* Make Debug for FileLockEntry more verbose
* Fix In-Memory test backend bug where the backend did not remove the
  old entry on "move"

as well as some nice formatting stuff and refactorings to simplify code
and similar improvements.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:25:15 +01:00
Matthias Beyer 44495d6efe Fix: Do not ignore errors in config anymore
The function already returns `Result<_>`, the only thing that had to be
done was refactoring the code for actually returning an error in that
case.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:04:47 +01:00
Matthias Beyer feea57679d Remove scope
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:04:47 +01:00
Matthias Beyer 21d411f57b Remove call to format_err!(), use err_msg() instead
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:04:47 +01:00
Matthias Beyer 09f0968755 Remove repetitive code by abstracting it
With this patch, the log level aggregation is abstracted away by using
zero sized types and a macro to implement the whole thing.

This does not alter functionality, but makes the code more readable.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 19:39:41 +01:00
Matthias Beyer 1ff1d85428 Remove unnecessary scope
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 19:08:00 +01:00
Matthias Beyer 1a70c523dc Remove indirection
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 19:03:19 +01:00
Matthias Beyer d493b04555 Remove scope for better readability
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 19:03:10 +01:00
Matthias Beyer 0e4cb59772 Format code
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 19:02:57 +01:00
Matthias Beyer 582fd10acb FS backend: Safe allocation of new PathBuf object
::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>
2018-11-06 18:37:53 +01:00
Matthias Beyer 88a4eee087 Adapt Store::get()/Store::create() to check cache before FS
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>
2018-11-06 18:35:17 +01:00
Matthias Beyer becfcd4180 Fix: In-Memory test backend: Actually remove the old entry on "move"
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")
2018-11-06 18:34:33 +01:00
Matthias Beyer daaa4fd9ca Make assert!() output more verbose
By printing the actual `Result<>` object that failed the assertion.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 18:17:46 +01:00
Matthias Beyer d982a657f8 Rewrite Debug for FileLockEntry
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>
2018-11-06 18:12:58 +01:00
Matthias Beyer 17913ae3fd Optimize implementation: Less matches
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>
2018-11-06 14:48:49 +01:00
Matthias Beyer 1321f49428 Optimize implementation
Code-wise, the functionality was not changed. The changes only make the
code much more pretty.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 14:48:49 +01:00
Matthias Beyer d004c667fd Optimize implementation
Code-wise, the functionality was not changed. The changes only make the
code much more pretty.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 14:48:49 +01:00
Matthias Beyer 5210985bf4 Optimize implementation
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>
2018-11-06 14:48:49 +01:00
Matthias Beyer e043304767 Add FileLockEntry-getter in Mail struct 2018-11-06 14:48:49 +01:00
Matthias Beyer e919435504 Fix: Remove call to deprecated function 2018-11-06 14:48:49 +01:00
Matthias Beyer cb0fcaffde Remove logging calls in favour of debug calls
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 21:35:40 +01:00
Matthias Beyer b4068bad0e Remove println call
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 21:33:18 +01:00
Matthias Beyer 1347784898 Merge branch 'safe-output'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 21:22:26 +01:00
Matthias Beyer 4756811e35 Merge branch 'minor'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 21:22:00 +01:00
Matthias Beyer a45691ef27 Change test output to use debug!() 2018-11-01 20:37:02 +01:00
Matthias Beyer 1f5b490dd7 Change test output to use debug!() 2018-11-01 20:37:02 +01:00