You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis.md
+36-43Lines changed: 36 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,7 +197,11 @@ PUT /pieces/{id}
197
197
198
198
199
199
#### Description
200
-
Update some information of piece, like status of piece.
200
+
Update some information of piece. When peer A finishes to download
201
+
piece B, A must send request to supernode to update piece B's info
202
+
to mark that peer A has the complete piece B. Then when other peers
203
+
request to download this piece B, supernode could schedule peer A
204
+
to those peers.
201
205
202
206
203
207
#### Parameters
@@ -378,7 +382,8 @@ PUT /tasks/{id}
378
382
379
383
380
384
#### Description
381
-
update information of a task.
385
+
update information of a task. When a peer finishes to download all pieces of a task,
386
+
it must update peer downloading status of this task in supernode.
382
387
383
388
384
389
#### Parameters
@@ -408,33 +413,6 @@ update information of a task.
408
413
*`application/json`
409
414
410
415
411
-
<aname="tasks-id-delete"></a>
412
-
### delete a task
413
-
```
414
-
DELETE /tasks/{id}
415
-
```
416
-
417
-
418
-
#### Description
419
-
delete a peer-to-peer task in supernode.
420
-
421
-
422
-
#### Parameters
423
-
424
-
|Type|Name|Description|Schema|
425
-
|---|---|---|---|
426
-
|**Path**|**id** <br>*required*|ID of task|string|
427
-
428
-
429
-
#### Responses
430
-
431
-
|HTTP Code|Description|Schema|
432
-
|---|---|---|
433
-
|**204**|no error|No Content|
434
-
|**404**|no such peer|[4ErrorResponse](#4errorresponse)|
435
-
|**500**|An unexpected server error occurred.|[Error](#error)|
436
-
437
-
438
416
<aname="tasks-id-pieces-get"></a>
439
417
### Get pieces in task
440
418
```
@@ -443,7 +421,9 @@ GET /tasks/{id}/pieces
443
421
444
422
445
423
#### Description
446
-
Get fixed number of pieces in a task. The number is set in query.
424
+
When dfget starts to download pieces of a task, it should get fixed
425
+
number of pieces in a task and the use pieces information to download
426
+
the pirces. The request piece number is set in query.
447
427
448
428
449
429
#### Parameters
@@ -503,12 +483,9 @@ it will send PeerCreateRequest to supernode.
503
483
|---|---|---|
504
484
|**ID** <br>*optional*|Peer ID of dfget client. Every peer has a unique ID among peer network.|string|
505
485
|**IP** <br>*optional*|IP address which peer client carries|string (ipv4)|
506
-
|**callSystem** <br>*optional*|This field is for debugging. When caller of dfget is using it to files, he can pass callSystem<br>name to dfget. When this field is passing to supernode, supernode has ability to filter them via <br>some black/white list to guarantee security, or some other purposes. <br>**Minimum length** : `1`|string|
507
-
|**dfdaemon** <br>*optional*|tells whether it is a call from dfdaemon.|boolean|
508
486
|**hostName** <br>*optional*|host name of peer client node, as a valid RFC 1123 hostname. <br>**Minimum length** : `1`|string (hostname)|
509
-
|**path** <br>*optional*|This is actually an HTTP URLPATH of dfget. <br>Other peers can access the source file via this PATH.|string|
510
-
|**port** <br>*optional*|when registering, dfget will setup one uploader process. <br>This one acts as a server for peer pulling tasks.<br>This port is which this server listens on. <br>**Minimum value** : `30000` <br>**Maximum value** : `65535`|integer (int64)|
511
-
|**version** <br>*optional*|version number of dfget binary|string|
487
+
|**port** <br>*optional*|when registering, dfget will setup one uploader process. <br>This one acts as a server for peer pulling tasks.<br>This port is which this server listens on. <br>**Minimum value** : `15000` <br>**Maximum value** : `65000`|integer (int32)|
488
+
|**version** <br>*optional*|version number of dfget binary.|string|
512
489
513
490
514
491
<aname="peercreateresponse"></a>
@@ -530,11 +507,8 @@ The detailed information of a peer in supernode.
530
507
|---|---|---|
531
508
|**ID** <br>*optional*|ID of peer|string|
532
509
|**IP** <br>*optional*|IP address which peer client carries|string (ipv4)|
533
-
|**callSystem** <br>*optional*|This field is for debugging. When caller of dfget is using it to files, he can pass callSystem<br>name to dfget. When this field is passing to supernode, supernode has ability to filter them via <br>some black/white list to guarantee security, or some other purposes. <br>**Minimum length** : `1`|string|
534
-
|**dfdaemon** <br>*optional*|tells whether it is a call from dfdaemon.|boolean|
535
510
|**hostName** <br>*optional*|host name of peer client node, as a valid RFC 1123 hostname. <br>**Minimum length** : `1`|string (hostname)|
536
-
|**path** <br>*optional*|This is actually an HTTP URLPATH of dfget. <br>Other peers can access the source file via this PATH.|string|
537
-
|**port** <br>*optional*|when registering, dfget will setup one uploader process. <br>This one acts as a server for peer pulling tasks.<br>This port is which this server listens on. <br>**Minimum value** : `30000` <br>**Maximum value** : `65535`|integer (int64)|
511
+
|**port** <br>*optional*|when registering, dfget will setup one uploader process. <br>This one acts as a server for peer pulling tasks.<br>This port is which this server listens on. <br>**Minimum value** : `15000` <br>**Maximum value** : `65000`|integer (int32)|
538
512
|**version** <br>*optional*|version number of dfget binary|string|
539
513
540
514
@@ -550,10 +524,12 @@ Peer's detailed information in supernode.
550
524
551
525
<aname="pieceupdaterequest"></a>
552
526
### PieceUpdateRequest
527
+
request peer uses to update its status of downloading piece in supernode.
553
528
554
-
|Name|Schema|
555
-
|---|---|
556
-
|**ID** <br>*optional*|string|
529
+
530
+
|Name|Description|Schema|
531
+
|---|---|---|
532
+
|**PeerID** <br>*optional*|contains the peer ID.|string|
557
533
558
534
559
535
<aname="preheatcreaterequest"></a>
@@ -599,9 +575,12 @@ task because that an image may have more than one layer.
599
575
600
576
|Name|Description|Schema|
601
577
|---|---|---|
578
+
|**callSystem** <br>*optional*|This field is for debugging. When caller of dfget is using it to files, he can pass callSystem<br>name to dfget. When this field is passing to supernode, supernode has ability to filter them via <br>some black/white list to guarantee security, or some other purposes. <br>**Minimum length** : `1`|string|
579
+
|**dfdaemon** <br>*optional*|tells whether it is a call from dfdaemon. dfdaemon is a long running<br>process which works for container engines. It translates the image<br>pulling request into raw requests into those dfget recganises.|boolean|
602
580
|**headers** <br>*optional*|extra HTTP headers sent to the rawURL.<br>This field is carried with the request to supernode. <br>Supernode will extract these HTTP headers, and set them in HTTP downloading requests<br>from source server as user's wish.|< string, string > map|
603
581
|**identifier** <br>*optional*|special attribute of remote source file. This field is used with taskURL to generate new taskID to<br>indetify different downloading task of remote source file. For example, if user A and user B uses<br>the same taskURL and taskID to download file, A and B will share the same peer network to distribute files.<br>If user A additionally adds an indentifier with taskURL, while user B still carries only taskURL, then A's<br>generated taskID is different from B, and the result is that two users use different peer networks.|string|
604
582
|**md5** <br>*optional*|md5 checksum for the resource to distribute. dfget catches this parameter from dfget's CLI<br>and passes it to supernode. When supernode finishes downloading file/image from the source location,<br>it will validate the source file with this md5 value to check whether this is a valid file.|string|
583
+
|**path** <br>*optional*|path is used in one peer A for uploading functionality. When peer B hopes<br>to get piece C from peer A, B must provide a URL for piece C.<br>Then when creating a task in supernode, peer A must provide this URL in request.|string|
605
584
|**rawURL** <br>*optional*|The is the resource's URL which user uses dfget to download. The location of URL can be anywhere, LAN or WAN.<br>For image distribution, this is image layer's URL in image registry.<br>The resource url is provided by command line parameter.|string|
606
585
|**taskURL** <br>*optional*|taskURL is generated from rawURL. rawURL may contains some queries or parameter, dfget will filter some queries via<br>--filter parameter of dfget. The usage of it is that different rawURL may generate the same taskID.|string|
607
586
@@ -613,7 +592,9 @@ response get from task creation request.
613
592
614
593
|Name|Description|Schema|
615
594
|---|---|---|
595
+
|**FileLength** <br>*optional*|The length of the file dfget requests to download in bytes.|integer (int64)|
616
596
|**ID** <br>*optional*|ID of the created task.|string|
597
+
|**PieceSize** <br>*optional*|The size of pieces which is calculated as per the following strategy<br>1. If file's total size is less than 200MB, then the piece size is 4MB by default.<br>2. Otherwise, it equals to the smaller value between totalSize/100MB + 2 MB and 15MB.|integer (int32)|
617
598
618
599
619
600
<aname="taskinfo"></a>
@@ -623,7 +604,19 @@ detailed information about task in supernode.
623
604
624
605
|Name|Description|Schema|
625
606
|---|---|---|
607
+
|**CdnStatus** <br>*optional*|The status of the created task related to CDN functionality.|enum (WAITING, RUNNING, FAILED, SUCCESS, SOURCE_ERROR)|
608
+
|**FileLength** <br>*optional*|The length of the file dfget requests to download in bytes.|integer (int64)|
626
609
|**ID** <br>*optional*|ID of the task.|string|
610
+
|**PieceSize** <br>*optional*|The size of pieces which is calculated as per the following strategy<br>1. If file's total size is less than 200MB, then the piece size is 4MB by default.<br>2. Otherwise, it equals to the smaller value between totalSize/100MB + 2 MB and 15MB.|integer (int32)|
611
+
|**PieceTotal** <br>*optional*||integer (int32)|
612
+
|**callSystem** <br>*optional*|This field is for debugging. When caller of dfget is using it to files, he can pass callSystem<br>name to dfget. When this field is passing to supernode, supernode has ability to filter them via <br>some black/white list to guarantee security, or some other purposes. <br>**Minimum length** : `1`|string|
613
+
|**dfdaemon** <br>*optional*|tells whether it is a call from dfdaemon. dfdaemon is a long running<br>process which works for container engines. It translates the image<br>pulling request into raw requests into those dfget recganises.|boolean|
614
+
|**headers** <br>*optional*|extra HTTP headers sent to the rawURL.<br>This field is carried with the request to supernode. <br>Supernode will extract these HTTP headers, and set them in HTTP downloading requests<br>from source server as user's wish.|< string, string > map|
615
+
|**identifier** <br>*optional*|special attribute of remote source file. This field is used with taskURL to generate new taskID to<br>indetify different downloading task of remote source file. For example, if user A and user B uses<br>the same taskURL and taskID to download file, A and B will share the same peer network to distribute files.<br>If user A additionally adds an indentifier with taskURL, while user B still carries only taskURL, then A's<br>generated taskID is different from B, and the result is that two users use different peer networks.|string|
616
+
|**md5** <br>*optional*|md5 checksum for the resource to distribute. dfget catches this parameter from dfget's CLI<br>and passes it to supernode. When supernode finishes downloading file/image from the source location,<br>it will validate the source file with this md5 value to check whether this is a valid file.|string|
617
+
|**path** <br>*optional*|path is used in one peer A for uploading functionality. When peer B hopes<br>to get piece C from peer A, B must provide a URL for piece C.<br>Then when creating a task in supernode, peer A must provide this URL in request.|string|
618
+
|**rawURL** <br>*optional*|The is the resource's URL which user uses dfget to download. The location of URL can be anywhere, LAN or WAN.<br>For image distribution, this is image layer's URL in image registry.<br>The resource url is provided by command line parameter.|string|
619
+
|**taskURL** <br>*optional*|taskURL is generated from rawURL. rawURL may contains some queries or parameter, dfget will filter some queries via<br>--filter parameter of dfget. The usage of it is that different rawURL may generate the same taskID.|string|
627
620
628
621
629
622
<aname="taskupdaterequest"></a>
@@ -633,7 +626,7 @@ request used to update task attributes.
633
626
634
627
|Name|Description|Schema|
635
628
|---|---|---|
636
-
|**ID** <br>*optional*|ID of the created task.|string|
629
+
|**PeerID** <br>*optional*|ID of the peer which has finished to download the whole task.|string|
0 commit comments