Commit Graph

330 Commits

Author SHA1 Message Date
Matthias Beyer 94bed5f364 Merge pull request #287 from matthiasbeyer/libimagstore/hooks/fix-missing-tostr-impl
Add missing hook_error_type_as_str() impl
2016-03-26 13:56:43 +01:00
Matthias Beyer 7c276d541d Merge pull request #279 from matthiasbeyer/libimagstore/rewrite-file
Truncate file to zero size before writing new content, so we do not p…
2016-03-26 13:56:06 +01:00
Matthias Beyer 0a181479c8 Merge pull request #277 from matthiasbeyer/libimagstore/remove-unused-aspects
Libimagstore/remove unused aspects
2016-03-26 13:55:46 +01:00
Matthias Beyer 93d7b81dc5 Merge pull request #276 from matthiasbeyer/libimagstore/config-getter
Store::config() added, mainly for debugging use
2016-03-26 13:55:11 +01:00
Matthias Beyer ad35d0bf50 Add missing hook_error_type_as_str() impl 2016-03-25 19:17:35 +01:00
Matthias Beyer bb918db5c3 Fix wrong hook execution: post-retrieve 2016-03-25 19:17:19 +01:00
Matthias Beyer b54576d95d Add README for libimagstore 2016-03-25 15:56:42 +01:00
Matthias Beyer ab417a17d0 Truncate file to zero size before writing new content, so we do not partially write the file 2016-03-25 15:39:26 +01:00
Kai Sickeler cdbc0ceae5 Removed unused functions 2016-03-25 15:22:45 +01:00
Kai Sickeler 797a707c8e removed unused Pre- / PostRead aspects 2016-03-25 15:22:45 +01:00
Matthias Beyer ad18091b88 Store::config() added, mainly for debugging use 2016-03-25 15:15:37 +01:00
Matthias Beyer c5c60cf36d impl Debug for Store 2016-03-25 13:30:26 +01:00
Matthias Beyer 22052ba9f0 Add some more error types to be more specific about what happened 2016-03-25 13:30:16 +01:00
Matthias Beyer a96ca837c6 Make HookPosition clonable 2016-03-24 17:57:19 +01:00
Matthias Beyer 2deb98d764 Add deny() so we turn some warnings into errors 2016-03-22 19:44:04 +01:00
Matthias Beyer c59ed7d2fe Use unused result when file.write_all() and return error 2016-03-22 19:44:04 +01:00
Matthias Beyer dc7a212278 Use unused result which must be used when file.seek()ing 2016-03-22 19:44:04 +01:00
Matthias Beyer a45571e299 Remove unused function AspectConfig::config() 2016-03-22 19:44:04 +01:00
Matthias Beyer 8e852384bd Remove unused function from Store 2016-03-22 19:44:04 +01:00
Matthias Beyer a9eddb088a Remove unused functions from LazyFile
- Remove uses of LazyFile::new() from tests
    - Use LazyFile::get_file_mut() in test as we want the file mut anyways
2016-03-22 19:43:48 +01:00
Matthias Beyer af161394ad Remove dead code in configuration.rs 2016-03-22 19:43:48 +01:00
Matthias Beyer a4c820d308 Remove unused keyword "mut" 2016-03-22 19:43:48 +01:00
Matthias Beyer 8aa3f31970 Remove unused variables 2016-03-22 19:43:48 +01:00
Matthias Beyer 2fb59b3ae6 Remove unused imports 2016-03-22 19:43:48 +01:00
Matthias Beyer 041a2a4942 Add encoding error if typeconversion fails 2016-03-19 15:15:04 +01:00
Matthias Beyer fe0849f8eb Add implementation for Store::retrieve_for_module() 2016-03-19 15:15:04 +01:00
Matthias Beyer 80945fcd16 Rewrite build_entry_path() so it does not panic!() anymore 2016-03-19 14:48:09 +01:00
Matthias Beyer b8b49b3240 Move: build_entry_path() from imag-store to libimagstore 2016-03-19 14:47:45 +01:00
Matthias Beyer 65a64774b6 Fix: Allow NonMutableAccess in MutableHookDataAcessor 2016-03-16 16:46:54 +01:00
Matthias Beyer feac9ae9e8 Store::new(): Aspect configuration added 2016-03-16 16:46:54 +01:00
Matthias Beyer 96deb17515 Aspect: Optionally get configuration 2016-03-16 16:46:54 +01:00
Matthias Beyer f1246093f1 Implement AspectConfig::get_for() 2016-03-16 16:46:54 +01:00
Matthias Beyer 08b36972f1 Make store configuration optional 2016-03-16 16:46:54 +01:00
Matthias Beyer 0286d8a25e Store: Add hook configuration on registration 2016-03-16 16:46:54 +01:00
Matthias Beyer 59fdb7ef3d Store: Get configuration object not as reference, to avoid livetimes 2016-03-16 16:46:54 +01:00
Matthias Beyer 6dae03d731 Hook: Must provide name, gets reference to configuration 2016-03-16 16:46:54 +01:00
Matthias Beyer 9961f64ce6 Add AspectConfig type 2016-03-16 16:46:53 +01:00
Matthias Beyer c942c74f05 Implement getter for aspect names 2016-03-16 16:46:53 +01:00
Matthias Beyer d249f604d8 Implement: config_is_valid() 2016-03-16 16:46:53 +01:00
Matthias Beyer cd55e7d625 Add Aspect building based on configuration 2016-03-16 16:46:53 +01:00
Matthias Beyer 1fe545eb8b Add configuration.rs 2016-03-16 16:46:53 +01:00
Matthias Beyer a771db9ea4 Add error kind for config errors 2016-03-16 16:46:53 +01:00
Matthias Beyer 9e8ef57f72 Remove {Pre, Post}HookErrorKind types as they are not needed anymore 2016-03-16 16:46:53 +01:00
Matthias Beyer 987b271cc7 Add access type checking error 2016-03-16 16:46:53 +01:00
Matthias Beyer 5ba260943b Make hook execution parallel for NonMutableHookDataAccessor impl for Aspect 2016-03-16 16:46:53 +01:00
Matthias Beyer 7102a57808 Make hook execution parallel for StoreIdAccessor impl for Aspect 2016-03-16 16:46:53 +01:00
Matthias Beyer d8760c9737 Impl NonMutableHookDataAccessor::access() for Aspect 2016-03-16 16:46:53 +01:00
Matthias Beyer c4c02f2274 Impl MutableHookDataAccessor::access_mut() for Aspect 2016-03-16 16:46:53 +01:00
Matthias Beyer 2022f4e4bb Impl StoreIdAccessor::access() for Aspect 2016-03-16 16:46:53 +01:00
Matthias Beyer 2c544382a1 We do not need boxes here 2016-03-16 16:46:53 +01:00
Matthias Beyer 679865464b Reimplement hook registration and execution 2016-03-16 16:46:52 +01:00
Matthias Beyer d6a581e69f Add HookPosition enum 2016-03-16 16:46:52 +01:00
Matthias Beyer 37a505609e Remove hook traits. There can only be one trait: Hook 2016-03-16 16:46:52 +01:00
Matthias Beyer be1ba5be4b Add Aspect type for hook system 2016-03-16 16:46:52 +01:00
Matthias Beyer 3e62b71605 Add StoreIdAccessor trait 2016-03-16 16:46:52 +01:00
Matthias Beyer fa9e8e8192 Split hook/mod.rs into several files 2016-03-16 16:46:52 +01:00
Matthias Beyer 3f15fd0fa8 Move hook.rs -> hook/mod.rs 2016-03-16 16:46:52 +01:00
Matthias Beyer a9600f23b3 Threaded hook execution 2016-03-16 16:46:52 +01:00
Matthias Beyer 79ba3f5151 Hook calling rewrite 2016-03-16 16:46:52 +01:00
Matthias Beyer 0610f0756a Add dep: crossbeam = 0.2.8 2016-03-16 16:46:52 +01:00
Matthias Beyer 3421e8d4d9 Add HookExecutionError error kind 2016-03-16 16:46:52 +01:00
Matthias Beyer 1c40be78a9 Add HookAccessor types for accessing mutable/nonmutable hook calling in a generic way 2016-03-16 16:46:52 +01:00
Matthias Beyer e1414beb8d Impl Into<HookError> for error kinds to convert errors in a simple way 2016-03-16 16:46:51 +01:00
Matthias Beyer 57831dceb0 Add HookErrorKind enums for Pre and Post errors 2016-03-16 16:46:51 +01:00
Matthias Beyer d7733aa13a Make hooks configurable
This introduces the Configurable trait and abstracts the
dependency-traits for each trait over a generic "Hook" trait, which
requires Configurable and Debug to be implemented, but has no own
functions.

Configuring is done _without_ the Runtime object, so we can be sure that
the hooks do not have access to the store object.
2016-03-16 16:46:51 +01:00
Matthias Beyer d9a4512821 Add debug output for hook exec functions 2016-03-16 16:46:51 +01:00
Matthias Beyer da3554d98e Add debug output for hook register functions 2016-03-16 16:46:51 +01:00
Matthias Beyer 6af5be15ad Hooks must implement Debug 2016-03-16 16:46:51 +01:00
Matthias Beyer bb0e7e2468 Implement: execute_post_delete_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer f703e8a4cd Implement: execute_post_update_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer 7014256407 Implement: execute_post_retrieve_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer 5831d3bc7b Implement: execute_post_create_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer 196be30d91 Implement: execute_post_read_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer 09acddaef9 Implement: execute_pre_delete_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer 5aa663987b Implement: execute_pre_update_hooks() 2016-03-16 16:46:51 +01:00
Matthias Beyer 94128f8bcc Implement: execute_pre_retrieve_hooks() 2016-03-16 16:46:50 +01:00
Matthias Beyer 3244b87c7e Implement: execute_pre_create_hooks() 2016-03-16 16:46:50 +01:00
Matthias Beyer 975a2bc8b9 Implement: execute_pre_read_hooks() 2016-03-16 16:46:50 +01:00
Matthias Beyer ac280ba616 Insert pre/post hook execution functions 2016-03-16 16:46:50 +01:00
Matthias Beyer 3cf2588104 Add error types for pre/post hooks 2016-03-16 16:39:39 +01:00
Matthias Beyer 17b1d6c390 Redefine hook trait system 2016-03-16 16:39:39 +01:00
Matthias Beyer 001c80b72d Hook: Add traits which must be implemented for Hook 2016-03-16 16:39:39 +01:00
Matthias Beyer b9127381b8 Add hook registering 2016-03-16 16:39:39 +01:00
Matthias Beyer d99d25a3e1 Add HookRegisterError kind 2016-03-16 16:39:14 +01:00
Matthias Beyer e969b8678e Add hook traits 2016-03-16 16:39:14 +01:00
Matthias Beyer 361dec4cec Revert "Check whether the StoreId is inside the store, before doing anything on the FS"
This reverts commit 373502217e.
2016-03-12 16:06:10 +01:00
Matthias Beyer 9a918c9252 Merge pull request #242 from matthiasbeyer/libimagstore/revert-id_in_store-check
Revert "Check whether the StoreId is inside the store, before doing a…
2016-03-11 16:02:11 +01:00
Matthias Beyer 6d7065d10e Fix test: StoreId does not start with "/" anymore 2016-03-10 19:12:00 +01:00
Matthias Beyer a9a64d4ab6 Fix: implicitely create directories on file saving 2016-03-10 19:06:27 +01:00
Matthias Beyer a3a09ff4ee Fix store creation of libimagstore
The macro may not prefix the StoreId internal PathBuf with '/', so this
path is not absolute. This way we can introduce `storify_id()` which
creates a proper PathBuf into the store out of our StoreId object.

Does not yet do verification whether the path is inside the store,
actually.
2016-03-10 18:46:26 +01:00
Matthias Beyer 3413646934 Revert "Check whether the StoreId is inside the store, before doing anything on the FS"
This reverts commit 373502217e
as this commit was introducing a bug.

The StoreId type says `/test/example` for a store id path, which is
completely valid, as the root (`/`) is the store itself. The
id_in_store() function assumed that the store-id is the full
(file-system) path to the store entry, which is false.

This commit does not introduce a fix but revert the check.
2016-03-10 18:14:53 +01:00
Matthias Beyer df1fd31771 libimagstore: Update glob 0.2.10 -> 0.2.11 2016-03-07 17:46:58 +01:00
Matthias Beyer 257fe1880e EntryHeader: Function to get toml object 2016-03-06 11:51:09 +01:00
Matthias Beyer 74634227e0 Use unused result 2016-03-01 21:23:09 +01:00
Matthias Beyer 22e9f8a93b Remove unused import 2016-03-01 21:21:14 +01:00
Matthias Beyer 1a8106dfd2 Add missing error-forwarding 2016-03-01 21:20:53 +01:00
Matthias Beyer 38b9e15615 Remove unreachable statement 2016-03-01 21:19:15 +01:00
Matthias Beyer 08c37c5fcb Remove unused "mut" from EntryHeader::delete() 2016-03-01 21:18:17 +01:00
Matthias Beyer ed3da38701 Remove unused "mut" from EntryHeader::read_with_sep() 2016-03-01 21:18:10 +01:00
Matthias Beyer 309e70df14 Remove unused "mut" from EntryHeader::set_with_sep() 2016-03-01 21:18:04 +01:00