Following the merge of #34 , this PR applies the ideas in my review.
Below is a summary of all the features that were accomplished across both PRs.
Features
Use generic methods
Make deletes explicit (delete_annotation, delete_pod), remove checks in delete_pod since deletes are explicit, and prevent deletion of the last annotation in delete_annotation
Change annotation save path (annotation subdirectory in model directory)
Make annotation optional for load_pod and delete_pod but required for save_pod
Support loading or deleting pod from a hash or name/version (via ModelID)
Make Result pub
Expose LocalFileStore.directory only via getter
Use impl AsRef<Path> as opposed to impl Into<PathBuf>
Apply map to format desired in list_model. Currently, just passing through Vec<ModelInfo>.
Minor Improvements
Make path builder more general
Use a Vec<ModelInfo> internally when parsing annotation path
Compile regex once instead of in each iteration (moved out of map via move)
Parse class in regex
Make save_file more flexible
Use YAML content as opposed to files in from_yaml
Add lookup_hash based on name/version
Remove get_version_map since unneeded with explicit deletes
Remove FileHasNoParent error
Rename parse_annotation_path(path) -> find_annotation(glob_pattern) to improve readability.
Add snake_case utility
Simplify util methods
Simplify to_yaml usage
Update docs
Tests
~Removed tests introduced in #34 so they are addressed separately~ Tests have been reworked to align with the original fixture design. Includes tests from #34. Improves code coverage from ~70% -> ~72%.
Allow expect usage in tests to simplify
Add pod_load test
Add equality support in Pod
Add test for list_pod when none exist yet
Create store dir in fixture when initializing so drop doesn't panic
Make empty dir check in tests take an arg for # of levels up
Pull out implementations from fixture functions
Dev Improvements
Make spec/annotation paths and filenames easier to change in the future
Following the merge of #34 , this PR applies the ideas in my review.
Below is a summary of all the features that were accomplished across both PRs.
Features
delete_annotation
,delete_pod
), remove checks indelete_pod
since deletes are explicit, and prevent deletion of the last annotation indelete_annotation
annotation
subdirectory in model directory)load_pod
anddelete_pod
but required forsave_pod
ModelID
)Result
pubLocalFileStore.directory
only via getterimpl AsRef<Path>
as opposed toimpl Into<PathBuf>
list_model
. Currently, just passing throughVec<ModelInfo>
.Minor Improvements
Vec<ModelInfo>
internally when parsing annotation pathclass
in regexsave_file
more flexiblefrom_yaml
lookup_hash
based onname
/version
get_version_map
since unneeded with explicit deletesFileHasNoParent
errorparse_annotation_path(path)
->find_annotation(glob_pattern)
to improve readability.snake_case
utilityto_yaml
usageTests
expect
usage in tests to simplifypod_load
testPod
list_pod
when none exist yetDev Improvements