Skip to content

Conversation

@onkarshedge
Copy link

@onkarshedge onkarshedge commented Jun 10, 2016

What is this PR for?

IPFSNoteBookRepo IPFS storage and sharing zeppelin notes.

What type of PR is it?

Feature

Todos

  • checkpoint revisions, get particular revision
  • List of revision history
  • remove note and also a particular revision
  • support to import the Note when hash is given as input
  • Documentation

What is the Jira issue?

How should this be tested?

Installing ipfs

  • Download and install ipfs for your OS.
  • Enter the following commands
    • ipfs init
    • ipfs daemon

ipfs daemon will start the ipfs. In the output you will see the following.

API server listening on /ip4/127.0.0.1/tcp/5001

Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080

You can edit the following ports with ipfs config edit.
As zeppelin also uses 8080 by default you might want to chage the gateway server or run zeppelin on another port.

Screenshots (if appropriate)

Successful import
Failure import

Questions:

  • Does the licenses files need update? Yes
  • Is there breaking changes for older versions?
  • Does this needs documentation? Yes

@onkarshedge
Copy link
Author

@bzz Please review

pom.xml Outdated
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zeppelin uses jdk 1.7 by default. could you please revert this value?

Copy link
Author

@onkarshedge onkarshedge Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jongyoul the ipfs jar I use requires jdk 1.8 I also mentioned this in the google document linked above.

Copy link
Author

@onkarshedge onkarshedge Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jongyoul Yes I will revert that value to 1.7 with the next commit. But for this ipfs code to execute the "mvn clean package" must be with jdk 1.8.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best bet right now is try to re-build ipfs jar with target 1.7 locally

@bzz
Copy link
Member

bzz commented Jun 15, 2016

Great job @onkarshedge !

I understand that it's WIP, just wanted to remind that eventually your NotebookRepo implementation should user NotebookRepoVersioned, see Git one as an example.

Could you also point to some document with high-level description of the approach how notebooks are stored in IPFS, what IPFS features are used and how to view them without Zeppelin, to make sure they are saved for people who are not very familiar with IPFS?

Also, we need to know what is overall current implementation status, like what are TODOs, what is done, what is left, etc? This could be added i.e to the GDoc that you have linked

@onkarshedge
Copy link
Author

@bzz I had a doubt about versioning approach.
Currently I am saving(ipfs add 'note') the note in IPFS for every call to save function. This gives me a new multihash on saving. So for versioning I have to save the multihash with time. The GitNotebookRepo has a checkpoint which corresponds to git commit. Here in ipfs each call to ipfs add is like git commit. So the List from history function will be large because save() method is called multiple times.
So the List should contain only those few multihashes which user wants to choose.

@onkarshedge
Copy link
Author

onkarshedge commented Jun 15, 2016

Should i save to Filesystem like VFSNotebookRepo and only when user chooses to version it add it to ipfs that way the ipfs will contain only the ipfs object corresponding to versioned notes and not all through the save method ?
@bzz should IPFSNotebookRepo extends VFSNotebookRepo ?

@bzz
Copy link
Member

bzz commented Jun 20, 2016

Hi @onkarshedge sorry for late responce, it's your choice how to support versioning of course, but as mid-term evaluation starts soon, I think it's crucial to get answers on 2 previous questions now.

Could you also point to some document with high-level description of the approach how notebooks are stored in IPFS, what IPFS features are used and how to view them without Zeppelin, to make sure they are saved for people who are not very familiar with IPFS?

and

Also, we need to know what is overall current implementation status, like what are TODOs, what is done, what is left, etc? This could be added i.e to the GDoc that you have linked

As soon as that is done it will be easier to help you with further improvements.

@onkarshedge
Copy link
Author

@bzz Here is the link to document for first question.
High level description
TODO's is the frontend api : To enter the ipfs hash to download the note.

@bzz
Copy link
Member

bzz commented Jun 21, 2016

Thank you very much @onkarshedge 👍 ! I will go though it and let you know

@bzz
Copy link
Member

bzz commented Jul 7, 2016

@onkarshedge sorry, people were busy releasing 0.6.0 recently

Could you please:

  • rebase this code on latest master branch
  • update PR description to contain full mardown-formatted TODO list: checked ellements for things that are laredy implemented and un-checked for things that are missing (i.e do you plan to add documentation section to storage docs, and so on, for everything that is left.)
  • post here your current status - like what is in-prgress right now or is there anything that blocks your progress, etc

On your UI proposal
screen shot 2016-07-07 at 12 54 46

  1. thank you for sharing a great mock! it's very helpfull for a discussion

  2. menu structure in Zeppelin have changed recently

  3. I do not think it is reasonable to add a separate menu for IPFS.

    We should provide configuration the same way we do for other notebookRepos. Other than that - we should support User Experience with versions the same way as GitNotebookRepo does - so user can commit changes with message and list them.

Right now listing notebook history in UI is not implemented, but it will be very soon, AFAIK @khalidhuseynov is working on it under ZEPPELIN-1044 so it should "just work" with IpfsNotebookRepo

@bzz
Copy link
Member

bzz commented Jul 12, 2016

ping, @onkarshedge are there any updates for the past week?

@onkarshedge
Copy link
Author

onkarshedge commented Jul 12, 2016

@bzz right now I am working on Bittorrent support. I am using the jlibtorrent which uses libtorrent. The past week I spent time on using this library and some examples.I will post a PR of bittorrent in 2-3 days. Sorry for late response.
I didn't work on ipfs in past week.

@bzz
Copy link
Member

bzz commented Jul 14, 2016

Got it, thanks! Sounds great, please do not forget to submit another WIP pr with your progress on Bittorents support.

Could you still follow #989 (comment) and update this PR as soon as you get back to IPFS one?

Thanks again!

@bzz
Copy link
Member

bzz commented Aug 3, 2016

ping @onkarshedge

Could you please follow #989 (comment) and update this PR asap?

@onkarshedge
Copy link
Author

@bzz To import the note by hash url . I will have to use javascript-api in this notenameImport.controller.js file.
How do you suggest to use this?.

@bzz
Copy link
Member

bzz commented Aug 9, 2016

Thanks for updates!

Do you want to do that on the client-side, right in the browser?

I see what you mean - our existing impor function indeed fetches from URL and parse JSON right in the browser, but I do not think that such architecture will suit our case, as then the whole IPFS stack need to be run on the client. And it is not something that we want add here (we want self-contained IpfsNotebookRepo implementation)

I think what you could do here is - create a new REST API endpoint, pass this hash (which is like an URL in our case) to this REST API, and make it delegate actual fetching logic to a method in IpfsNotebookRepo and then, on the client, just rear the response, as a JSON.

This logic can be later used for BitTorrent notebooks storage support as well as simple URL case could be refactored to use it (but that is outside of the scope of this PR of course)

Let me introduce you to @corneadoug - he is known Zeppelin front-end ninja, whose knowledge of the client side codebase is by far greater than mine.

@corneadoug Could you please help @onkarshedge and guide him on refactoring\updating notenameImport.controller.js in such way, that it could delegate hash->JSON resolution in case of notebook import to the backend API, for the case of importing notes from new IPFS storage by IPFS hash (which is like a bittorent address)?

@corneadoug
Copy link
Contributor

@onkarshedge just like @bzz said, it would be better to have that import function in the back-end.
This is the PR that first implemented the feature so you should be able to find where are the classes currently taking care of the import.

We currently have 2 options for import in the front-end: URL or File Import
You could probably create a 3rd one for IPFS.

Right now, the websocket call is sending a Notebook, so you might want to refactor that to have a choice between sending a Notebook or a URL/Hash/Other.
And send the Hash to the backend so it can do the import.

@bzz
Copy link
Member

bzz commented Aug 16, 2016

@onkarshedge what do you think?

Future<Note> noteFuture = executorService.submit(task);
Note note = null;
try {
note = noteFuture.get(15, TimeUnit.SECONDS);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzz When the note is not available from peer it should not wait indefinitely so I added timeout in backend.
And the exception is logged. Should this be propagated to front-end ?
The front-end does not know about the TimeoutException.
@corneadoug should there be another timeout function in front-end ?

@onkarshedge
Copy link
Author

@bzz @corneadoug please review,it is complete. I have added the screenshot.

@corneadoug
Copy link
Contributor

@onkarshedge I would need a scenario/setup to be able to test it, could you add it to the PR description?
Regarding the timeout function in front-end, I think it would be better to send back a websocket event message with import result to that client (not everybody), and then show it in a ng-toast. (green: The Notebook XXX was imported, red: We couldn't import Notebook XXX)

@bzz
Copy link
Member

bzz commented Aug 17, 2016

@onkarshedge good progress, thank you for keeping us posted, your changes look very well!

Before moving further, on top of great suggestions from @corneadoug, there are few more things you also need to take care of:

  • Please make sure that zeppelin-distribution/src/bin_license/LICENSE includes all dependencies AND all transitive dependencies that this changes bring to the project. You can see them with mvn dependency:tree
  • Please make sure that ALL your Java code follows the conventions from project style guide
  • I noticed that CI is failing here. Could you, as an author of the PR, look into that and post there the reason of the failures here please? This would speed up the review and enable the reviewers to help you identify the reason faster.

Please ping back as soon as those are addressed and I will be happy to make another pass on it!

@onkarshedge
Copy link
Author

@bzz there are no transitive dependencies, just Junit and hamcrest
The reason of CI failure is

[ERROR] Failed to execute goal on project zeppelin-zengine: Could not resolve dependencies for project org.apache.zeppelin:zeppelin-zengine:jar:0.7.0-SNAPSHOT: Failed to collect dependencies at org.ipfs:api:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for org.ipfs:api:jar:0.0.1->SNAPSHOT: Could not transfer artifact org.ipfs:api:pom:0.0.1-SNAPSHOT from/to codehaus-snapshots (https://nexus.codehaus.org/snapshots/): nexus.codehaus.org: Name or service not known: Unknown host nexus.codehaus.org: Name or service not known -> [Help 1]

It has to be added in local .m2 repository

@onkarshedge onkarshedge changed the title Added ipfsnotebookrepo [ Zeppelin-683 WIP ] Added ipfsnotebookrepo [ Zeppelin-683 ] Aug 18, 2016
@onkarshedge
Copy link
Author

@corneadoug feedback addressed.

@onkarshedge
Copy link
Author

@bzz I found this documentation and there would be no need for dependency. I have used apache-httpcomponents httpclient.

@onkarshedge onkarshedge reopened this Aug 23, 2016
@onkarshedge
Copy link
Author

@bzz CI is green please review.

newNote.addCloneParagraph(p);
}
newNote.persist(subject);
} catch (IOException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of e.toString() we could have something like "Importing note from " + url+ " failed". The error message will still be there, as we propaget e.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for having more detailed error message as mentioned by @bzz

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I referred the previous import function.

@bzz
Copy link
Member

bzz commented Aug 24, 2016

Looks great, @onkarshedge! I posted a few comments above.

\cc @khalidhuseynov for extra back-end code review and @corneadoug for front-end one

angular.element('#noteImportModal').modal('hide');
});

$scope.$on('importNoteFail', function(event, data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'importNoteFail' isn't a great name, how about 'importNoteResult'

@corneadoug
Copy link
Contributor

corneadoug commented Aug 24, 2016

I'm a bit lost with this feature, is it really considered as a NotebookRepo or does it only keep the revisions? Does importing the Hash mean that it import a Revision as Notebook?

Why do we need to comment the VFS while it still save in local file system?

Also I think the ipfs installation steps shouldn't be in the NotebookRepo doc since not every user should be having a server running. It would be more fitting in this PR description on how to test this PR.

Import form

  • I would have classic URL by default, and the hash option only as a checkbox.
  • The Notebook name during import is also not used

Import Note event listener

I left comments in the code

@corneadoug
Copy link
Contributor

Considering #1304 is the import really needed?

@khalidhuseynov
Copy link
Member

in a sense i agree with @corneadoug and i'll write more details on that later, but for the beginning wouldn't it make sense to save normal notes without commit in ipfs as well?

@onkarshedge
Copy link
Author

@bzz @corneadoug addressed the feedback, updated PR description and also images.
@khalidhuseynov saving normal notes would create an ipfs object for each save , we would have to discard the previous object and hash and will need to store the latest hash. It's similar to git, it would not be suitable to commit on every small change as save() function is called on timeout.

@bzz
Copy link
Member

bzz commented Nov 9, 2016

@onkarshedge thank you for the great work!

How do you think, how hard it would be to rebase it on latest master?

@asfgit asfgit closed this in c38a0a0 May 9, 2018
asfgit pushed a commit that referenced this pull request May 9, 2018
close #83
close #86
close #125
close #133
close #139
close #146
close #193
close #203
close #246
close #262
close #264
close #273
close #291
close #299
close #320
close #347
close #389
close #413
close #423
close #543
close #560
close #658
close #670
close #728
close #765
close #777
close #782
close #783
close #812
close #822
close #841
close #843
close #878
close #884
close #918
close #989
close #1076
close #1135
close #1187
close #1231
close #1304
close #1316
close #1361
close #1385
close #1390
close #1414
close #1422
close #1425
close #1447
close #1458
close #1466
close #1485
close #1492
close #1495
close #1497
close #1536
close #1545
close #1561
close #1577
close #1600
close #1603
close #1678
close #1695
close #1739
close #1748
close #1765
close #1767
close #1776
close #1783
close #1799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants