summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2018-07-27Merge pull request #1495 from matthiasbeyer/imag-diary/fix-missing-headerMatthias Beyer
Imag diary/fix missing header
2018-07-20Add functionality to create entry at a certain timeMatthias Beyer
2018-07-19Remove "Header" extension for Value typeMatthias Beyer
2018-07-19Simplify: Move header verification from Value extension to Entry typeMatthias Beyer
2018-07-19Simplify: Move default header generation from Value extension to Entry typeMatthias Beyer
2018-07-19Fix: Remove (empty) Drop implementation for StoreMatthias Beyer
The StoreEntry drop implementation takes care of unlocking the files.
2018-07-19Fix: Deleting an Entry could leave artifacts in cacheMatthias Beyer
This patch fixes a bug we did not even hit (yet). It is: When deleting an Entry from the store, this could potentially leave artifacts in the cache. Szenario: An Entry, which was loaded (via `Store::get()` for example), gets `Store::delete()`ed twice. The first call would work as expected, but leave the Entry in the Store cache. The second call would then fail, as the Entry is already removed on the FS, but still in the cache. This would fail - which is the right thing to do here - but with the wrong error (with a FileError rather than a FileNotFound error). This patch fixes this. First of all, the appropriate `PathBuf` object is calculated in all cases, as this object is needed to check whether the file is actually there (which could be the case if the Entry is in the cache and if it is not). If the entry is in the cache and is borrowed: error. If not, remove the entry from the cache. Afterwards the file is deleted on disk. If the entry is not in the cache, but the file exists, the file is removed. If the file does not exist: error. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-07-19Fix: Use backend abstraction for checking whether a path existsMatthias Beyer
2018-07-18replaced rust-crypto with RustCrypto cratesnewpavlov
2018-06-23Remove unnecessary callMatthias Beyer
2018-06-23Add documentation to StoreId typeMatthias Beyer
2018-06-23Add documentation for Runtime::init_logger()Matthias Beyer
2018-05-11Fix: Explicitely use Itertools::flatten()Matthias Beyer
As of rustc 1.26, the `flatten()` method on iterators is preserved by the rust standard library. This could cause this code to hard-error some time in the future with the `flatten()` function actually implemented by the standard library. Hence we move to use the `Itertools::flatten()` function here explicitely.
2018-05-11Fix comment for rustc 1.26Matthias Beyer
2018-05-09Update version string: 0.8.0 -> 0.9.0Matthias Beyer
2018-05-04Merge pull request #1482 from matthiasbeyer/libimagrt/cli-validationMatthias Beyer
libimagrt: cli validation
2018-05-04Add CLI validators in default CLI setupMatthias Beyer
2018-05-04Update helpMatthias Beyer
2018-05-04Update help, clap does the rest hereMatthias Beyer
2018-05-04Add functionality to remove categoriesMatthias Beyer
2018-05-02Merge pull request #1477 from matthiasbeyer/libimagstore/remove-walkMatthias Beyer
Remove Store::walk()
2018-05-02Remove Store::walk()Matthias Beyer
This patch removes the Store::walk() interface. It was cumbersome and unused anyways.
2018-05-02Fix: Do not check whether path exists - check whether its a fileMatthias Beyer
This fixes a bug introduced in 195d921218559f98844e52cca2ebdfe12fcf6b71 where we didn't check whether the path is actually a file.
2018-05-01Only create directory if it does not existMatthias Beyer
2018-05-01Add debug outputMatthias Beyer
2018-05-01Add trace outputMatthias Beyer
2018-05-01Remove Store::reset_backend()Matthias Beyer
2018-05-01Fix for passing Arc<_> to store interface instead of Box<_>Matthias Beyer
2018-05-01Pass around Arc<FileAbstraction> internallyMatthias Beyer
Because the iterators need to be able to check whether the file exists _in the backend_ (not on disk, but in the backend, because of in-memory test for example), we need to be able to pass the backend to the iterator intermediate type. This patch implements this. It does so by changing the internal backend member of the store from `Box<FileAbstraction>` to `Arc<FileAbstraction>`, which gives us the ability to clone the reference to the backend easily without needing to rely on lifetimes here, because of the Arc. Also, less boxes are always good.
2018-05-01Rewrite StoreIdIterator extensionsMatthias Beyer
This patch reimplements the iterator extensions. As we iterate (in StoreIdIterator) over Result<StoreId> now anyways, we don't need the extensions for Result iterators anymore. This patch rewrites the extensions to be more simple in every way and generic over the error type in the iterator. All the errors have to do is implement From<StoreError>, which is what they do when linking the generated error types with error_chain to the libimagstore error types.
2018-05-01Refactor libimagentrycategory to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagentryannotation to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagwiki to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagtodo to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagtimetrack to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagnotes to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimaghabit to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagdiary to fit new store iterator interfaceMatthias Beyer
2018-05-01Refactor libimagcontact to fit new store iterator interfaceMatthias Beyer
2018-05-01Rewrite Store::entries()Matthias Beyer
This patch rewrites the Store::entries() function to not be collecting the iterator. It therefore introduces a new, internal, iterator type which creates the StoreId objects from the pathes the PathIterator yields internally. With this patch, the Store iterator interface changes, as the iterators now yield `Result<StoreId, StoreError>` instead of `StoreId`. This is necessary, as the internal conversion errors shouldn't be hidden. Of course, the iterator types (like the StoreGetIterator and so on) should hold a Result<StoreId> internally as well, and also yield appropritely. This was changed in this commit, too.
2018-05-01Rewrite backend to not collect on pathes_recursively()Matthias Beyer
2018-04-30Merge pull request #1474 from matthiasbeyer/libimagstore/cache-flushMatthias Beyer
Add functionality to flush the internal cache
2018-04-30Merge pull request #1473 from matthiasbeyer/libimagstore/more-error-informationMatthias Beyer
Add information about which storeid is the cause of the error in errors
2018-04-30Remove unused error kindsMatthias Beyer
2018-04-30Add information about which storeid is the cause of the error in errorsMatthias Beyer
2018-04-30Add functionality to flush the internal cacheMatthias Beyer
Before we had the problem that when iterating over _a lot_ (like 5k) entries and also fetching them, at some point the OS would return with "Too many files open". That is because the store internally caches a lot. With this change, the Store gets an API to query how big the cache is, how much the cache can currently hold and (and that's the main thing in this patch) to flush the cache to disk. A function to simply ask the store whether its cache should be flushed (which would us require to ask the OS how many files we can open... which would be possible with `libc::getrlimit`) does not yet exist, though, but could be added easily if desired.
2018-04-30Refactor error handling, use more error chainingMatthias Beyer
2018-04-29Move header filters to FailableFilterMatthias Beyer
2018-04-29Add error moduleMatthias Beyer
2018-04-29Remove empty moduleMatthias Beyer