summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2019-02-20Add debug outputMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-20Add function to get relative file pathMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-20Fix: Use StoreIdWithBase::from_full_pathMatthias Beyer
We iterate over full pathes to store entries here, which causes `StoreId::new()` to error. But if we use the internal parsing helper `StoreIdWithBase::from_full_path()` and then call `::into_storeid()` on the resulting object, everything is fine. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-20Fix: Strip the prefix of the pathMatthias Beyer
The previous implementation did not strip the prefix of the "relpath" header value, which resulted in the whole path being in the header, which is obviously wrong. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-19Fix: Use "ref.relpath" as path to header valueMatthias Beyer
The header value for the relative path is at "ref.relpath". This fixes the wrong selector. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-19Add output about logger settings in logging setupMatthias Beyer
This way we can get trace-level information about the logger itself when it is generated. Because from time to time we might want to have a look at that. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-18Remove serializing where result was unusedMatthias Beyer
I'm not sure why this was still there, it seems that this was left out when deleting older code. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-17Remove libimagmailMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-17Reimplement LinkProcessor::process() for new libimagentryref APIMatthias Beyer
The documentation of the function kind of explains why this change is necessary. It might get changed in the future so that the user has more flexibility. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-17Rewrite libimagentrymarkdown importsMatthias Beyer
2019-02-17Rewrite libraryMatthias Beyer
* Remove old code * Rewrite with tests This implements a fassade pattern for ref library With the fassade, we can specify the hasher in a rather easy way, which is not possible with default generics for traits. The "default" part in "default generic type" is not properly implemented yet (as visible in the tests), as I don't know how to realize this. For simplicity, the `hasher` module exports a `default` module with a `DefaultHasher` type, which resolves to the `Sha1Hasher`. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-17Add trace outputMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-17Fix: If the field is not available, return falseMatthias Beyer
The function is for checking whether a flag is set. If the flag is not available, the flag is obviously not set. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Merge branch 'redefine-storeid'Matthias Beyer
Finally merging the redefine of the StoreId implementation, which allows easier handling of StoreId objects. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Remove unused variableMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Remove irrelevant testsMatthias Beyer
Because StoreId objects do not contain bases anymore, we do not need these tests anymore. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Use StoreId::local_display_string() for less errorhandling hereMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new all_contacts() return typeMatthias Beyer
because we return `libimagstore::iter::Entries` here now, we do not have to pass the store anymore. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Fix for new StoreId::new() interfaceMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Adapt to new libimagstore::iter::Entries APIMatthias Beyer
Use Entries::into_storeid_iter() for transforming iterator into right type. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Add Entries::into_storeid_iter()Matthias Beyer
This is a more complicated functionality (implementation-wise) of the `Entries` iterator, which allows a callee to transform it into a `StoreIdIterator`. It uses the crate internal `PathIterator` type and a function to extract the internals of that iterator which is then turned into an iterator over `Result<StoreId>`, which can be used to build a `StoreIdIterator`. The implementation is ugly, but we need to be able to transform a `Entries` iterator into a `StoreIdIterator` in the `libimagentryannotation`, and possibly in more cases where we want to be agnostic over iterators. Maybe there is a cleaner solution to this, hence the comment about whether this should be removed. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Fix libimagcontact for new StoreId interface with Entries iteratorMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Fix libimagtodo for new StoreId interface with Entries iteratorMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Change signature: Link::exists(&Store)Matthias Beyer
This change is necessary because we need the store now to check whether a StoreId exists. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Fix libimagentrylink for new StoreId APIMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Rewrite: StoreId::new_baseless() -> StoreId::new()Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Rewrite Store::new* API: libimagstore does not export backend typesMatthias Beyer
With this change applied, libimagstore does not export backend representing types anymore. This change is necessar because when we want to switch the `StoreId` implementation from "complex and stateful" to "Stateless and Cow<'_, &str>", we need to be able to have a type which represents a "`StoreId` plus the path of the Store itself". This "the path of the Store itself" is passed around as reference, to minimize runtime impact. Because such a type should not be exported by the libimagstore crate, we make it `pub(crate)` internally. But because the backend APIs also have to use this type, we would export the (private) type in the APIs of the backend. Because of that we make the backend API also non-visible to crate users, which also decreases the surface of the libimagstore API itself. Besides: Remove function `Link::with_base()` which is not needed anymore (was used in tests only). Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Delete unused codeMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Move to simpler implementation of StoreidMatthias Beyer
This changes the implementation of the StoreId type to be less complex. Before we always had to re-attach the path of the store itself each time a StoreId object was passed to the store. Now we do not do this anymore, hopefully we can move to a implementation of the Store API which takes references of StoreId objects in the future. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Fix: Off by one errorMatthias Beyer
When printing the error chain, we print the error and then iterate over the causes. Hence, we have to increase the printed number by one here, because 0 (zero) is already printed. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Add debug outputMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Bugfix: Rebuild iterator when changing collectionMatthias Beyer
This patch fixes a bug where the following code (here pseudocode) did the wrong thing: store.entries().in_collection("foo").for_each(||...) because the `.in_collection()` call for the underlying PathIterator object did not actually re-build the iterator. It only changed the contained `PathIterBuilder`, but did not call `.build_iter()` on it to rebuild the iterator object. The test added with this patch checks whether the iterator does the right thing. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-12Do not use deprecated way of checking whether path existsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Adapt for new interface of gen_vars() functionMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Make generate_variants() more flexibleMatthias Beyer
This patch changes generate_variants() so that it allows to be passed an iterator for the modders, which makes it more powerful for passing references.
2019-02-11Optimize: Do not iterate over entries outside of "timetrack" collectionMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Add feature to trim content on the rightMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Remove magic constants in trace_unwrap_exit/map_err_trace_exit_unwrap callsMatthias Beyer
This patch removes the magic constant we used when calling `trace_unwrap_exit()` or `map_err_trace_exit_unwrap()`. We used to call it with `1` as parameter, where the number was the exit code to use. Now the implementation of the function does it automatically (using 1 (one) as exit code). All calls of these functions were fixed. Thanks to vim this was easy. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Remove clone() callsMatthias Beyer
We should be able, from the signature of the `generate_variants()` helper function, to pass a `Vec<&T>` here, so cloning should not be necessary. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Make doc comment test executableMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Simplify implementationMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Simplify implementation of Wiki::all_ids()Matthias Beyer
This way we alter the underlying iterator for all wiki entries to only iterate in the "wiki" collection of the store, which results in fewer disk access because the internal iterator does not yield all pathes from the store before filtering them. Code which was used to implement the filter was removed (also from the public interface of the library). Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Simplify implementation of ContactStore::all_contacts()Matthias Beyer
This way we alter the underlying iterator for all contacts to only iterate in the "contact" collection of the store, which results in fewer disk access because the internal iterator does not yield all pathes from the store before filtering them. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>