Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset interface {
// GetAsset fetches the asset data for a given CID and returns an io.ReadSeekCloser.
GetAsset(root cid.Cid) (io.ReadSeekCloser, error)
// AssetExists checks whether the asset data for a given CID exists or not.
AssetExists(root cid.Cid) (bool, error)
// HasBlock checks if a block with the given CID is present in the asset data for a given root CID.
HasBlock(ctx context.Context, root, block cid.Cid) (bool, error)
// GetBlock retrieves a block with the given CID from the asset data for a given root CID.
GetBlock(ctx context.Context, root, block cid.Cid) (blocks.Block, error)
// SaveUserAsset save user asset to local
SaveUserAsset(ctx context.Context, userID string, root cid.Cid, assetSize int64, r io.Reader) error
// SetAssetUploadProgress set progress of upload for asset
SetAssetUploadProgress(ctx context.Context, root cid.Cid, progress *types.UploadProgress) error
// GetUploadingAsset get asset which uploading
GetUploadingAsset(ctx context.Context, root cid.Cid) (*types.UploadingAsset, error)
// AllocatePathWithSize allocate path for storage file
AllocatePathWithSize(size int64) (string, error)
}
Asset represents an interface for fetching and checking asset data.
type DirectoryResult ¶ added in v0.1.11
type FileList ¶ added in v0.1.11
type FileList struct {
FileProperties []FileProperty
Name string
Size int64
Total int
}
type FileProperty ¶ added in v0.1.11
SubAsset the content of directory
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func NewHttpServer ¶
func NewHttpServer(opts *HttpServerOptions) *HttpServer
NewHttpServer creates a new HttpServer with the given Asset, Scheduler, and RSA private key.
func (*HttpServer) FirstToken ¶ added in v0.1.10
func (hs *HttpServer) FirstToken() string
GetDownloadThreadCount get download thread count of httpserver
func (*HttpServer) NewHandler ¶
func (hs *HttpServer) NewHandler(handler http.Handler) http.Handler
NewHandler creates a new Handler with the given HTTP handler
type HttpServerOptions ¶ added in v0.1.10
type HttpServerOptions struct {
Asset Asset
Scheduler api.Scheduler
PrivateKey *rsa.PrivateKey
Validation Validation
APISecret *jwt.HMACSHA
MaxSizeOfUploadFile int
WebRedirect string
RateLimiter *types.RateLimiter
}
type ProgressReader ¶ added in v0.1.10
type ProgressReader struct {
// contains filtered or unexported fields
}
type SpeedCountWriter ¶ added in v0.1.11
type SpeedCountWriter struct {
// contains filtered or unexported fields
}
func (*SpeedCountWriter) CostTime ¶ added in v0.1.11
func (w *SpeedCountWriter) CostTime() float64
ms
func (*SpeedCountWriter) Header ¶ added in v0.1.11
func (w *SpeedCountWriter) Header() http.Header
func (*SpeedCountWriter) Write ¶ added in v0.1.11
func (w *SpeedCountWriter) Write(bytes []byte) (int, error)
func (*SpeedCountWriter) WriteHeader ¶ added in v0.1.11
func (w *SpeedCountWriter) WriteHeader(statusCode int)
type Validation ¶
type Validation interface {
SetFunc(func() string)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.