Documentation ¶
Index ¶
- Constants
- func GetAppendPieceMetaDataRaw(taskID string) *storedriver.Raw
- func GetDownloadHomeRaw() *storedriver.Raw
- func GetDownloadRaw(taskID string) *storedriver.Raw
- func GetParentRaw(taskID string) *storedriver.Raw
- func GetPieceMetaDataRaw(taskID string) *storedriver.Raw
- func GetTaskMetaDataRaw(taskID string) *storedriver.Raw
- func GetUploadHomeRaw() *storedriver.Raw
- func GetUploadRaw(taskID string) *storedriver.Raw
- func IsSupport(mode string) bool
- func Register(name string, builder ManagerBuilder) error
- type Cleaner
- type Config
- type DriverConfig
- type FileMetaData
- type GCConfig
- type Manager
- type ManagerBuilder
- type PieceMetaRecord
Constants ¶
View Source
const ( // DownloadHome is the parent directory where the downloaded files are stored // which is a relative path. DownloadHome = "download" UploadHome = "upload" )
View Source
const ( HybridStorageMode = "hybrid" DiskStorageMode = "disk" )
Variables ¶
This section is empty.
Functions ¶
func GetAppendPieceMetaDataRaw ¶
func GetAppendPieceMetaDataRaw(taskID string) *storedriver.Raw
func GetDownloadHomeRaw ¶
func GetDownloadHomeRaw() *storedriver.Raw
func GetDownloadRaw ¶
func GetDownloadRaw(taskID string) *storedriver.Raw
func GetParentRaw ¶
func GetParentRaw(taskID string) *storedriver.Raw
func GetPieceMetaDataRaw ¶
func GetPieceMetaDataRaw(taskID string) *storedriver.Raw
func GetTaskMetaDataRaw ¶
func GetTaskMetaDataRaw(taskID string) *storedriver.Raw
func GetUploadHomeRaw ¶
func GetUploadHomeRaw() *storedriver.Raw
func GetUploadRaw ¶
func GetUploadRaw(taskID string) *storedriver.Raw
func Register ¶
func Register(name string, builder ManagerBuilder) error
Register defines an interface to register a storage manager with specified name. All storage managers should call this function to register itself to the storage manager factory.
Types ¶
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
func NewStorageCleaner ¶
func NewStorageCleaner(cfg *GCConfig, driver storedriver.Driver, storageMgr Manager, taskMgr daemon.SeedTaskMgr) (*Cleaner, error)
type DriverConfig ¶
type DriverConfig struct {
GCConfig *GCConfig `yaml:"gcConfig"`
}
type FileMetaData ¶
type FileMetaData struct { TaskID string `json:"taskId"` TaskURL string `json:"taskUrl"` PieceSize int32 `json:"pieceSize"` SourceFileLen int64 `json:"sourceFileLen"` AccessTime int64 `json:"accessTime"` Interval int64 `json:"interval"` CdnFileLength int64 `json:"cdnFileLength"` SourceRealMd5 string `json:"sourceRealMd5"` PieceMd5Sign string `json:"pieceMd5Sign"` ExpireInfo map[string]string `json:"expireInfo"` Finish bool `json:"finish"` Success bool `json:"success"` TotalPieceCount int32 `json:"totalPieceCount"` }
FileMetaData
type GCConfig ¶
type GCConfig struct { YoungGCThreshold unit.Bytes `yaml:"youngGCThreshold"` FullGCThreshold unit.Bytes `yaml:"fullGCThreshold"` CleanRatio int `yaml:"cleanRatio"` IntervalThreshold time.Duration `yaml:"intervalThreshold"` }
GcConfig
type Manager ¶
type Manager interface { Initialize(taskMgr daemon.SeedTaskMgr) // ResetRepo reset the storage of task ResetRepo(*types.SeedTask) error // StatDownloadFile StatDownloadFile(taskID string) (*storedriver.StorageInfo, error) // WriteDownloadFile WriteDownloadFile(taskID string, offset int64, len int64, data io.Reader) error // ReadDownloadFile ReadDownloadFile(taskID string) (io.ReadCloser, error) // CreateUploadLink CreateUploadLink(taskID string) error // ReadFileMetaData ReadFileMetaData(taskID string) (*FileMetaData, error) // WriteFileMetaData WriteFileMetaData(taskID string, meta *FileMetaData) error // WritePieceMetaRecords WritePieceMetaRecords(taskID string, metaRecords []*PieceMetaRecord) error // AppendPieceMetaData AppendPieceMetaData(taskID string, metaRecord *PieceMetaRecord) error // ReadPieceMetaRecords ReadPieceMetaRecords(taskID string) ([]*PieceMetaRecord, error) // DeleteTask DeleteTask(taskID string) error }
type ManagerBuilder ¶
ManagerBuilder is a function that creates a new storage manager plugin instant with the giving conf.
type PieceMetaRecord ¶
type PieceMetaRecord struct { PieceNum int32 `json:"pieceNum"` // piece Num start from 0 PieceLen int32 `json:"pieceLen"` // 存储到存储介质的真实长度 Md5 string `json:"md5"` // for transported piece content,不是origin source 的 md5,是真是存储到存储介质后的md5(为了读取数据文件时方便校验完整性) Range *rangeutils.Range `json:"range"` // 下载存储到磁盘的range,不是origin source的range.提供给客户端发送下载请求,for transported piece content OriginRange *rangeutils.Range `json:"originRange"` // piece's real offset in the file PieceStyle types.PieceFormat `json:"pieceStyle"` // 1: PlainUnspecified }
pieceMetaRecord
func ParsePieceMetaRecord ¶
func ParsePieceMetaRecord(value string) (record *PieceMetaRecord, err error)
func (PieceMetaRecord) String ¶
func (record PieceMetaRecord) String() string
Click to show internal directories.
Click to hide internal directories.