Commit Graph

885 Commits

Author SHA1 Message Date
Matthias Beyer 185ec25b9e Rewrite logging config deserialization
This patch rewrites the logging config deserialization. It removes the
manual traversing of the config toml structure and replaces it with
types which implement `Deserialize`, which is way more convenient and
easy to read (and extend).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-30 09:32:07 +02:00
Matthias Beyer a7d53e47d1 Update toml-query to 0.9.0
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-29 18:39:25 +02:00
Matthias Beyer 1482f70320 Update dependency: toml: 0.4 -> 0.5
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-29 18:39:25 +02:00
Matthias Beyer 1c6b02454c Remove unused functions 2019-05-25 10:43:24 +02:00
Matthias Beyer b18c3e0361 Remove ununsed sourcefile
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-25 10:43:24 +02:00
Matthias Beyer 5ff2c3e8e3 Remove lazy_static
we don't need lazy static here, so remove it and the dependency as well.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-25 10:43:24 +02:00
Leon Schuermann ed457495c8 Introduce proper error handling in IdPathProvider
Prior to this change, the IdPathProvider implementation would be
responsible for exiting the process on insufficient / wrong arguments.
However, such error handling should be performed together with the
business logic and not in CLI-parsing related code.

This change introduces a clear separation: both parsing errors and
insufficient id path arguments can now be return from inside the
`get_ids`-method, and get passed up to the application logic to be
handled.

This change is reflected in all instances of IdPathProvider and their
surrounding code.

Signed-off-by: Leon Schuermann <leon.git@is.currently.online>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-24 21:03:34 +02:00
Matthias Beyer 5c8af4460e Fix: Entries::in_collection() should be able to return error
This patch changes the Entries::in_collection() interface to return a
Result<()>. This is needed because the fs backend implementation should
be able to check whether a directory actually exists whenever we change
the iterator.

If the implementation detects that the directory does not exist, we can
fail early and error out.

All usages of the interface are adapted by the patch as well.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 13:37:46 +02:00
Matthias Beyer 5a250bd991 Remove InternalLinker::set_internal_links()
This function needs to be removed because of the following problem:

When linking from one entry to another, and then removing the link in
the first entry with ::set_internal_links(vec![]), we end up with a
dangling link in the second entry, because the ::set_internal_links()
function does not take care of removing the links in the "other"
entries.

Actually, it is not even able to do so, because it would need to
`Store::get()` those entries, but it does not have access to the store.

Adding a `store` parameter to the function would be possible, but only
increase its complexity unnecessarily. This is why I opt for removing
this function (which is btw not used once in the whole imag codebase).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 02:31:03 +02:00
Matthias Beyer d034a6f0e2 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 27b75ba2fc Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 5ebbcb774a Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer b808658648 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer f540a317b0 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer c02b2f88de Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer c7ea58eda2 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer d8bcb8ca8e Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer f44e10e295 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 322c063450 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 6e0a179550 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 740729bfda Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 06e78c75de Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 99ee4fdf43 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 26de159415 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 3321b9a643 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer e200e40070 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 1f97584738 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:54:35 +02:00
Matthias Beyer 741e8acb8a Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:54:35 +02:00
Matthias Beyer 5f07d7d21a Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:54:35 +02:00
Matthias Beyer 112a2d6af8 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:53:40 +02:00
Matthias Beyer 00fa3e7b78 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:53:40 +02:00
Matthias Beyer c7f5420c1d Change is_log() implementation to use kindflag utility
This patch changes the Log::is_log() implementation for Entry to use the
provide_kindflag_path!() infrastructure.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:52:13 +02:00
Matthias Beyer 9f100f2f75 Fix: Do not write newline character when asked not to do
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:52:13 +02:00
Matthias Beyer 1d89844613 Run 'cargo fix' for rust-2018
With this patch we move the codebase to Rust-2018.

The diff was generated by executing

    cargo fix --all --all-features --edition

on the codebase.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:20:59 +02:00
Matthias Beyer 26664a5aec Merge branch 'libimagentryref-override-base' into master 2019-04-22 14:40:30 +02:00
Matthias Beyer 427eac76fe Add Ref::get_path_with_basepath_setting()
This function can be used to override the basepath setting from the
header of the entry so that another basepath is used for looking
up/constructing the actual filepath.

This might come in handy at some point.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 14:40:07 +02:00
Matthias Beyer ff5e6653ed Add option to override ref data in contact entries
This patch adds a flag to the ContactStore::retrieve* functions so one
can override the ref data in the store for the retrieved entry.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 14:37:43 +02:00
Matthias Beyer 99576bf5bc Merge branch 'remove-libimagnotification' into master 2019-04-22 14:28:23 +02:00
Matthias Beyer 1c851bbb79 Rewrite store interface abstraction
Because we pull in libimagentryref here to create actual references to
the files we parse here, we need to rewrite the interface to be able to
pass the required information to the libimagentryref API.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 14:26:56 +02:00
Matthias Beyer 204da1b0bd Remove libimagnotification
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 14:05:55 +02:00
Matthias Beyer cf234437d7 Implement Partial for Config
With this implemented, we can fetch the appropriate configuration easily
from the configuration.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 13:06:26 +02:00
Matthias Beyer 2854e88dcc Rename: "ref.collection" to "ref.basepath"
The setting in the header should reflect the name of the setting in the
configuration file, for a better user experience.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 13:06:26 +02:00
Matthias Beyer 7ae2d926cc Use toml-query master branch during development
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 13:06:26 +02:00
Matthias Beyer 31e3116b48 Revert "Remove GetIter"
This reverts commit a49522dc86770a741d61d548351ad69dfc56d1fa.
2019-04-14 00:16:47 +02:00
Matthias Beyer b8cd9c6efa Add debug output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-14 00:16:47 +02:00
Matthias Beyer aa3fdb88d5 Remove GetIter
Because the code is not used.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-14 00:16:47 +02:00
Matthias Beyer 4afebbe9e4 Remove FilterLinksIter
Because the code is not used.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-14 00:16:47 +02:00
Matthias Beyer 1f515b1d0d Remove DeleteUnlinkedIter
Because the code is not used.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-14 00:16:47 +02:00
Matthias Beyer 0283c3af7a Merge branch 'fix-path-iterator' into master-ff
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-13 23:42:20 +02:00
Matthias Beyer 526885ee19 Fix: PathIterBuilder should not yield directories
PathIterBuilder should yield iterator that does only yield file pathes,
not directories.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-13 23:00:06 +02:00