Uh oh!
There was an error while loading. Please reload this page.
[Zeppelin - 683][WIP] BittorrentNotebookRepo - #1231
Conversation
onkarshedge
commented
Jul 27, 2016
@bzz Design help needed. Connect all the pieces...
Should this be separate or included in NotebookServer OnMessage
|
bzz
commented
Jul 28, 2016
Thank you for sharing the progress! Let me look into this and get back to you |
onkarshedge
commented
Aug 1, 2016
@bzz ping. |
Sorry, was quite a busy week. Great progress so far, from the first glance and on the formal side of the contribution:
Please address this feedback and I will look more into the design tommorow and let you know! |
| } | ||
| private static void loadLibrary() throws IOException { | ||
| String path = LIBTORRENT_OS_LIBRARY_PATH(); |
There was a problem hiding this comment.
how about checking this return value in case it's null, would it make sense?
There was a problem hiding this comment.
@onkarshedge please make sure you follow the project java style guide regarding static members
khalidhuseynov
commented
Aug 2, 2016
@onkarshedge thanks for this contribution. as i can see, the design issue on passing |
| String path = LIBTORRENT_OS_LIBRARY_PATH(); | ||
| if (path == null) { | ||
| LOG.error("Unknown Operating system"); | ||
| throw new IOException(); |
There was a problem hiding this comment.
Let's provide the message for auser on the reason of failure though the constructor argument here
onkarshedge
commented
Aug 2, 2016
@khalidhuseynov thanks for helping. To actually see webApp.addServlet(newServletHolder("ws-events",newTorrentServlet()),"/download");So then should it be like this ... publicclassBittorrentNotebookRepoextendsVFSNotebookRepoimplementsTorrentEngineListener,
WebSocketCreator {
@OverridepublicObjectcreateWebSocket(ServletUpgradeRequestservletUpgradeRequest,
ServletUpgradeResponseservletUpgradeResponse) {
returnnewTorrentSocket(this);
}
}And the publicclassTorrentServletextendsWebSocketServlet {
@Overridepublicvoidconfigure(WebSocketServletFactorywebSocketServletFactory) {
webSocketServletFactory.setCreator(newBittorrentNotebookRepo());
}
}Here is the problem as I cannot instantiate the BittorrentNotebookRepo here , it requires |
| private void setupDir() { | ||
| if (!torrentHomeDir.exists()) | ||
| torrentHomeDir.mkdir(); | ||
| if (!torrentDir.exists()) |
There was a problem hiding this comment.
please make sure you follow the project java style guide regarding usage of braces
@onkarshedge on the architecture side - could you please elaborate on the design that you choose, especially regarding Initial idea the we discussed was that Could you please clarify, what are the parts that communicate to each other here? A diagram (event ASCI one) would help here. On the code side - please read the project style guide for Java language carefully and make sure you follow the conventions described there. |
@bzz . I will post a diagram of communication for clear view. Noteget(StringnoteId, AuthenticationInfosubject);
List<NoteInfo> list(AuthenticationInfosubject);
voidsave(Notenote, AuthenticationInfosubject);Only two key methods are publicStringshareNote(StringnoteId); // take the note.json file and start seeding, return magnet linkpublicvoiddownload(StringmagnetLink); // download the files in the torrent directory.
Could you please elaborate this point. |
bzz
commented
Aug 2, 2016
Sure. The idea with P2P notebook storage implementation, be that Bittorrent or Dat or any other protocol is to have:
In case only some parts of For more details on this approach to design object oriented architecture please read infamous Joshua Bloch "Effective Java, 2nd edition" Waiting for the diagram of current architecture and code improvements according to styleguide - please ping me and I'll be happy to make another pass tomorrow. |
onkarshedge
commented
Aug 3, 2016
@bzz here is the diagram. |
The TorrentEngineListener as you can see is similar to And also a note on directories.. The torrent directory is created which will contain the following directories. When the user wants to share a note via DHT he will give the noteId , the note.json file is copied to torrent/notes// |
@onkarshedge conf object can be obtained on the fly from current configurations by |
@onkarshedge thank you for drawing very nice diagram. Let me be very clear - you did a great job and quite possible that it is me, as a mentor, who under communicate the expectations about the architecture for this project. But.. But in order to make your work useful for the project in the nearest future, this PR must not introduce new client-facing APIs, servlets or change the existing filesystem structure a lot. So we need to refactor your implementation and simplify, so it has a single entry point
Lifecycle of all objects that are needed to perform this task (i.e TorrentEngine and all others) must be tied to NotebookRepo lifecycle:
Please let me know if that makes sense to you. Let's start by finding answers to the questions on how to do 1-4 on DHT. Please think about it and let me know if you have question - we can schedule a call. |
@bzz I read the DHT specification and here are some questions and answers. Answer to point 2) checkpointing and 3) get Revisions If we use Immutable items to be stored in DHT point 4) Magnet Link. point 1) Listing existing notes --Edited--- |
bzz
commented
Aug 16, 2016
Thank you for your explanation, what's your progress on refactoring current impelemtation? Let me try to re-visit points 1-5. Also, let's make sure that behavior of BittorentRepo is consistent with other implementations, like i.e S3, so it could be a drop-in replacement for the same use-cases where S3NotebookRerpo is used by a single line of configuration change.
Let me know what you think! |
onkarshedge
commented
Aug 18, 2016
@bzz What should I do now ? As you read the answer posted by gubatron should I now consider breaking the note into multiple partitions ? |
@onkarshedge That is not an expectation here of course. Let's think about alternatives - another way is to distribute note.jspn though regular torrents, right? So we can assume that there is going to be a tracker one day, that lists all notebook that are shared and each Zeppelin instance will be just seeding it's own fraction of notebooks. Then each revision of the note need to be stored as a separate file, as it will create a new torrent file\magnet link, right? Do you think this will work?
But again, the code to do all this have to be as much as possible hidden/composed behind the single entry-point of What do you think? |
onkarshedge
commented
Aug 19, 2016
Yes, this can be done. |
@onkarshedge thank you, that is good to know :) I would rather expect you coming up with such suggestion and then posting an explanation like above though. Could you also please update PR description according to your further plans? |
bzz
commented
Nov 9, 2016
@onkarshedge would you be willing to address the comments on the code style and rebase it? |
close#83close#86close#125close#133close#139close#146close#193close#203close#246close#262close#264close#273close#291close#299close#320close#347close#389close#413close#423close#543close#560close#658close#670close#728close#765close#777close#782close#783close#812close#822close#841close#843close#878close#884close#918close#989close#1076close#1135close#1187close#1231close#1304close#1316close#1361close#1385close#1390close#1414close#1422close#1425close#1447close#1458close#1466close#1485close#1492close#1495close#1497close#1536close#1545close#1561close#1577close#1600close#1603close#1678close#1695close#1739close#1748close#1765close#1767close#1776close#1783close#1799


What is this PR for?
To share notes and download via a magnet link. Trackerless, only via DHT.
What type of PR is it?
[Feature]
Todos
What is the Jira issue?
How should this be tested?
Outline the steps to test the PR here.
Screenshots (if appropriate)
Questions: