Commit graph

118 commits

Author SHA1 Message Date
ea80a5a09b Derive Default for InMemoryFileAbstraction, remove constructor 2018-04-25 19:15:07 +02:00
6a34e7a8fd Derive Default for FSFileAbstraction, reduces boilerplate 2018-04-25 19:15:07 +02:00
bf363c4748 Use "if let" if matching on a single pattern 2018-04-25 19:15:07 +02:00
f1142c414d Use ok_or_else() instead of ok_or() 2018-04-25 19:15:07 +02:00
22170a0d55 Do not String::from(String) 2018-04-25 19:13:51 +02:00
6f5590713a Use single quotes here 2018-04-25 19:13:51 +02:00
44521a7c8c Dont use "return" keyword at end of function 2018-04-25 19:13:51 +02:00
dc18e650bb Collapse nested if-else-if 2018-04-25 19:13:51 +02:00
84249e3fb5 Be less verbose when constructing an object
The rust compiler does some fancy things for us: It automatically finds
the right fields if the name of the variable and the file is the same.

Lets use that to reduce boilerplate with this patch.
2018-04-25 19:13:50 +02:00
524c391ee0 Remove unused dependency 2018-04-24 22:16:40 +02:00
563c76c375 Remove "stdio" file abstraction from store implementation 2018-04-24 22:16:40 +02:00
19e0471f5b Remove tests with JsonMapper in backend 2018-04-24 22:16:40 +02:00
bae9188a08 Remove GlobStoreIdIterator helper iterator type 2018-04-24 13:40:42 +02:00
d70092d691 Remove: Store::retrieve_for_module 2018-04-24 13:40:42 +02:00
d2dceb6640 Update version numbers: 0.7.0 -> 0.8.0 2018-04-19 10:05:53 +02:00
4568b1f625
Merge pull request #1380 from matthiasbeyer/minor
Minor patches
2018-04-18 16:46:41 +02:00
98f8366e4c Fix documentation in crate metadata 2018-04-17 15:55:08 +02:00
604f350340 Add logging in store 2018-04-14 16:55:36 +02:00
a769186cd7 Make iterator lifetimes less restricting 2018-04-07 13:55:54 +02:00
e61ccc9561 Fix: Entry::to_str() should return Result<_>
Because serializing might fail.

Also fixes all usages of the API.
2018-03-26 14:24:42 +02:00
9e0d0d9f6c Add Entry::replace_from_buffer() 2018-03-23 15:44:34 +01:00
7e623f39b8 Add message why panic
So we see that when grepping the source for `unimplemented!()`.
2018-03-23 10:05:58 +01:00
41f7bab1c5 Fix: Store::create() should fail if the entry exists 2018-03-22 21:16:11 +01:00
68ace5d147 Fix typo 2018-03-12 13:32:23 +01:00
da408b9e67 This fixes the file parsing (again)
Unfortunately, our latest fix to file parsing did not solve all issues.
So we have to fix it _again_.

The problem was the `std::str::Lines` iterator, which apparently fails
this:

    assert_eq!(1, "".lines().count());

as an empty line seems not to be a line.

Because of that, when reading a file with an empty line at its bottom
got stripped off that line.

This patch removes the use of the `lines()` iterator and uses
`split("\n")` instead. This only works on Unix operating systems, but as
we only target unix operating systems with imag, this is not considered
an issue right now.

This patch also adds extensive tests on multiple levels in the
`libimagstore` implementation:

* On the parsing level, for the function which implements the parsing
* On the filesystem abstraction levels
* On the `Store` levels

to make sure that everything is parsed correctly.
2018-03-10 14:53:15 +01:00
579c00b62a Replace hard coded version strings with compiletime env 2018-03-06 12:45:41 +01:00
ee5a17790f Fix multi-line reading
Reading entries with multiple entries caused all lines to be read as one
line.

This bug is fixed with this patch.
2018-03-02 21:48:17 +01:00
87d6f1221f Add testcase for reading multiple lines 2018-03-02 21:48:13 +01:00
9fb5f453fe Rewrite entry parsing algorithm
Rewrite without regex crate.

The regex approach was broken. If the following _content_ was provided
in the entry:

    foo

    ---

    bar

The regex approach parsed the header until the "---" in the content.
This is, of course, not the way to do that.

Now, the parsing is implemented by hand. Should be faster as well,
though I don't care about this.

This fixes a severe bug.
2018-02-20 21:06:36 +01:00
5f99018807 Simplify store debug print 2018-02-19 11:51:21 +01:00
9e3c966d84
Merge pull request #1273 from matthiasbeyer/update-version-numbers
Update version string: 0.6.0 -> 0.7.0
2018-02-11 17:50:52 +01:00
30d2c28a22 Update version string: 0.6.0 -> 0.7.0 2018-02-11 14:22:24 +01:00
8fcd2a6c8c Prettify Store debug output implementation 2018-02-11 13:36:37 +01:00
d5a9e4930d Update dates in license header
And add missing header in one file
2018-02-07 02:48:53 +01:00
de613c9ebd
Merge pull request #1227 from matthiasbeyer/libimagentryutil/filtered-iterators
libimagentryutil: filtered iterators
2018-02-01 20:22:12 +01:00
06cb8d50fb Make StoreId::is_in_collection() generic over AsRef<str> 2018-02-01 16:46:57 +01:00
b3f546129a Add StoreIdIteratorWithStore::without_store() 2018-02-01 16:46:38 +01:00
8e931cd79f Change calls to into_get_iter() to not take argument 2018-02-01 16:46:38 +01:00
3b01a9eb2f Add API in StoreIdIteratorWithStore to get acting iterators
This patch adds API functions in the StoreIdIteratorWithStore iterator
type to transform it into a iterator which _does_ something (as in the
`libimagstore::iter` API).

It mimics the API which is offered by `libimagstore::iter`.
2018-02-01 15:47:39 +01:00
030e32e44f Provide StoreId Iterator which has a ref to the Store
This change is needed so we can refactor the "get" iterator to not take
an argument (the store) later, which improves the API.
2018-02-01 15:47:39 +01:00
164b6b7f10 Move documentation to appropriate place 2018-01-29 09:38:32 +01:00
fcfc397fc8 env_logger: 0.5.0-rc.2 -> 0.5 2018-01-18 14:15:40 +01:00
8d9c7dce4f env_logger: 0.5.0-rc.1 -> 0.5.0-rc.2 2018-01-15 11:22:09 +01:00
635d000344 log: 0.4.0-rc.1 -> 0.4.0 2018-01-15 11:21:52 +01:00
c45130ddd0 env_logger: 0.4.* -> 0.5.0-rc.1 2018-01-15 11:20:27 +01:00
f209e12410 Update dependency: log: 0.3.* -> 0.4.0-rc.1 2018-01-15 11:20:07 +01:00
3ef5fcfab6 libimagstore: Replace read with typed read 2018-01-13 01:14:03 +01:00
0c4be78223 Update dependency: toml-query -> 0.6 2018-01-13 01:14:03 +01:00
bfc35e0517 Remove dependency "version"
Because the "version" crate is licensed as GPL, which would us require
to release imag as GPL, we remove the crate now.
2018-01-12 13:33:40 +01:00
689310edfe Rename Store::retrieve_copy to Store::get_copy
The function was named falsely and nobody noticed. So nobody uses this
function yet - hopefully - as this change is a breaking API change.
2018-01-08 15:16:41 +01:00