Commit Graph

62 Commits

Author SHA1 Message Date
Matthias Beyer 1482f70320 Update dependency: toml: 0.4 -> 0.5
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-29 18:39:25 +02:00
Matthias Beyer f540a317b0 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:55:10 +02:00
Matthias Beyer 1d89844613 Run 'cargo fix' for rust-2018
With this patch we move the codebase to Rust-2018.

The diff was generated by executing

    cargo fix --all --all-features --edition

on the codebase.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:20:59 +02:00
Matthias Beyer 427eac76fe Add Ref::get_path_with_basepath_setting()
This function can be used to override the basepath setting from the
header of the entry so that another basepath is used for looking
up/constructing the actual filepath.

This might come in handy at some point.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 14:40:07 +02:00
Matthias Beyer cf234437d7 Implement Partial for Config
With this implemented, we can fetch the appropriate configuration easily
from the configuration.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 13:06:26 +02:00
Matthias Beyer 2854e88dcc Rename: "ref.collection" to "ref.basepath"
The setting in the header should reflect the name of the setting in the
configuration file, for a better user experience.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-22 13:06:26 +02:00
Matthias Beyer d32f41aeab Outsource hashing itself so that we can re-use it
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-22 11:23:57 +01:00
Matthias Beyer b2fbf1e462 Add debug and trace output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-20 23:14:43 +01:00
Matthias Beyer dfc02a5679 Move helper function to libimagentref::util
This moves the helper function for getting the `Config` object from the
configuration file via the runtime.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-20 16:22:52 +01:00
Matthias Beyer 0a62548173 Add function to get relative file path
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-20 14:43:21 +01:00
Matthias Beyer ed862db76f Fix: Strip the prefix of the path
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-20 12:31:37 +01:00
Matthias Beyer 04e006154c Fix: Use "ref.relpath" as path to header value
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-19 21:51:44 +01:00
Matthias Beyer db7121ccba Rewrite library
* 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-17 11:09:48 +01:00
Matthias Beyer 642702b724 Rewrite: StoreId::new_baseless() -> StoreId::new()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15 20:53:28 +01:00
Matthias Beyer 9185abcfa5 Update copyright years
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-01-03 18:41:36 +01:00
Matthias Beyer 9fca66aa89 Forbid unsafe code in all crates 2018-11-11 13:05:55 +01:00
Matthias Beyer 9b48dc27cd libimagentryref: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
newpavlov 04b3e7243d replaced rust-crypto with RustCrypto crates 2018-07-18 19:51:05 +03:00
Matthias Beyer 731b97cccb Fix: Pass the right path variable here
The ref library passed the wrong variable as path which caused the
setting in the entries to be wrong.

This patch fixes this.
2018-04-13 14:06:15 +02:00
Matthias Beyer 6f33e4e322 Add debug output 2018-03-23 10:05:58 +01:00
Matthias Beyer 3d7be3a1e0
Merge pull request #1349 from matthiasbeyer/libimagentryref/fixes
Fix: Allocating of buffer does not work as expected with Vec::with_ca…
2018-03-21 18:04:37 +01:00
Matthias Beyer d2eb4936b1 Fix: Allocating of buffer does not work as expected with Vec::with_capacity() 2018-03-20 16:51:19 +01:00
Matthias Beyer 5ceeacd6c8 Provide Ref::make_ref() for making a ref out of an existing entry 2018-03-19 14:18:02 +01:00
Matthias Beyer 027c4b3287 Remove usage of libimagentrylist 2018-02-20 15:02:46 +01:00
Matthias Beyer 1153fb180b Add function to delete a reference header entry 2018-02-19 12:14:32 +01:00
Matthias Beyer fd6a7f877a Remove private macro 2018-02-19 12:14:32 +01:00
Matthias Beyer a1a85f40d0 Add default generators 2018-02-19 12:14:32 +01:00
Matthias Beyer 2328c8b2b0 Take AsRef<str> rather than &String 2018-02-19 12:14:32 +01:00
Matthias Beyer cbb47cffcb Implement Ref functions 2018-02-19 12:14:32 +01:00
Matthias Beyer ed69fd4b35 Enrich error types 2018-02-19 12:14:32 +01:00
Matthias Beyer 81a8826740 Add impl for RefStore::{get,create,retrieve}_ref() 2018-02-19 12:14:32 +01:00
Matthias Beyer 1014f58cfc Rewrite interface 2018-02-19 12:14:32 +01:00
Matthias Beyer 73af121882 Remove old concepts 2018-02-19 12:14:32 +01:00
Matthias Beyer d5a9e4930d Update dates in license header
And add missing header in one file
2018-02-07 02:48:53 +01:00
Matthias Beyer a34cae03e5 libimagentryref: Replace read with typed read 2018-01-13 01:14:03 +01:00
Matthias Beyer 7fb13acf15 Add Ref::is_ref() 2018-01-08 23:46:36 +01:00
Matthias Beyer 66b0611103 Refactoring: Use function chaining rather than matching 2018-01-05 11:37:09 +01:00
Matthias Beyer 078936191b Replace uses of try!() macro with "?" operator 2017-10-31 15:04:50 +01:00
Matthias Beyer d37de44c94 Add RefStore::find_storeid_by_partial_hash() helper 2017-10-14 14:05:56 +02:00
Matthias Beyer 6c387e893c Add RefStore::get_by_partial_hash() 2017-10-14 13:36:04 +02:00
Matthias Beyer e74745c9fc Remove RefStore::get() which was simply a wrapper to Store::get() 2017-10-14 13:08:37 +02:00
Matthias Beyer db64c06409 Add RefStore::all_references() 2017-09-28 17:52:27 +02:00
Matthias Beyer cac7697054 Refactor errors to use error-chain linking functionality 2017-09-24 13:05:16 +02:00
Matthias Beyer c115215fa4 Merge branch 'master' into libimagerror/integration
This merge solved a _LOT_ of conflicts and was a rather complicated one,
as parts of the conflict-resolution involved rewriting of half the
stuff.

This merge commit fixes all the things so a `cargo check --all`
succeeds, but I did not yet check whether tests run without failure.
2017-09-04 23:02:45 +02:00
Matthias Beyer 18e806f588 Remove dedicated result modules, use error chain generated Result types 2017-09-04 09:19:29 +02:00
Matthias Beyer 7ce44e8090 Remove "IntoError" trait, use error_chain functionality 2017-09-03 21:34:07 +02:00
Matthias Beyer 22be1627b7 libimagentryref: Rewrite error handling 2017-09-03 21:33:54 +02:00
Matthias Beyer 603808a9fa Impl IntoError for error kinds 2017-09-03 15:42:06 +02:00
Matthias Beyer a309fdb280 Add recursion limits to crates 2017-09-03 15:42:06 +02:00
Matthias Beyer 11d881d3a9 Add dependency to crates: error_chain = 0.10 2017-09-03 15:42:06 +02:00