Documentation ¶
Index ¶
- Constants
- Variables
- func NewManagerClient(client managerclient.Client, schedulerClusterID uint) dc.ManagerClient
- type CDN
- type Config
- type DynConfig
- type DynconfigData
- type DynconfigInterface
- type GCConfig
- type HostConfig
- type JobConfig
- type KeepAliveConfig
- type ManagerConfig
- type Observer
- type RedisConfig
- type SchedulerConfig
- type ServerConfig
Constants ¶
View Source
const ( AttributePeerRegisterRequest = attribute.Key("d7y.peer.register.request") AttributeTaskSizeScope = attribute.Key("d7y.task.size.scope") AttributeSinglePiece = attribute.Key("d7y.peer.single.piece") AttributePieceReceived = attribute.Key("d7y.peer.piece.received") AttributeLeavePeerID = attribute.Key("d7y.leave.peer.id") AttributeLeaveTaskID = attribute.Key("d7y.leave.task.id") AttributeReportPeerID = attribute.Key("d7y.report.peer.id") AttributePeerDownloadSuccess = attribute.Key("d7y.peer.download.success") AttributeDownloadFileURL = attribute.Key("d7y.file.url") AttributeContentLength = attribute.Key("d7y.source.content.length") AttributePeerDownloadResult = attribute.Key("d7y.peer.download.result") AttributeSchedulePacket = attribute.Key("d7y.schedule.packet") AttributeTaskID = attribute.Key("d7y.peer.task.id") AttributePeerID = attribute.Key("d7y.peer.id") AttributeCDNSeedRequest = attribute.Key("d7y.cdn.seed.request") AttributeNeedSeedCDN = attribute.Key("d7y.need.seed.cdn") AttributeTaskStatus = attribute.Key("d7y.task.status") AttributeLastTriggerTime = attribute.Key("d7y.task.last.trigger.time") AttributeClientBackSource = attribute.Key("d7y.need.client.back-source") AttributeTriggerCDNError = attribute.Key("d7y.trigger.cdn.error") )
View Source
const ( SpanPeerRegister = "peer-register" SpanTriggerCDNSeed = "trigger-cdn-seed" SpanReportPieceResult = "report-piece-result" SpanReportPeerResult = "report-peer-result" SpanPeerLeave = "peer-leave" )
View Source
const ( EventSmallTaskSelectParentFail = "small-task-select-parent-fail" EventPeerNotFound = "peer-not-found" EventHostNotFound = "host-not-found" EventCreateCDNPeer = "create-cdn-peer" EventCDNPieceReceived = "receive-cdn-piece" EventPeerDownloaded = "downloaded" EventDownloadTinyFile = "download-tiny-file" EventCDNFailBackClientSource = "cdn-fail-back-client-source" )
Variables ¶
View Source
var (
DefaultDynconfigCachePath = filepath.Join(dfpath.DefaultCacheDir, "scheduler_dynconfig")
)
Functions ¶
func NewManagerClient ¶
func NewManagerClient(client managerclient.Client, schedulerClusterID uint) dc.ManagerClient
Types ¶
type CDN ¶
type CDN struct { HostName string `yaml:"hostname" mapstructure:"hostname" json:"host_name"` IP string `yaml:"ip" mapstructure:"ip" json:"ip"` Port int32 `yaml:"port" mapstructure:"port" json:"port"` DownloadPort int32 `yaml:"downloadPort" mapstructure:"downloadPort" json:"download_port"` SecurityGroup string `yaml:"securityGroup" mapstructure:"securityGroup" json:"security_group"` Location string `yaml:"location" mapstructure:"location" json:"location"` IDC string `yaml:"idc" mapstructure:"idc" json:"idc"` NetTopology string `yaml:"netTopology" mapstructure:"netTopology" json:"net_topology"` LoadLimit int32 `yaml:"loadLimit" mapstructure:"loadLimit" json:"load_limit"` }
type Config ¶
type Config struct { base.Options `yaml:",inline" mapstructure:",squash"` Scheduler *SchedulerConfig `yaml:"scheduler" mapstructure:"scheduler"` Server *ServerConfig `yaml:"server" mapstructure:"server"` DynConfig *DynConfig `yaml:"dynConfig" mapstructure:"dynConfig"` Manager *ManagerConfig `yaml:"manager" mapstructure:"manager"` Host *HostConfig `yaml:"host" mapstructure:"host"` Job *JobConfig `yaml:"job" mapstructure:"job"` DisableCDN bool `yaml:"disableCDN" mapstructure:"disableCDN"` }
type DynConfig ¶
type DynConfig struct { // Type is dynconfig source type. Type dc.SourceType `yaml:"type" mapstructure:"type"` // ExpireTime is expire time for manager cache. ExpireTime time.Duration `yaml:"expireTime" mapstructure:"expireTime"` // CDNDirPath is cdn dir. CDNDirPath string `yaml:"cdnDirPath" mapstructure:"cdnDirPath"` // Data is dynconfig local data. Data *DynconfigData `yaml:"data" mapstructure:"data"` }
type DynconfigData ¶
type DynconfigData struct {
CDNs []*CDN `yaml:"cdns" mapstructure:"cdns"`
}
type DynconfigInterface ¶
type DynconfigInterface interface { // Get the dynamic config from manager. Get() (*DynconfigData, error) // Register allows an instance to register itself to listen/observe events. Register(Observer) // Deregister allows an instance to remove itself from the collection of observers/listeners. Deregister(Observer) // Notify publishes new events to listeners. Notify() error // Serve the dynconfig listening service. Serve() error // Stop the dynconfig listening service. Stop() }
func NewDynconfig ¶
func NewDynconfig(sourceType dc.SourceType, cdnDirPath string, options ...dc.Option) (DynconfigInterface, error)
TODO(Gaius) Rely on manager to delete cdnDirPath
type GCConfig ¶
type GCConfig struct { PeerGCInterval time.Duration `yaml:"peerGCInterval" mapstructure:"peerGCInterval"` // PeerTTL is advised to set the time to be smaller than the expire time of a task in the CDN PeerTTL time.Duration `yaml:"peerTTL" mapstructure:"peerTTL"` PeerTTI time.Duration `yaml:"peerTTI" mapstructure:"peerTTI"` TaskGCInterval time.Duration `yaml:"taskGCInterval" mapstructure:"taskGCInterval"` TaskTTL time.Duration `yaml:"taskTTL" mapstructure:"taskTTL"` TaskTTI time.Duration `yaml:"taskTTI" mapstructure:"taskTTI"` }
type HostConfig ¶
type JobConfig ¶
type JobConfig struct { GlobalWorkerNum uint `yaml:"globalWorkerNum" mapstructure:"globalWorkerNum"` SchedulerWorkerNum uint `yaml:"schedulerWorkerNum" mapstructure:"schedulerWorkerNum"` LocalWorkerNum uint `yaml:"localWorkerNum" mapstructure:"localWorkerNum"` Redis *RedisConfig `yaml:"redis" mapstructure:"redis"` }
type KeepAliveConfig ¶
type ManagerConfig ¶
type ManagerConfig struct { // Addr is manager address. Addr string `yaml:"addr" mapstructure:"addr"` // SchedulerClusterID is scheduler cluster id. SchedulerClusterID uint `yaml:"schedulerClusterID" mapstructure:"schedulerClusterID"` // KeepAlive configuration KeepAlive KeepAliveConfig `yaml:"keepAlive" mapstructure:"keepAlive"` }
type Observer ¶
type Observer interface { // OnNotify allows an event to be "published" to interface implementations. OnNotify(*DynconfigData) }
type RedisConfig ¶
type SchedulerConfig ¶
type SchedulerConfig struct { ABTest bool `yaml:"abtest" mapstructure:"abtest"` AEvaluator string `yaml:"aevaluator" mapstructure:"aevaluator"` BEvaluator string `yaml:"bevaluator" mapstructure:"bevaluator"` WorkerNum int `yaml:"workerNum" mapstructure:"workerNum"` BackSourceCount int32 `yaml:"backSourceCount" mapstructure:"backSourceCount"` // AccessWindow should less than CDN task expireTime AccessWindow time.Duration `yaml:"accessWindow" mapstructure:"accessWindow"` CandidateParentCount int `yaml:"candidateParentCount" mapstructure:"candidateParentCount"` Scheduler string `yaml:"scheduler" mapstructure:"scheduler"` CDNLoad int `yaml:"cdnLoad" mapstructure:"cdnLoad"` ClientLoad int32 `yaml:"clientLoad" mapstructure:"clientLoad"` OpenMonitor bool `yaml:"openMonitor" mapstructure:"openMonitor"` GC *GCConfig `yaml:"gc" mapstructure:"gc"` }
type ServerConfig ¶
Click to show internal directories.
Click to hide internal directories.