Documentation ¶
Index ¶
- Constants
- type Config
- type DynConfig
- type DynconfigData
- type DynconfigInterface
- type GCConfig
- type HostConfig
- type JobConfig
- type KeepAliveConfig
- type ManagerConfig
- type MetricsConfig
- type Observer
- type RedisConfig
- type SchedulerCluster
- type SchedulerConfig
- type SeedPeer
- type SeedPeerCluster
- type SeedPeerConfig
- type ServerConfig
- type StorageConfig
Constants ¶
View Source
const ( // Default number of seed peer load limit. DefaultSeedPeerLoadLimit = 300 // Default number of client load limit. DefaultClientLoadLimit = 50 // Default number of pieces to download in parallel. DefaultClientParallelCount = 4 // Default limit the number of filter traversals. DefaultSchedulerFilterParentLimit = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Base options. base.Options `yaml:",inline" mapstructure:",squash"` // Scheduler configuration. Scheduler *SchedulerConfig `yaml:"scheduler" mapstructure:"scheduler"` // Server configuration. Server *ServerConfig `yaml:"server" mapstructure:"server"` // Dynconfig configuration. DynConfig *DynConfig `yaml:"dynConfig" mapstructure:"dynConfig"` // Manager configuration. Manager *ManagerConfig `yaml:"manager" mapstructure:"manager"` // SeedPeer configuration. SeedPeer *SeedPeerConfig `yaml:"seedPeer" mapstructure:"seedPeer"` // Host configuration. Host *HostConfig `yaml:"host" mapstructure:"host"` // Job configuration. Job *JobConfig `yaml:"job" mapstructure:"job"` // Storage configuration. Storage *StorageConfig `yaml:"storage" mapstructure:"storage"` // Metrics configuration. Metrics *MetricsConfig `yaml:"metrics" mapstructure:"metrics"` }
type DynconfigData ¶
type DynconfigData struct { SeedPeers []*SeedPeer `yaml:"seedPeers" mapstructure:"seedPeers" json:"seed_peers"` SchedulerCluster *SchedulerCluster `yaml:"schedulerCluster" mapstructure:"schedulerCluster" json:"scheduler_cluster"` }
type DynconfigInterface ¶
type DynconfigInterface interface { // Get the scheduler cluster config. GetSchedulerClusterConfig() (types.SchedulerClusterConfig, bool) // Get the client config. GetSchedulerClusterClientConfig() (types.SchedulerClusterClientConfig, bool) // 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() error }
func NewDynconfig ¶
func NewDynconfig(rawManagerClient managerclient.Client, cacheDir string, cfg *Config) (DynconfigInterface, error)
type GCConfig ¶
type GCConfig struct { // Peer gc interval. PeerGCInterval time.Duration `yaml:"peerGCInterval" mapstructure:"peerGCInterval"` // Peer time to live. PeerTTL time.Duration `yaml:"peerTTL" mapstructure:"peerTTL"` // Task gc interval. TaskGCInterval time.Duration `yaml:"taskGCInterval" mapstructure:"taskGCInterval"` // Task time to live. TaskTTL time.Duration `yaml:"taskTTL" mapstructure:"taskTTL"` // Host gc interval. HostGCInterval time.Duration `yaml:"hostGCInterval" mapstructure:"hostGCInterval"` // Host time to live. HostTTL time.Duration `yaml:"hostTTL" mapstructure:"hostTTL"` }
type HostConfig ¶
type JobConfig ¶
type JobConfig struct { // Enable job service. Enable bool `yaml:"enable" mapstructure:"enable"` // Number of workers in global queue. GlobalWorkerNum uint `yaml:"globalWorkerNum" mapstructure:"globalWorkerNum"` // Number of workers in scheduler queue. SchedulerWorkerNum uint `yaml:"schedulerWorkerNum" mapstructure:"schedulerWorkerNum"` // Number of workers in local queue. LocalWorkerNum uint `yaml:"localWorkerNum" mapstructure:"localWorkerNum"` // Redis configuration. 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 MetricsConfig ¶ added in v2.0.1
type Observer ¶
type Observer interface { // OnNotify allows an event to be "published" to interface implementations. OnNotify(*DynconfigData) }
type RedisConfig ¶
type RedisConfig struct { // Server hostname. Host string `yaml:"host" mapstructure:"host"` // Server port. Port int `yaml:"port" mapstructure:"port"` // Server password. Password string `yaml:"password" mapstructure:"password"` // Broker database name. BrokerDB int `yaml:"brokerDB" mapstructure:"brokerDB"` // Backend database name. BackendDB int `yaml:"backendDB" mapstructure:"backendDB"` }
type SchedulerCluster ¶ added in v2.0.1
type SchedulerConfig ¶
type SchedulerConfig struct { // Scheduling algorithm used by the scheduler. Algorithm string `yaml:"algorithm" mapstructure:"algorithm"` // Single task allows the client to back-to-source count. BackSourceCount int `yaml:"backSourceCount" mapstructure:"backSourceCount"` // Retry scheduling back-to-source limit times. RetryBackSourceLimit int `yaml:"retryBackSourceLimit" mapstructure:"retryBackSourceLimit"` // Retry scheduling limit times. RetryLimit int `yaml:"retryLimit" mapstructure:"retryLimit"` // Retry scheduling interval. RetryInterval time.Duration `yaml:"retryInterval" mapstructure:"retryInterval"` // Task and peer gc configuration. GC *GCConfig `yaml:"gc" mapstructure:"gc"` }
type SeedPeer ¶ added in v2.0.3
type SeedPeer struct { ID uint `yaml:"id" mapstructure:"id" json:"id"` Hostname string `yaml:"hostname" mapstructure:"hostname" json:"host_name"` Type string `yaml:"type" mapstructure:"type" json:"type"` IsCDN bool `yaml:"isCDN" mapstructure:"isCDN" json:"is_cdn"` IDC string `yaml:"idc" mapstructure:"idc" json:"idc"` NetTopology string `yaml:"netTopology" mapstructure:"netTopology" json:"net_topology"` Location string `yaml:"location" mapstructure:"location" json:"location"` 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"` SeedPeerCluster *SeedPeerCluster `yaml:"seedPeerCluster" mapstructure:"seedPeerCluster" json:"seed_peer_cluster"` }
func (*SeedPeer) GetSeedPeerClusterConfig ¶ added in v2.0.3
func (c *SeedPeer) GetSeedPeerClusterConfig() (types.SeedPeerClusterConfig, bool)
type SeedPeerCluster ¶ added in v2.0.3
type SeedPeerCluster struct {
Config []byte `yaml:"config" mapstructure:"config" json:"config"`
}
type SeedPeerConfig ¶ added in v2.0.3
type SeedPeerConfig struct { // Enable is to enable seed peer as P2P peer. Enable bool `yaml:"enable" mapstructure:"enable"` }
type ServerConfig ¶
type ServerConfig struct { // Server ip. IP string `yaml:"ip" mapstructure:"ip"` // Server hostname. Host string `yaml:"host" mapstructure:"host"` // Listen stands listen interface, like: 0.0.0.0, 192.168.0.1. Listen string `yaml:"listen" mapstructure:"listen"` // Server port. Port int `yaml:"port" mapstructure:"port"` // Server dynamic config cache directory. CacheDir string `yaml:"cacheDir" mapstructure:"cacheDir"` // Server log directory. LogDir string `yaml:"logDir" mapstructure:"logDir"` }
type StorageConfig ¶ added in v2.0.3
type StorageConfig struct { // MaxSize sets the maximum size in megabytes of storage file. MaxSize int `yaml:"maxSize" mapstructure:"maxSize"` // MaxBackups sets the maximum number of storage files to retain. MaxBackups int `yaml:"maxBackups" mapstructure:"maxBackups"` // BufferSize sets the size of buffer container, // if the buffer is full, write all the records in the buffer to the file. BufferSize int `yaml:"bufferSize" mapstructure:"bufferSize"` }
Click to show internal directories.
Click to hide internal directories.