config

package
v2.0.2-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultPlugins

func NewDefaultPlugins() map[plugins.PluginType][]*plugins.PluginProperties

NewDefaultPlugins creates plugin instants with default values.

Types

type BaseProperties

type BaseProperties struct {
	// ListenPort is the port cdn server listens on.
	// default: 8002
	ListenPort int `yaml:"listenPort" mapstructure:"listenPort"`

	// DownloadPort is the port for download files from cdn.
	// default: 8001
	DownloadPort int `yaml:"downloadPort" mapstructure:"downloadPort"`

	// 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"`

	// AdvertiseIP is used to set the ip that we advertise to other peer in the p2p-network.
	// By default, the first non-loop address is advertised.
	AdvertiseIP string `yaml:"advertiseIP" mapstructure:"advertiseIP"`

	// FailAccessInterval is the interval time after failed to access the URL.
	// unit: minutes
	// default: 3
	FailAccessInterval time.Duration `yaml:"failAccessInterval" mapstructure:"failAccessInterval"`

	// gc related
	// GCInitialDelay is the delay time from the start to the first GC execution.
	// default: 6s
	GCInitialDelay time.Duration `yaml:"gcInitialDelay" mapstructure:"gcInitialDelay"`

	// GCMetaInterval is the interval time to execute GC meta.
	// default: 2min
	GCMetaInterval time.Duration `yaml:"gcMetaInterval" mapstructure:"gcMetaInterval"`

	// TaskExpireTime when a task is not accessed within the taskExpireTime,
	// and it will be treated to be expired.
	// default: 3min
	TaskExpireTime time.Duration `yaml:"taskExpireTime" mapstructure:"taskExpireTime"`

	// StorageMode disk/hybrid/memory
	StorageMode string `yaml:"storageMode" mapstructure:"storageMode"`

	// Log directory
	LogDir string `yaml:"logDir" mapstructure:"logDir"`

	// WorkHome directory
	WorkHome string `mapstructure:"workHome" yaml:"workHome"`

	// Manager configuration
	Manager ManagerConfig `yaml:"manager" mapstructure:"manager"`

	// Host configuration
	Host HostConfig `yaml:"host" mapstructure:"host"`

	// Metrics configuration
	Metrics *RestConfig `yaml:"metrics" mapstructure:"metrics"`
}

BaseProperties contains all basic properties of cdn system.

func NewDefaultBaseProperties

func NewDefaultBaseProperties() *BaseProperties

NewDefaultBaseProperties creates an base properties instant with default values.

type Config

type Config struct {
	base.Options `yaml:",inline" mapstructure:",squash"`
	Metrics      metrics.Config   `yaml:"metrics" mapstructure:"metrics"`
	Storage      storage.Config   `yaml:"storage" mapstructure:"storage"`
	RPCServer    rpcserver.Config `yaml:"rpcServer" mapstructure:"rpcServer"`
	Task         task.Config      `yaml:"taskConfig" mapstructure:"taskConfig"`
	CDN          cdn.Config       `yaml:"cdnConfig" mapstructure:"cdnConfig"`
	// Manager configuration
	Manager ManagerConfig `yaml:"manager" mapstructure:"manager"`
	// Host configuration
	Host HostConfig `yaml:"host" mapstructure:"host"`
	// Log directory
	LogDir string `yaml:"logDir" mapstructure:"logDir"`
	// WorkHome directory
	WorkHome string `mapstructure:"workHome" yaml:"workHome"`
}

Config contains all configuration of cdn node.

func New

func New() *Config

New creates an instant with default values.

func (*Config) String

func (c *Config) String() string

func (*Config) Validate added in v2.0.2

func (c *Config) Validate() []error

type DeprecatedConfig added in v2.0.2

type DeprecatedConfig struct {
	base.Options    `yaml:",inline" mapstructure:",squash"`
	*BaseProperties `yaml:"base" mapstructure:"base"`

	Plugins map[plugins.PluginType][]*plugins.PluginProperties `yaml:"plugins" mapstructure:"plugins"`
}

DeprecatedConfig contains all configuration of cdn node.

func NewDeprecatedConfig added in v2.0.2

func NewDeprecatedConfig() *DeprecatedConfig

NewDeprecatedConfig creates an instant with default values.

func (DeprecatedConfig) Convert added in v2.0.2

func (c DeprecatedConfig) Convert() *Config

type DriverConfig added in v2.0.2

type DriverConfig struct {
	GCConfig *GCConfig `yaml:"gcConfig"`
}

type GCConfig added in v2.0.2

type GCConfig struct {
	YoungGCThreshold  unit.Bytes    `yaml:"youngGCThreshold"`
	FullGCThreshold   unit.Bytes    `yaml:"fullGCThreshold"`
	CleanRatio        int           `yaml:"cleanRatio"`
	IntervalThreshold time.Duration `yaml:"intervalThreshold"`
}

GCConfig gc config

type HostConfig

type HostConfig struct {
	// Location for scheduler
	Location string `mapstructure:"location" yaml:"location"`

	// IDC for scheduler
	IDC string `mapstructure:"idc" yaml:"idc"`
}

type KeepAliveConfig

type KeepAliveConfig struct {
	// Keep alive interval
	Interval time.Duration `yaml:"interval" mapstructure:"interval"`
}

func (KeepAliveConfig) Validate added in v2.0.2

func (c KeepAliveConfig) Validate() []error

type ManagerConfig

type ManagerConfig struct {
	// NetAddr is manager address.
	Addr string `yaml:"addr" mapstructure:"addr"`

	// CDNClusterID is cdn cluster id.
	CDNClusterID uint `yaml:"cdnClusterID" mapstructure:"cdnClusterID"`

	// KeepAlive configuration
	KeepAlive KeepAliveConfig `yaml:"keepAlive" mapstructure:"keepAlive"`
}

func (ManagerConfig) Validate added in v2.0.2

func (c ManagerConfig) Validate() []error

type RestConfig added in v2.0.1

type RestConfig struct {
	Addr string `yaml:"addr" mapstructure:"addr"`
}

type StorageConfig added in v2.0.2

type StorageConfig struct {
	GCInitialDelay time.Duration            `yaml:"gcInitialDelay"`
	GCInterval     time.Duration            `yaml:"gcInterval"`
	DriverConfigs  map[string]*DriverConfig `yaml:"driverConfigs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL