New NotebookRepo implementation for updated filesystem #197
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.
Description
First iteration of new filesystem.
NotebookRepository - A middleware for compatibility between legacy Zeppelin objects and new objects.
Implements NotebookRepo interface.
Replaces NotebookRepoSync within ZeppelinServer.
Communication to filesystem is currently unchanged, and all communication goes via NotebookRepository for now.
Source of truth is files saved on disk.
Directory - Immutable representation of a directory saved on disk containing Notebooks or other Directories.
Can be moved, renamed, copied and searched from.
Represents a snapshot of the state of saved .zpln files and directories on disk at the time of it's creation.
To get updated contents of files saved on disk, create a new root Directory via NotebookRepository.init()
Notebook - Immutable reprentation of a Notebook.
Contains Paragraphs.
Is a snapshot of the contents in a .zpln file at the time of object creation.
Any modifying operations create a new Notebook instance, which can be saved to file to persist the changes.
UnloadedNotebook - Represents a Notebook, the contents of which have not yet been loaded from a file. This allows for lazy loading, so that we don't need to read all the file contents of every existing Notebook to list them in the UI. UnloadedNotebooks can be loaded with their load() method to get a fully functional Notebook instance.
Paragraph - Represents one paragraph within a Notebook.
Contains one script and one Result object. Can initiate an execution.
Script - Represents the user-supplied text to be run by an Interpreter. Contains a reference to an Interpreter instance, which will be called to execute the Script
Result - Represents a result created by an Interpreter running a Script. Currently contains legacy objects, as Interpreters have not been refactored yet.
NullParagraph, NullResult, NullScript - Representations of unloaded objects, that have not yet been initialized from a file. Can be initialized from JSON contents via fromJson() methods.
Changes to legacy classes:
ZeppelinServer - Replaced NotebookRepoSync with NotebookRepository to actually use the new objects.
InterpreterFactory - Added a static instance of InterpreterFactory to allow Script objects to instantiate Interpreters correctly.
Interpreter - Added json() method to turn interpreter information into JSON to save to a Script
InterpreterResultMessage - Added json() method to turn result into JSON to save to a Result
LegacyNotebookRepoRestApiTest - Added Ignore flags to these tests as they depend on ZeppelinServer having a NotebookRepoSync as the implementation of NotebookRepo.
Note - Added a toNotebook() method to be able to turn a legacy Note object into a Notebook.