Feature pdsc#35
Open
marcolarosa wants to merge 33 commits intoUTS-eResearch:masterfrom
marcolarosa:feature-pdsc
Open
Feature pdsc#35marcolarosa wants to merge 33 commits intoUTS-eResearch:masterfrom marcolarosa:feature-pdsc
marcolarosa wants to merge 33 commits intoUTS-eResearch:masterfrom
marcolarosa:feature-pdsc
Conversation
commit 9614de2 Author: Marco La Rosa <m@lr.id.au> Date: Tue Oct 15 16:01:08 2019 +1100 bugfix tests commit afa515b Author: Marco La Rosa <m@lr.id.au> Date: Tue Oct 15 15:55:45 2019 +1100 refactor createNewObjectContent First check that no new path is a child of any existing path then decide what to do. Further, ensure the deposit folder is removed when merging and bugfix the file name returned by nameVersion.
commit f6186f1 Author: Marco La Rosa <m@lr.id.au> Date: Tue Oct 15 16:21:30 2019 +1100 bugfix namaste naming nameVersion method can't be used for both repo root and object namaste has they have different forms. This resolves this issue. commit 9614de2 Author: Marco La Rosa <m@lr.id.au> Date: Tue Oct 15 16:01:08 2019 +1100 bugfix tests commit afa515b Author: Marco La Rosa <m@lr.id.au> Date: Tue Oct 15 15:55:45 2019 +1100 refactor createNewObjectContent First check that no new path is a child of any existing path then decide what to do. Further, ensure the deposit folder is removed when merging and bugfix the file name returned by nameVersion.
The load method attempts to load the OCFL object at this.path when the class is instantiated. If it finds an object at the path it will attempt to read the top level inventory.json to create the current state of the object (stored as this.currentState) in addition to reading each version inventory and creating the state of that version as this.versions. Helper methods getCurrentState and getVersions return the current state and versions respectively.
API has been totally reworked to operate around a single update method that knows hows to create a new object or update and existing one. The method can either be passed a source directory to use for the object content or a function that will write content (with the deposit target being passed to the function. The class has a public API and a private one (methods beginning with __ are considered private and should not be used by calling class users). Extensive usage examples are visible in ocflObject.spec.js. Original code has been commented out for now - likewise in test script.
As most of the functionality now resides in OcflObject the repository class is much much lighter.
If we use a path (subtree) relative to deposit or backup then cleanup becomes really difficult as we have to walk back up the tree in order to remove the path. So, if an id is passed in, just use that without converting to a path. Likewise if a path is passed in - make it string by replacing / with ''.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a total re-write of this library.
All OCFL object manipulation now happens inside the OcflObject class rather than in it and the Repository class. As a result, the Repository handler is much lighter and simpler.
Also, the API has changed significantly. There is now a single
updatemethod that can create new objects or version existing objects as required. The method can either ingest a source folder or it can be passed a writer method that will be given the deposit path to write to. It also works quite differently to the original ingestion classes when updating an existing object.If the object exists -
All of the tests have been re-written and they have been heavily commented in addition to being specific to bits of functionality so start there - they should make sense. That said, I've also updated the documentation in the README.
Also, the
updatemethod and associated helpers have been heavily commented in order to (hopefully) ease understanding what is going on inside them.The only features that I think are missing are:
All of the original code still exists - it's just been commented out for now. This is true for tests also.