Documentation
¶
Index ¶
- Constants
- Variables
- func GetSeedPeerClusterConfigBySeedPeer(seedPeer *managerv2.SeedPeer) (types.SeedPeerClusterConfig, error)
- type Config
- type DatabaseConfig
- type DownloadTinyConfig
- type DownloadTinyTLSClientConfig
- type DynConfig
- type DynconfigData
- type DynconfigInterface
- type GCConfig
- type GRPCTLSClientConfig
- type GRPCTLSServerConfig
- type HostConfig
- type JobConfig
- type KeepAliveConfig
- type ManagerConfig
- type MetricsConfig
- type NetworkConfig
- type Observer
- type PeerConfig
- type RedisConfig
- type SchedulerConfig
- type SeedPeerConfig
- type ServerConfig
Constants ¶
View Source
const ( // DefaultSeedPeerConcurrentUploadLimit is default number for seed peer concurrent upload limit. DefaultSeedPeerConcurrentUploadLimit = 2000 // DefaultPeerConcurrentUploadLimit is default number for peer concurrent upload limit. DefaultPeerConcurrentUploadLimit = 200 // DefaultSchedulerCandidateParentLimit is default limit the number of candidate parent. DefaultSchedulerCandidateParentLimit = 4 // DefaultSchedulerFilterParentLimit is default limit the number for filter parent. DefaultSchedulerFilterParentLimit = 15 )
View Source
const ( // DefaultServerPort is default port for server. DefaultServerPort = 8002 // DefaultServerAdvertisePort is default advertise port for server. DefaultServerAdvertisePort = 8002 )
View Source
const ( // DefaultRedisBrokerDB is default db for redis broker. DefaultRedisBrokerDB = 1 // DefaultRedisBackendDB is default db for redis backend. DefaultRedisBackendDB = 2 )
View Source
const ( // DefaultSchedulerAlgorithm is default algorithm for scheduler. DefaultSchedulerAlgorithm = "default" // DefaultSchedulerBackToSourceCount is default back-to-source count for scheduler. DefaultSchedulerBackToSourceCount = 200 // DefaultSchedulerRetryBackToSourceLimit is default retry back-to-source limit for scheduler. DefaultSchedulerRetryBackToSourceLimit = 4 // DefaultSchedulerRetryLimit is default retry limit for scheduler. DefaultSchedulerRetryLimit = 5 // DefaultSchedulerRetryInterval is default retry interval for scheduler. DefaultSchedulerRetryInterval = 500 * time.Millisecond // DefaultSchedulerPieceDownloadTimeout is default timeout of downloading piece. DefaultSchedulerPieceDownloadTimeout = 30 * time.Minute // DefaultSchedulerPeerGCInterval is default interval for peer gc. DefaultSchedulerPeerGCInterval = 10 * time.Second // DefaultSchedulerPeerTTL is default ttl for peer. DefaultSchedulerPeerTTL = 24 * time.Hour // DefaultSchedulerTaskGCInterval is default interval for task gc. DefaultSchedulerTaskGCInterval = 30 * time.Minute // DefaultSchedulerHostGCInterval is default interval for host gc. DefaultSchedulerHostGCInterval = 5 * time.Minute // DefaultSchedulerHostTTL is default ttl for host. DefaultSchedulerHostTTL = 1 * time.Hour // DefaultRefreshModelInterval is model refresh interval. DefaultRefreshModelInterval = 168 * time.Hour // DefaultCPU is default cpu usage. DefaultCPU = 1 )
View Source
const ( // DefaultManagerSchedulerClusterID is default id for scheduler cluster. DefaultManagerSchedulerClusterID = 1 // DefaultManagerKeepAliveInterval is default interval for keepalive. DefaultManagerKeepAliveInterval = 5 * time.Second )
View Source
const ( // DefaultJobGlobalWorkerNum is default global worker number for job. DefaultJobGlobalWorkerNum = 500 // DefaultJobSchedulerWorkerNum is default scheduler worker number for job. DefaultJobSchedulerWorkerNum = 500 // DefaultJobGlobalWorkerNum is default local worker number for job. DefaultJobLocalWorkerNum = 1000 // DefaultJobRedisBrokerDB is default db for redis broker. DefaultJobRedisBrokerDB = 1 // DefaultJobRedisBackendDB is default db for redis backend. DefaultJobRedisBackendDB = 2 )
View Source
const ( // DefaultLogRotateMaxSize is the default maximum size in megabytes of log files before rotation. DefaultLogRotateMaxSize = 1024 // DefaultLogRotateMaxAge is the default number of days to retain old log files. DefaultLogRotateMaxAge = 7 // DefaultLogRotateMaxBackups is the default number of old log files to keep. DefaultLogRotateMaxBackups = 20 )
View Source
const ( // DefaultDynConfigRefreshInterval is default refresh interval for dynamic configuration. DefaultDynConfigRefreshInterval = 1 * time.Minute )
View Source
const (
// DefaultMetricsAddr is default address for metrics server.
DefaultMetricsAddr = ":8000"
)
View Source
const ( // DefaultSeedTaskDownloadTimeout is default timeout of downloading task by seed peer. DefaultSeedPeerTaskDownloadTimeout = 10 * time.Hour )
Variables ¶
View Source
var ( // DefaultCertIPAddresses is default ip addresses of certificate. DefaultCertIPAddresses = []net.IP{ip.IPv4, ip.IPv6} // DefaultCertDNSNames is default dns names of certificate. DefaultCertDNSNames = []string{"dragonfly-scheduler", "dragonfly-scheduler.dragonfly-system.svc", "dragonfly-scheduler.dragonfly-system.svc.cluster.local"} // DefaultCertValidityPeriod is default validity period of certificate. DefaultCertValidityPeriod = 180 * 24 * time.Hour )
View Source
var ( // DefaultNetworkEnableIPv6 is default value of enableIPv6. DefaultNetworkEnableIPv6 = false )
Functions ¶
func GetSeedPeerClusterConfigBySeedPeer ¶ added in v2.0.9
func GetSeedPeerClusterConfigBySeedPeer(seedPeer *managerv2.SeedPeer) (types.SeedPeerClusterConfig, error)
GetSeedPeerClusterConfigBySeedPeer returns the seed peer cluster config by seed peer.
Types ¶
type Config ¶
type Config struct {
// Base options.
base.Options `yaml:",inline" mapstructure:",squash"`
// Server configuration.
Server ServerConfig `yaml:"server" mapstructure:"server"`
// Scheduler configuration.
Scheduler SchedulerConfig `yaml:"scheduler" mapstructure:"scheduler"`
// Database configuration.
Database DatabaseConfig `yaml:"database" mapstructure:"database"`
// Dynconfig configuration.
DynConfig DynConfig `yaml:"dynConfig" mapstructure:"dynConfig"`
// Manager configuration.
Manager ManagerConfig `yaml:"manager" mapstructure:"manager"`
// SeedPeer configuration.
SeedPeer SeedPeerConfig `yaml:"seedPeer" mapstructure:"seedPeer"`
// Peer configuration.
Peer PeerConfig `yaml:"peer" mapstructure:"peer"`
// Host configuration.
Host HostConfig `yaml:"host" mapstructure:"host"`
// Job configuration.
Job JobConfig `yaml:"job" mapstructure:"job"`
// Metrics configuration.
Metrics MetricsConfig `yaml:"metrics" mapstructure:"metrics"`
// Network configuration.
Network NetworkConfig `yaml:"network" mapstructure:"network"`
}
type DatabaseConfig ¶ added in v2.0.30
type DatabaseConfig struct {
// Redis configuration.
Redis RedisConfig `yaml:"redis" mapstructure:"redis"`
}
type DownloadTinyConfig ¶ added in v2.0.30
type DownloadTinyConfig struct {
// Scheme is download tiny task scheme.
Scheme string `yaml:"scheme" mapstructure:"scheme"`
// Timeout is http request timeout.
Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"`
// TLS is download tiny task TLS configuration.
TLS DownloadTinyTLSClientConfig `yaml:"tls" mapstructure:"tls"`
}
type DownloadTinyTLSClientConfig ¶ added in v2.0.30
type DownloadTinyTLSClientConfig struct {
// InsecureSkipVerify controls whether a client verifies the
// server's certificate chain and host name.
InsecureSkipVerify bool `yaml:"insecureSkipVerify" mapstructure:"insecureSkipVerify"`
}
type DynconfigData ¶
type DynconfigData struct {
Scheduler *managerv2.Scheduler
Applications []*managerv2.Application
}
type DynconfigInterface ¶
type DynconfigInterface interface {
// GetResolveSeedPeerAddrs returns the dynamic schedulers resolve addrs.
GetResolveSeedPeerAddrs() ([]resolver.Address, error)
// GetScheduler returns the scheduler config from manager.
GetScheduler() (*managerv2.Scheduler, error)
// GetApplications returns the applications config from manager.
GetApplications() ([]*managerv2.Application, error)
// GetSeedPeers returns the dynamic seed peers config from manager.
GetSeedPeers() ([]*managerv2.SeedPeer, error)
// GetSeedPeerClusterConfig returns the seed peer cluster config.
GetSeedPeerClusterConfig() (types.SeedPeerClusterConfig, error)
// GetSchedulerCluster returns the scheduler cluster config from manager.
GetSchedulerCluster() (*managerv2.SchedulerCluster, error)
// GetSchedulerClusterConfig returns the scheduler cluster config.
GetSchedulerClusterConfig() (types.SchedulerClusterConfig, error)
// GetSchedulerClusterClientConfig returns the client config.
GetSchedulerClusterClientConfig() (types.SchedulerClusterClientConfig, error)
// Get returns the dynamic config from manager.
Get() (*DynconfigData, error)
// Refresh refreshes dynconfig in cache.
Refresh() 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.V2, cacheDir string, cfg *Config, transportCredentials credentials.TransportCredentials) (DynconfigInterface, error)
NewDynconfig returns a new dynconfig instance.
type GCConfig ¶
type GCConfig struct {
// PieceDownloadTimeout is timeout of downloading piece.
PieceDownloadTimeout time.Duration `yaml:"pieceDownloadTimeout" mapstructure:"pieceDownloadTimeout"`
// PeerGCInterval is interval of peer gc.
PeerGCInterval time.Duration `yaml:"peerGCInterval" mapstructure:"peerGCInterval"`
// PeerTTL is time to live of peer. If the peer has been downloaded by other peers,
// then PeerTTL will be reset.
PeerTTL time.Duration `yaml:"peerTTL" mapstructure:"peerTTL"`
// TaskGCInterval is interval of task gc. If all the peers have been reclaimed in the task,
// then the task will also be reclaimed.
TaskGCInterval time.Duration `yaml:"taskGCInterval" mapstructure:"taskGCInterval"`
// HostGCInterval is interval of host gc.
HostGCInterval time.Duration `yaml:"hostGCInterval" mapstructure:"hostGCInterval"`
// HostTTL is time to live of host. If host announces message to scheduler,
// then HostTTl will be reset.
HostTTL time.Duration `yaml:"hostTTL" mapstructure:"hostTTL"`
}
type GRPCTLSClientConfig ¶ added in v2.1.61
type GRPCTLSClientConfig struct {
// CACert is the file path of CA certificate for mTLS.
CACert string `yaml:"caCert" mapstructure:"caCert"`
// Cert is the file path of client certificate for mTLS.
Cert string `yaml:"cert" mapstructure:"cert"`
// Key is the file path of client key for mTLS.
Key string `yaml:"key" mapstructure:"key"`
}
type GRPCTLSServerConfig ¶ added in v2.1.61
type GRPCTLSServerConfig struct {
// CACert is the file path of CA certificate for mTLS.
CACert string `yaml:"caCert" mapstructure:"caCert"`
// Cert is the file path of server certificate for mTLS.
Cert string `yaml:"cert" mapstructure:"cert"`
// Key is the file path of server key for mTLS.
Key string `yaml:"key" mapstructure:"key"`
}
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"`
// DEPRECATED: Please use the `database.redis` field instead.
Redis RedisConfig `yaml:"redis" mapstructure:"redis"`
}
type KeepAliveConfig ¶
type ManagerConfig ¶
type ManagerConfig struct {
// Addr is manager address.
Addr string `yaml:"addr" mapstructure:"addr"`
// TLS client configuration.
TLS *GRPCTLSClientConfig `yaml:"tls" mapstructure:"tls"`
// 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 NetworkConfig ¶ added in v2.0.7
type NetworkConfig struct {
// EnableIPv6 enables ipv6 for server.
EnableIPv6 bool `mapstructure:"enableIPv6" yaml:"enableIPv6"`
}
type Observer ¶
type Observer interface {
// OnNotify allows an event to be published to interface implementations.
OnNotify(*DynconfigData)
}
type PeerConfig ¶ added in v2.1.63
type PeerConfig struct {
// TLS client configuration.
TLS *GRPCTLSClientConfig `yaml:"tls" mapstructure:"tls"`
}
type RedisConfig ¶
type RedisConfig struct {
// DEPRECATED: Please use the `addrs` field instead.
Host string `yaml:"host" mapstructure:"host"`
// DEPRECATED: Please use the `addrs` field instead.
Port int `yaml:"port" mapstructure:"port"`
// Addrs is server addresses.
Addrs []string `yaml:"addrs" mapstructure:"addrs"`
// MasterName is the sentinel master name.
MasterName string `yaml:"masterName" mapstructure:"masterName"`
// Username is server username.
Username string `yaml:"username" mapstructure:"username"`
// Password is server password.
Password string `yaml:"password" mapstructure:"password"`
// SentinelUsername is sentinel server username.
SentinelUsername string `yaml:"sentinelUsername" mapstructure:"sentinelUsername"`
// SentinelPassword is sentinel server password.
SentinelPassword string `yaml:"sentinelPassword" mapstructure:"sentinelPassword"`
// BrokerDB is broker database name.
BrokerDB int `yaml:"brokerDB" mapstructure:"brokerDB"`
// BackendDB is backend database name.
BackendDB int `yaml:"backendDB" mapstructure:"backendDB"`
}
type SchedulerConfig ¶
type SchedulerConfig struct {
// Algorithm is scheduling algorithm used by the scheduler.
Algorithm string `yaml:"algorithm" mapstructure:"algorithm"`
// BackToSourceCount is single task allows the peer to back-to-source count.
BackToSourceCount int `yaml:"backToSourceCount" mapstructure:"backToSourceCount"`
// RetryBackToSourceLimit reaches the limit, then the peer back-to-source.
RetryBackToSourceLimit int `yaml:"retryBackToSourceLimit" mapstructure:"retryBackToSourceLimit"`
// RetryLimit reaches the limit, then scheduler returns scheduling failed.
RetryLimit int `yaml:"retryLimit" mapstructure:"retryLimit"`
// RetryInterval is scheduling interval.
RetryInterval time.Duration `yaml:"retryInterval" mapstructure:"retryInterval"`
// GC configuration.
GC GCConfig `yaml:"gc" mapstructure:"gc"`
}
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"`
// TLS client configuration.
TLS *GRPCTLSClientConfig `yaml:"tls" mapstructure:"tls"`
// TaskDownloadTimeout is timeout of downloading task by seed peer.
TaskDownloadTimeout time.Duration `yaml:"taskDownloadTimeout" mapstructure:"taskDownloadTimeout"`
}
type ServerConfig ¶
type ServerConfig struct {
// AdvertiseIP is advertise ip.
AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"`
// AdvertisePort is advertise port.
AdvertisePort int `yaml:"advertisePort" mapstructure:"advertisePort"`
// ListenIP is listen ip, like: 0.0.0.0, 192.168.0.1.
ListenIP net.IP `yaml:"listenIP" mapstructure:"listenIP"`
// Server port.
Port int `yaml:"port" mapstructure:"port"`
// Server hostname.
Host string `yaml:"host" mapstructure:"host"`
// TLS server configuration.
TLS *GRPCTLSServerConfig `yaml:"tls" mapstructure:"tls"`
// Server dynamic config cache directory.
CacheDir string `yaml:"cacheDir" mapstructure:"cacheDir"`
// Server log directory.
LogDir string `yaml:"logDir" mapstructure:"logDir"`
// Maximum size in megabytes of log files before rotation (default: 1024)
LogMaxSize int `yaml:"logMaxSize" mapstructure:"logMaxSize"`
// Maximum number of days to retain old log files (default: 7)
LogMaxAge int `yaml:"logMaxAge" mapstructure:"logMaxAge"`
// Maximum number of old log files to keep (default: 20)
LogMaxBackups int `yaml:"logMaxBackups" mapstructure:"logMaxBackups"`
// Server plugin directory.
PluginDir string `yaml:"pluginDir" mapstructure:"pluginDir"`
// Server storage data directory.
DataDir string `yaml:"dataDir" mapstructure:"dataDir"`
}
Click to show internal directories.
Click to hide internal directories.