Documentation
¶
Overview ¶
Package types defines all types of data send, received and stored. Do not use 'map[string]string' to define a data transported between different modules(systems). It's hard to read and maintain.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type BaseResponse struct {
// Code represents whether the response is successful.
Code int `json:"code"`
// Msg describes the detailed error message if the response is failed.
Msg string `json:"msg"`
}
BaseResponse defines the common fields of responses from supernode. Types of supernode's responses could be defines as following:
type XXResponse struct {
*BaseResponse
Data *CustomizedDataStruct
}
func NewBaseResponse ¶
func NewBaseResponse(code int, msg string) *BaseResponse
NewBaseResponse create a BaseResponse instance.
func (*BaseResponse) IsSuccess ¶
func (res *BaseResponse) IsSuccess() bool
IsSuccess is used for determining whether the response is successful.
type PullPieceTaskRequest ¶
type PullPieceTaskRequest struct {
SrcCid string
DstCid string
Range string
Result string
Status string
TaskID string
}
PullPieceTaskRequest is send to supernodes when pulling pieces.
type RegisterRequest ¶
type RegisterRequest struct {
RawURL string `json:"rawUrl"`
TaskURL string `json:"taskUrl"`
Md5 string `json:"md5"`
Identifier string `json:"identifier"`
Version string `json:"version"`
Port int `json:"port"`
Path string `json:"path"`
CallSystem string `json:"callSystem"`
Cid string `json:"cid"`
IP string `json:"ip"`
HostName string `json:"hostName"`
Headers string `json:"headers"`
Dfdaemon bool `json:"dfdaemon"`
}
RegisterRequest contains all the parameters that need to be passed to the supernode when registering a downloading task.
type RegisterResponse ¶
type RegisterResponse struct {
*BaseResponse
Data *RegisterResponseData `json:"data"`
}
RegisterResponse is the response of register request.
type RegisterResponseData ¶
type RegisterResponseData struct {
TaskID string `json:"taskId"`
FileLength int64 `json:"fileLength"`
PieceSize int32 `json:"pieceSize"`
}
RegisterResponseData is the data when registering supernode successfully.