Skip to content

Commit 01993c9

Browse files
authored
Merge pull request dragonflyoss#275 from pouchrobot/auto-doc-2018-12-21
docs: auto generate Dragonfly cli/api docs via code
2 parents 24d6eec + e2e760f commit 01993c9

File tree

1 file changed

+36
-43
lines changed

1 file changed

+36
-43
lines changed

docs/apis.md

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ PUT /pieces/{id}
197197

198198

199199
#### 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.
201205

202206

203207
#### Parameters
@@ -378,7 +382,8 @@ PUT /tasks/{id}
378382

379383

380384
#### 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.
382387

383388

384389
#### Parameters
@@ -408,33 +413,6 @@ update information of a task.
408413
* `application/json`
409414

410415

411-
<a name="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-
438416
<a name="tasks-id-pieces-get"></a>
439417
### Get pieces in task
440418
```
@@ -443,7 +421,9 @@ GET /tasks/{id}/pieces
443421

444422

445423
#### 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.
447427

448428

449429
#### Parameters
@@ -503,12 +483,9 @@ it will send PeerCreateRequest to supernode.
503483
|---|---|---|
504484
|**ID** <br>*optional*|Peer ID of dfget client. Every peer has a unique ID among peer network.|string|
505485
|**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|
508486
|**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|
512489

513490

514491
<a name="peercreateresponse"></a>
@@ -530,11 +507,8 @@ The detailed information of a peer in supernode.
530507
|---|---|---|
531508
|**ID** <br>*optional*|ID of peer|string|
532509
|**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|
535510
|**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)|
538512
|**version** <br>*optional*|version number of dfget binary|string|
539513

540514

@@ -550,10 +524,12 @@ Peer's detailed information in supernode.
550524

551525
<a name="pieceupdaterequest"></a>
552526
### PieceUpdateRequest
527+
request peer uses to update its status of downloading piece in supernode.
553528

554-
|Name|Schema|
555-
|---|---|
556-
|**ID** <br>*optional*|string|
529+
530+
|Name|Description|Schema|
531+
|---|---|---|
532+
|**PeerID** <br>*optional*|contains the peer ID.|string|
557533

558534

559535
<a name="preheatcreaterequest"></a>
@@ -599,9 +575,12 @@ task because that an image may have more than one layer.
599575

600576
|Name|Description|Schema|
601577
|---|---|---|
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|
602580
|**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|
603581
|**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|
604582
|**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|
605584
|**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|
606585
|**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|
607586

@@ -613,7 +592,9 @@ response get from task creation request.
613592

614593
|Name|Description|Schema|
615594
|---|---|---|
595+
|**FileLength** <br>*optional*|The length of the file dfget requests to download in bytes.|integer (int64)|
616596
|**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)|
617598

618599

619600
<a name="taskinfo"></a>
@@ -623,7 +604,19 @@ detailed information about task in supernode.
623604

624605
|Name|Description|Schema|
625606
|---|---|---|
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)|
626609
|**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|
627620

628621

629622
<a name="taskupdaterequest"></a>
@@ -633,7 +626,7 @@ request used to update task attributes.
633626

634627
|Name|Description|Schema|
635628
|---|---|---|
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|
637630

638631

639632

0 commit comments

Comments
 (0)