Documentation
¶
Index ¶
- Constants
- func AuditData(url, fpath, rpath string, req TeeReq) error
- func CheckStorageNodeAvailable(baseUrl string) error
- func ClaimOffloadingData(url string, req FileRequest) ([]byte, string, error)
- func FetchDataAndFlag(gatewayUrl, token, fid, did string) (string, []byte, error)
- func FetchFile(gatewayUrl, token, fid, did string) ([]byte, error)
- func GetFileFromStorageNode(url, acc, message, sign, fid, fragment, path string) error
- func PushFile(url, fpath string, metaDatas map[string][]byte) ([]byte, error)
- func PushFileToStorageNode(url, acc, message, sign, fid, fragment, path string) error
- func QueryRemainCap(url, requester string) (uint64, error)
- func RechargeCapacity(url, requester string, orderId [32]byte) error
- func SendHttpRequest(method, url string, headers map[string]string, dataReader *bytes.Buffer) ([]byte, error)
- type CacheRequest
- type Cd2nNode
- type DiskStatus
- type DistStatus
- type DownloadStatus
- type FileMeta
- type FileRequest
- type FileResponse
- type Response
- type RetrieveStatus
- type Status
- type StorageNode
- type TeeReq
- type TeeResp
Constants ¶
View Source
const ( FRAGMENT_SIZE = 8 * 1024 * 1024 NODE_STATUS_URL = "/status" CLAIM_DATA_URL = "/claim" PUSH_DATA_URL = "/provide" FETCH_DATA_URL = "/fetch" )
View Source
const ( SUCCESS_MESSAGE = "success" ERROR_MESSAGE = "error" QUERY_DATA_INFO_URL = "/getinfo" FETCH_CACHE_DATA_URL = "/cache-fetch" QUERY_CAPACITY_URL = "/download_traffic_query" AUDIT_DATA_URL = "/audit" QUERY_TEE_INFO = "/query_information" )
Justicar API URL
Variables ¶
This section is empty.
Functions ¶
func ClaimOffloadingData ¶
func ClaimOffloadingData(url string, req FileRequest) ([]byte, string, error)
func FetchDataAndFlag ¶ added in v0.1.2
func GetFileFromStorageNode ¶
func PushFileToStorageNode ¶
func QueryRemainCap ¶
func RechargeCapacity ¶
Types ¶
type CacheRequest ¶
type Cd2nNode ¶
type Cd2nNode struct { Version string `json:"version"` WorkAddr string `json:"work_addr"` TeeAddr string `json:"tee_addr"` TeePubkey []byte `json:"tee_pubkey"` EndPoint string `json:"endpoint"` RedisAddr string `json:"redis_addr"` PoolId string `json:"poolid"` IsGateway bool `json:"is_gateway"` ActiveStorageNodes []string `json:"active_storage_nodes"` Status `json:"status"` }
func CheckCdnNodeAvailable ¶
type DiskStatus ¶
type DistStatus ¶
type DownloadStatus ¶
type DownloadStatus struct {
DlingNum uint64 `json:"dling_num"`
}
type FileRequest ¶
type FileRequest struct { Pubkey []byte `json:"pubkey"` Fid string `json:"fid"` Timestamp string `json:"timestamp"` StorageNodes []StorageNode `json:"storage_nodes"` Sign string `json:"sign"` }
type FileResponse ¶
type FileResponse struct { Fid string `json:"fid"` Fragments []string `json:"fragments"` Token string `json:"token"` }
func ClaimFile ¶
func ClaimFile(url string, req FileRequest) (FileResponse, error)
type RetrieveStatus ¶
type Status ¶
type Status struct { DiskStatus `json:"disk_status"` DistStatus `json:"dist_status"` RetrieveStatus `json:"retrieve_status"` DownloadStatus `json:"download_status"` }
type StorageNode ¶
type TeeReq ¶
type TeeReq struct { Cid string `json:"cid,omitempty"` UserAcc string `json:"user_eth_address,omitempty"` Key []byte `json:"key,omitempty"` UserSign []byte `json:"user_sign"` SupplierAcc string `json:"supplier_acc,omitempty"` OrderId []byte `json:"oid,omitempty"` RequestId string `json:"requestId,omitempty"` Nonce []byte `json:"nonce,omitempty"` Data []byte `json:"data,omitempty"` }
Click to show internal directories.
Click to hide internal directories.