Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(key, text []byte) ([]byte, error)
- func DeleteCollaboratorRequest(baseUrl string, allocationID string, allocationTx string, query *url.Values) (*http.Request, error)
- func Encrypt(key, text []byte) ([]byte, error)
- func GetActiveBlobbers(dirMask uint32, blobbers []*blockchain.StorageNode) []*blockchain.StorageNode
- func GetCollaboratorsRequest(baseUrl string, allocationID string, allocationTx string, query *url.Values) (*http.Request, error)
- func GetErrorMessageCode(errorMsg string) (string, error)
- func GetFastHTTPClient() *fasthttp.Client
- func GetFastRateLimitValue(r *fasthttp.Response) (int, error)
- func GetFileContentType(ext string, out io.ReadSeeker) (string, error)
- func GetFullRemotePath(localPath, remotePath string) string
- func GetLogger() *logger.Logger
- func GetRateLimitValue(r *http.Response) (int, error)
- func GetRefsHash(r []byte) string
- func HttpDo(ctx context.Context, cncl context.CancelFunc, req *http.Request, ...) error
- func IsRemoteAbs(path string) bool
- func MajorError(errors []error) error
- func MakeSCRestAPICall(scAddress string, relativePath string, params map[string]string, ...) ([]byte, error)
- func NewAllocationRequest(baseUrl, allocationID, allocationTx string) (*http.Request, error)
- func NewCalculateHashRequest(baseUrl, allocationID string, allocationTx string, paths []string) (*http.Request, error)
- func NewCollaboratorRequest(baseUrl string, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewCommitRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewConnectionId() string
- func NewConnectionRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewCopyRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewCreateDirRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewDeleteRequest(baseUrl, allocationID string, allocationTx string, query *url.Values) (*http.Request, error)
- func NewDownloadRequest(baseUrl, allocationID, allocationTx string) (*http.Request, error)
- func NewFastDownloadRequest(baseUrl, allocationID, allocationTx string) (*fasthttp.Request, error)
- func NewFastUploadRequest(baseURL, allocationID string, allocationTx string, body []byte, method string) (*fasthttp.Request, error)
- func NewFileMetaRequest(baseUrl string, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewFileStatsRequest(baseUrl string, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewHTTPRequest(method string, url string, data []byte) (*http.Request, context.Context, context.CancelFunc, error)
- func NewListRequest(baseUrl, allocationID, allocationTx, path, pathHash, auth_token string, ...) (*http.Request, error)
- func NewMoveRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewObjectTreeRequest(baseUrl, allocationID string, allocationTx string, path string) (*http.Request, error)
- func NewRecentlyAddedRefsRequest(bUrl, allocID, allocTx string, fromDate, offset int64, pageLimit int) (*http.Request, error)
- func NewRedeemRequest(baseUrl, allocationID, allocationTx string) (*http.Request, error)
- func NewReferencePathRequest(baseUrl, allocationID string, allocationTx string, paths []string) (*http.Request, error)
- func NewRefsRequest(...) (*http.Request, error)
- func NewRenameRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewRevokeShareRequest(baseUrl, allocationID string, allocationTx string, query *url.Values) (*http.Request, error)
- func NewRollbackRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewShareRequest(baseUrl, allocationID string, allocationTx string, body io.Reader) (*http.Request, error)
- func NewUploadRequest(baseUrl, allocationID string, allocationTx string, body io.Reader, update bool) (*http.Request, error)
- func NewUploadRequestWithMethod(baseURL, allocationID string, allocationTx string, body io.Reader, ...) (*http.Request, error)
- func NewWriteMarkerLockRequest(baseURL, allocationID, allocationTx, connID string) (*http.Request, error)
- func NewWriteMarkerUnLockRequest(baseURL, allocationID, allocationTx, connID, requestTime string) (*http.Request, error)
- func NewWritemarkerRequest(baseUrl, allocationID, allocationTx string) (*http.Request, error)
- func RemoteClean(path string) string
- func ScryptDecrypt(key, ciphertext []byte) ([]byte, error)
- func ScryptEncrypt(key, text []byte) ([]byte, error)
- func Transpose(matrix [][]allocationchange.AllocationChange) [][]allocationchange.AllocationChange
- type DownloadBuffer
- type DownloadBufferWithChan
- type DownloadBufferWithMask
- type FastClient
- type HttpClient
- type SCRestAPIHandler
- type Uint128
- func (x Uint128) Add(y Uint128) Uint128
- func (x Uint128) Add64(y uint64) Uint128
- func (x Uint128) And(v Uint128) Uint128
- func (x Uint128) And64(y uint64) Uint128
- func (x Uint128) CountOnes() int
- func (x Uint128) Equals(y Uint128) bool
- func (x Uint128) Equals64(y uint64) bool
- func (x Uint128) Lsh(y uint64) Uint128
- func (x Uint128) Not() Uint128
- func (x Uint128) Or(v Uint128) Uint128
- func (x Uint128) Sub(y Uint128) Uint128
- func (x Uint128) Sub64(y uint64) Uint128
- func (x Uint128) TrailingZeros() int
- func (x Uint128) Xor(v Uint128) Uint128
Constants ¶
View Source
const ( ALLOCATION_ENDPOINT = "/allocation" UPLOAD_ENDPOINT = "/v1/file/upload/" RENAME_ENDPOINT = "/v1/file/rename/" COPY_ENDPOINT = "/v1/file/copy/" MOVE_ENDPOINT = "/v1/file/move/" LIST_ENDPOINT = "/v1/file/list/" REFERENCE_ENDPOINT = "/v1/file/referencepath/" CONNECTION_ENDPOINT = "/v1/connection/details/" COMMIT_ENDPOINT = "/v1/connection/commit/" DOWNLOAD_ENDPOINT = "/v1/file/download/" LATEST_READ_MARKER = "/v1/readmarker/latest" FILE_META_ENDPOINT = "/v1/file/meta/" FILE_STATS_ENDPOINT = "/v1/file/stats/" OBJECT_TREE_ENDPOINT = "/v1/file/objecttree/" REFS_ENDPOINT = "/v1/file/refs/" RECENT_REFS_ENDPOINT = "/v1/file/refs/recent/" COLLABORATOR_ENDPOINT = "/v1/file/collaborator/" CALCULATE_HASH_ENDPOINT = "/v1/file/calculatehash/" SHARE_ENDPOINT = "/v1/marketplace/shareinfo/" DIR_ENDPOINT = "/v1/dir/" PLAYLIST_LATEST_ENDPOINT = "/v1/playlist/latest/" PLAYLIST_FILE_ENDPOINT = "/v1/playlist/file/" WM_LOCK_ENDPOINT = "/v1/writemarker/lock/" CREATE_CONNECTION_ENDPOINT = "/v1/connection/create/" LATEST_WRITE_MARKER_ENDPOINT = "/v1/file/latestwritemarker/" ROLLBACK_ENDPOINT = "/v1/connection/rollback/" REDEEM_ENDPOINT = "/v1/connection/redeem/" // CLIENT_SIGNATURE_HEADER represents http request header contains signature. CLIENT_SIGNATURE_HEADER = "X-App-Client-Signature" CLIENT_SIGNATURE_HEADER_V2 = "X-App-Client-Signature-V2" ALLOCATION_ID_HEADER = "ALLOCATION-ID" )
View Source
const EncryptedFolderName = "encrypted"
View Source
const MAX_RETRIES = 5
View Source
const SC_REST_API_URL = "v1/screst/"
View Source
const SLEEP_BETWEEN_RETRIES = 5
Variables ¶
View Source
var ( Client HttpClient FastHttpClient FastClient )
View Source
var DefaultTransport = &http.Transport{ Proxy: envProxy.Proxy, DialContext: (&net.Dialer{ Timeout: 3 * time.Minute, KeepAlive: 45 * time.Second, DualStack: true, }).DialContext, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 45 * time.Second, ExpectContinueTimeout: 1 * time.Second, MaxIdleConnsPerHost: 25, }
Functions ¶
func GetActiveBlobbers ¶ added in v1.8.6
func GetActiveBlobbers(dirMask uint32, blobbers []*blockchain.StorageNode) []*blockchain.StorageNode
func GetCollaboratorsRequest ¶
func GetErrorMessageCode ¶ added in v1.8.16
Returns the error message code, message should be strictly of the format: ".... err: {"code" : <return_this>, ...}, ..."
func GetFastHTTPClient ¶ added in v1.15.9
func GetFastRateLimitValue ¶ added in v1.13.0
func GetFileContentType ¶
func GetFileContentType(ext string, out io.ReadSeeker) (string, error)
func GetFullRemotePath ¶
func GetRefsHash ¶ added in v1.3.0
func IsRemoteAbs ¶
func MajorError ¶ added in v1.8.16
func MakeSCRestAPICall ¶
func NewAllocationRequest ¶
func NewCalculateHashRequest ¶
func NewCollaboratorRequest ¶
func NewCommitRequest ¶
func NewConnectionRequest ¶ added in v1.8.17
func NewCopyRequest ¶
func NewCreateDirRequest ¶
func NewDeleteRequest ¶
func NewDownloadRequest ¶
func NewFastDownloadRequest ¶ added in v1.13.0
func NewFastUploadRequest ¶ added in v1.13.0
func NewFileMetaRequest ¶
func NewFileStatsRequest ¶
func NewHTTPRequest ¶
func NewListRequest ¶
func NewMoveRequest ¶ added in v1.8.10
func NewObjectTreeRequest ¶
func NewRecentlyAddedRefsRequest ¶ added in v1.8.7
func NewRedeemRequest ¶ added in v1.8.17
func NewReferencePathRequest ¶
func NewRefsRequest ¶ added in v1.3.0
func NewRenameRequest ¶
func NewRevokeShareRequest ¶
func NewRollbackRequest ¶ added in v1.8.17
func NewShareRequest ¶
func NewUploadRequest ¶
func NewUploadRequestWithMethod ¶ added in v1.2.88
func NewUploadRequestWithMethod(baseURL, allocationID string, allocationTx string, body io.Reader, method string) (*http.Request, error)
NewUploadRequestWithMethod create a http request of upload
func NewWriteMarkerLockRequest ¶ added in v1.8.9
func NewWriteMarkerUnLockRequest ¶ added in v1.8.9
func NewWritemarkerRequest ¶ added in v1.8.17
func RemoteClean ¶
func ScryptDecrypt ¶ added in v1.8.15
func ScryptEncrypt ¶ added in v1.8.15
func Transpose ¶ added in v1.8.17
func Transpose(matrix [][]allocationchange.AllocationChange) [][]allocationchange.AllocationChange
Returns transpose of 2-D slice Example: Given matrix [[a, b], [c, d], [e, f]] returns [[a, c, e], [b, d, f]]
Types ¶
type DownloadBuffer ¶ added in v1.12.1
type DownloadBufferWithChan ¶ added in v1.13.0
type DownloadBufferWithChan struct {
// contains filtered or unexported fields
}
func NewDownloadBufferWithChan ¶ added in v1.13.0
func NewDownloadBufferWithChan(size, numBlocks, effectiveBlockSize int) *DownloadBufferWithChan
func (*DownloadBufferWithChan) ClearBuffer ¶ added in v1.13.7
func (r *DownloadBufferWithChan) ClearBuffer()
func (*DownloadBufferWithChan) ReleaseChunk ¶ added in v1.13.0
func (r *DownloadBufferWithChan) ReleaseChunk(num int)
func (*DownloadBufferWithChan) RequestChunk ¶ added in v1.13.0
func (r *DownloadBufferWithChan) RequestChunk(ctx context.Context, num int) []byte
type DownloadBufferWithMask ¶ added in v1.13.0
type DownloadBufferWithMask struct {
// contains filtered or unexported fields
}
func NewDownloadBufferWithMask ¶ added in v1.13.0
func NewDownloadBufferWithMask(size, numBlocks, effectiveBlockSize int) *DownloadBufferWithMask
func (*DownloadBufferWithMask) ClearBuffer ¶ added in v1.13.7
func (r *DownloadBufferWithMask) ClearBuffer()
func (*DownloadBufferWithMask) ReleaseChunk ¶ added in v1.13.0
func (r *DownloadBufferWithMask) ReleaseChunk(num int)
func (*DownloadBufferWithMask) RequestChunk ¶ added in v1.13.0
func (r *DownloadBufferWithMask) RequestChunk(ctx context.Context, num int) []byte
func (*DownloadBufferWithMask) SetNumBlocks ¶ added in v1.13.14
func (r *DownloadBufferWithMask) SetNumBlocks(numBlocks int)
type FastClient ¶ added in v1.13.0
type SCRestAPIHandler ¶
type Uint128 ¶
type Uint128 struct {
// contains filtered or unexported fields
}
func NewUint128 ¶
func (Uint128) TrailingZeros ¶
TrailingZeros returns the number of trailing zero bits in x; the result is 128 for x == 0.
Click to show internal directories.
Click to hide internal directories.