-
Notifications
You must be signed in to change notification settings - Fork 773
feature: Implement stream mode as a new download and upload method #1447
base: master
Are you sure you want to change the base?
Conversation
4e8e239
to
f895330
Compare
f895330
to
83b235a
Compare
717cbc1
to
b250fb6
Compare
Codecov Report
@@ Coverage Diff @@
## master #1447 +/- ##
==========================================
- Coverage 52.29% 51.95% -0.35%
==========================================
Files 136 138 +2
Lines 9134 9506 +372
==========================================
+ Hits 4777 4939 +162
- Misses 3972 4170 +198
- Partials 385 397 +12
Continue to review full report at Codecov.
|
Signed-off-by: Hongbo Qin <hongbo.qin.1001@gmail.com>
Signed-off-by: Hongbo Qin <hongbo.qin.1001@gmail.com>
Signed-off-by: Hongbo <qin.ho@northeastern.edu>
b250fb6
to
8ac634a
Compare
Signed-off-by: Hongbo <qin.ho@northeastern.edu>
8ac634a
to
8acfce9
Compare
The stream mode is fullfilled with three more perpectives, which are DFGET downloader, DFGET uploader, and the IPC between user and DFGET. DFGET DownloaderSince the client stream writer has been implemented under the
DEGET UploaderThe previous uploader is solely used for the regular downloading method. For the stream uploader, I have added new APIs for it. Apart from that, the cache manager is added to manage the cache pieces.
IPC Between DFGET and UserThis part demands further discussion. Currently, I propose that the DFGET can directly output the content of the pieces to stdout, and then the user who calls the DFGET command, can redirect the stdout of the DFGET command to the write side of the pipe by generally supported method popen. After that, the user can directly read from the pipe, and get the successfully downloaded content. Since the method uses the unnamed pipe, the whole process is not related with the file system. |
@@ -114,3 +114,65 @@ func (s *DFGetP2PTestSuite) TestDownloadFile(c *check.C) { | |||
} | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The integration test here is annotated due to the reason that the detailed implementation of IPC between user and DFGET demands further discussion.
Not clear what problem the PR solves. Performance? Better rate limiting? or else ? |
Ⅰ. Describe what this PR did
The main work is to implement the P2P stream mode in supernode side. To summarize, the streaming download process in supernode could be cateloged into two sections.
Maintain the sliding window in supernode.
report
API of supernode server, the window will be updated based on the received piece number and piece status. To be specific, the window keeps sliding until the unacknowledged piece. It should be noted that the supernode is using the sender window, which has the range of[una, una + wnd)
.DeleteCID
method of ProgressManager to delete the sliding window state if it is in stream mode.Schedule the pieces according to the window state
The only modification that I made in this part lies at the
GetPieceProgressByCID
method of ProgressManager. The available pieces in regular mode means the success pieces which are not running; while for the stream mode, the available pieces means the cached pieces which are not running. After the modification, the ProgressManager would only return the available pieces inside the window when stream mode is on.A new kind of piece status is created: UNCACHED. When the piece is downloaded successfully, I assume that it will sotred into the cache immediately. Afterwards, the piece maybe popped out of the cache. And in this case, the handler of supernode server
deletePieceCache
atsupernode/server/router.go:101
would be called to change the state of the piece.It should be noted that, the scheduler in stream mode currently uses the same scheduler as the regular mode, which may demands future optimization.
Besides the above modifications, I also add two APIs in supernode server, which are
addPieceCache
anddeletePieceCache
. The dfget client calls these APIs to notify the supernode about the state of cache.Ⅱ. Does this pull request fix one issue?
This PR is related to #1436 #1164.
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
The unit tests have been added.
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews