Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultSystemReservedBandwidth is the default network bandwidth reserved for system software. // unit: MB/s DefaultSystemReservedBandwidth = 20 * unit.MB // DefaultMaxBandwidth is the default network bandwidth that cdn can use. // unit: MB/s DefaultMaxBandwidth = 1 * unit.GB )
View Source
const ( CacheReport = "cache" DownloaderReport = "download" )
View Source
const (
DefaultWriterRoutineLimit = 4
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v2.0.2
type Config struct { // SystemReservedBandwidth is the network bandwidth reserved for system software. // default: 20 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. SystemReservedBandwidth unit.Bytes `yaml:"systemReservedBandwidth" mapstructure:"systemReservedBandwidth"` // MaxBandwidth is the network bandwidth that cdn system can use. // default: 200 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. MaxBandwidth unit.Bytes `yaml:"maxBandwidth" mapstructure:"maxBandwidth"` // WriterRoutineLimit is the count of write goroutine for one task WriterRoutineLimit int `yaml:"WriterRoutineLimit" mapstructure:"WriterRoutineLimit"` }
func DefaultConfig ¶ added in v2.0.2
func DefaultConfig() Config
type Manager ¶
type Manager interface { // TriggerCDN will trigger the download resource from sourceURL. TriggerCDN(context.Context, *task.SeedTask) (*task.SeedTask, error) // Delete the cdn meta with specified taskID. // The file on the disk will be deleted when the force is true. Delete(taskID string) error // TryFreeSpace checks if the free space of the storage is larger than the fileLength. TryFreeSpace(fileLength int64) (bool, error) }
Manager as an interface defines all operations against CDN and operates on the underlying files stored on the local disk, etc.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.