Commit Graph

5432 Commits

Author SHA1 Message Date
Matthias Beyer 195d921218
Merge pull request #1471 from matthiasbeyer/libimagstore/store-entries-do-not-collect
libimagstore: Do not collect in Iterators
2018-05-01 22:14:26 +02:00
Matthias Beyer 972327e35e Remove Store::reset_backend() 2018-05-01 21:09:51 +02:00
Matthias Beyer 2f0a557068 Fix for passing Arc<_> to store interface instead of Box<_> 2018-05-01 21:08:57 +02:00
Matthias Beyer 42e2f18fb3 Pass around Arc<FileAbstraction> internally
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-01 21:08:57 +02:00
Matthias Beyer b86ed2ffa9 Refactor imag-wiki to new store iterator interface 2018-05-01 17:44:20 +02:00
Matthias Beyer 7aca84dd5e Refactor imag-mail to new store iterator interface 2018-05-01 17:44:17 +02:00
Matthias Beyer 519b6f7ef2 Refactor imag-habit to new store iterator interface 2018-05-01 17:44:14 +02:00
Matthias Beyer 11f9a9027e Refactor imag-diary to new store iterator interface 2018-05-01 17:44:09 +02:00
Matthias Beyer 829e425c12 Refactor imag-view to new store iterator interface 2018-05-01 17:44:05 +02:00
Matthias Beyer a9d0f3d53a Refactor imag-edit to new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer dd453659ed Refactor imag-mv to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer e6244d7e9e Refactor imag-todo to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer eaf8148cda Refactor imag-ids to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer 40a04376ed Refactor imag-link to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer d08c27e623 Rewrite StoreIdIterator extensions
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-01 17:44:01 +02:00
Matthias Beyer 6ee3f4a3f6 Refactor libimagentrycategory to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer 6f81d02445 Refactor libimagentryannotation to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer 40688a3c2d Refactor libimagwiki to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer 715753ed25 Refactor libimagtodo to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer 72c83ae3f7 Refactor libimagtimetrack to fit new store iterator interface 2018-05-01 17:44:01 +02:00
Matthias Beyer 08114bbf36 Refactor libimagnotes to fit new store iterator interface 2018-05-01 17:44:00 +02:00
Matthias Beyer e643f36fa3 Refactor libimaghabit to fit new store iterator interface 2018-05-01 17:44:00 +02:00
Matthias Beyer bf0bef058d Refactor libimagdiary to fit new store iterator interface 2018-05-01 17:44:00 +02:00
Matthias Beyer 8f03b4a71a Refactor libimagcontact to fit new store iterator interface 2018-05-01 17:44:00 +02:00
Matthias Beyer a2ff298e67 Rewrite Store::entries()
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-01 17:44:00 +02:00
Matthias Beyer f4556f3983 Rewrite backend to not collect on pathes_recursively() 2018-05-01 17:44:00 +02:00
Matthias Beyer d45eef299e
Merge pull request #1476 from matthiasbeyer/imag-diagnostics/refactor
Minify code with helper macro
2018-04-30 21:49:24 +02:00
Matthias Beyer 424a060cc8
Merge pull request #1475 from matthiasbeyer/imag-diagnostics/flush-cache
imag-diagnostics: flush cache
2018-04-30 21:07:56 +02:00
Matthias Beyer 900d9f0984
Merge pull request #1474 from matthiasbeyer/libimagstore/cache-flush
Add functionality to flush the internal cache
2018-04-30 21:07:37 +02:00
Matthias Beyer 41615bcc97
Merge pull request #1473 from matthiasbeyer/libimagstore/more-error-information
Add information about which storeid is the cause of the error in errors
2018-04-30 21:07:02 +02:00
Matthias Beyer 6a5bcb2709 Remove unused error kinds 2018-04-30 18:54:11 +02:00
Matthias Beyer 6a40ac6b98 Add information about which storeid is the cause of the error in errors 2018-04-30 18:53:54 +02:00
Matthias Beyer 1e2e47c388
Merge pull request #1472 from matthiasbeyer/libimagtodo/refactor-error-handing
Refactor error handling, use more error chaining
2018-04-30 18:40:42 +02:00
Matthias Beyer 004faaa905 Performe cache flushing during aggregation 2018-04-30 18:40:19 +02:00
Matthias Beyer 860e47a256 Add functionality to flush the internal cache
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-30 18:39:59 +02:00
Matthias Beyer ebc2e49c5b
Merge pull request #1469 from matthiasbeyer/imag-diary/remove-edit-command
Remove the edit command
2018-04-30 17:33:35 +02:00
Matthias Beyer b3cf96d88b Refactor error handling, use more error chaining 2018-04-30 17:29:27 +02:00
Matthias Beyer b713718693 Minify code with helper macro 2018-04-30 14:15:34 +02:00
Matthias Beyer 58a6eea573 Remove the edit command
The edit command of imag-diary gets removed by this patch.

The rationale is that imag-edit is way more powerful and thus, not every
other imag module should implement an edit command. Chaining
`imag-diary list` and `imag edit -I` is encouraged.

We still need the edit functionality in imag-diary, as `imag diary
create` shall spawn an editor, still. We only remove the ability for
editing of existing entries with this patch.
2018-04-30 14:04:16 +02:00
Matthias Beyer 76966bcd6c
Merge pull request #1467 from matthiasbeyer/libimagentryfilter/failable
libimagentryfilter: failable
2018-04-29 14:21:09 +02:00
Matthias Beyer fc92cfc36f Move header filters to FailableFilter 2018-04-29 11:43:32 +02:00
Matthias Beyer 30ac77d626 Add error module 2018-04-29 11:43:32 +02:00
Matthias Beyer e08ec34893 Remove empty module 2018-04-29 11:43:32 +02:00
Matthias Beyer ecf1768a8d
Merge pull request #1466 from matthiasbeyer/update-filters
Update dependency: filters: 0.2 -> 0.3
2018-04-29 11:43:19 +02:00
Matthias Beyer 6d21d8eb49 Update dependency: filters: 0.2 -> 0.3 2018-04-29 10:46:36 +02:00
Matthias Beyer 0976cab014
Merge pull request #1464 from matthiasbeyer/libimagentrygps/32-bit-gps-values
libimagentrygps: 32 bit gps values
2018-04-29 00:35:21 +02:00
Matthias Beyer dbb39475d9 Upgrade variables to 64 bit 2018-04-28 23:27:12 +02:00
Matthias Beyer 93c3bb5862 Upgrade variables to 64 bit 2018-04-28 23:27:12 +02:00
Matthias Beyer f493b4b8c3 Fix: Allow second to be missing 2018-04-28 23:18:02 +02:00
Matthias Beyer 5870fa0785 Fix: Use 16 bit variables for GPS degree/minute/second 2018-04-28 23:18:02 +02:00