Commit graph

14 commits

Author SHA1 Message Date
d4872f6da3 Optimize the Store::entries() interface
The previous iterator was implemented to simply fetch _all_ pathes from
the filesystem, no matter what.

With this implementation, this changes. The iterator now has
functionality to optimize the iteration, if only a subdirectory of the
store is required, for example `$STORE/foo`.

This is done via functionality where the underlying iterator gets
altered.

First of all, the interface was changed to return a `Entries` object,
which itself only covers the libimagstore-internal `PathIterator` type.
This type was changed so that the backend implementation provides an
"PathIterBuilder`, which builds the actual iterator object for the
`PathIterator` type.

The intermediate `StoreIdConstructingIterator` was merged into
`PathIterator` for simplicity.

The `Entries` type got functionality similar to the
`StoreIdIteratorWithStore` type for easier transition to the new API.
This should probably be removed at a later point, though.

As the `walkdir::WalkDir` type is not as nice as it could be, iterators
for two collections in the store could be built like this (untested):

    store
        .entries()?
        .in_collection("foo")
        .chain(store.entries()?.in_collection("bar"))

Functionality to exclude subdirectories is not possible with the current
`walkdir::WalkDir` implementation and has to be done during iteration,
with filtering (as usual).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-09-27 12:19:18 +02:00
2f0a557068 Fix for passing Arc<_> to store interface instead of Box<_> 2018-05-01 21:08:57 +02:00
72c83ae3f7 Refactor libimagtimetrack to fit new store iterator interface 2018-05-01 17:44:01 +02:00
ea80a5a09b Derive Default for InMemoryFileAbstraction, remove constructor 2018-04-25 19:15:07 +02:00
22fb26dc12 Replace Store::retrieve_for_module() with own iterator type 2018-04-24 13:40:42 +02:00
4a4e528aed Refactor error handling
Refactor error handling so we do chain the error with the `?`
operator rather than wrapping it with own types.

Links to other error chains are created with error chain. All unneeded
error kinds were removed.

No API changes.
2018-02-11 23:44:27 +01:00
77be32d80f Remove "get" iterator, store provides this now 2018-02-11 23:44:27 +01:00
d5a9e4930d Update dates in license header
And add missing header in one file
2018-02-07 02:48:53 +01:00
a386d50df3 Refactoring: Use function chaining rather than matching 2018-01-05 11:37:09 +01:00
0ed636bb06 Refactor libimagrt+libimagstore to pass whole configuration object
Before we extracted the store configuration from the configuration
toml::Value object and passed it to the store.

This is unecessary overhead.

Now we pass the whole configuration object and let the store extract the
required values.
2017-12-24 13:52:18 +01:00
7ce44e8090 Remove "IntoError" trait, use error_chain functionality 2017-09-03 21:34:07 +02:00
a5bb7a9bec libimagtimetrack: Rewrite error handling 2017-09-03 21:33:54 +02:00
75e42d2f0b Fix errors (former warnings) in several crates
This fixes errors (former warnings) in several locations.
2017-08-27 20:08:03 +02:00
ef93cf0243 libimagentrytimetrack -> libimagtimetrack
This is actually a domain library and thus should be put into the
lib/domain/ folder.
2017-08-27 18:23:47 +02:00