Documentation
¶
Index ¶
- Constants
- func CopiedBytes(source []byte) (destination []byte)
- func EscapeColon(s string) string
- func FileExists(path string) bool
- func Filter(xs []string, f func(string) bool) []string
- func GenerateRandomId() []byte
- func HasBucketInDomain(host string, prefix string, domains []string) (ok bool, bucket string)
- func Keys(v interface{}) []string
- func Map(xs []string, f func(string) string) []string
- func MarshalTOMLConfig() error
- func MsgPackMarshal(v interface{}) ([]byte, error)
- func MsgPackUnMarshal(data []byte, v interface{}) error
- func ReadJsonBody(body io.ReadCloser, out interface{}) (err error)
- func SetupConfig()
- func StringInSlice(s string, ss []string) bool
- func SubString(str string, begin, length int) (substr string)
- func Ternary(IF bool, THEN interface{}, ELSE interface{}) interface{}
- func UnescapeColon(s string) string
- func UnicodeIndex(str, substr string) int
- type Config
- type KMSConfig
- type MsgBusConfig
- type PluginConfig
- type Serializable
Constants ¶
View Source
const ( S3_CONF_PATH = "/etc/multi-cloud/s3.toml" MIN_DOWNLOAD_BUFPOOL_SIZE = 512 << 10 // 512k MAX_DOWNLOAD_BUFPOOL_SIZE = 8 << 20 // 8M )
Variables ¶
This section is empty.
Functions ¶
func CopiedBytes ¶
func EscapeColon ¶
func FileExists ¶
func GenerateRandomId ¶
func GenerateRandomId() []byte
func HasBucketInDomain ¶
func Keys ¶
func Keys(v interface{}) []string
Get keys of a map, i.e. map[string]interface{} -> []string Note that some type checks are omitted for efficiency, you need to ensure them yourself, otherwise your program should panic
func MarshalTOMLConfig ¶
func MarshalTOMLConfig() error
func MsgPackMarshal ¶
func MsgPackUnMarshal ¶
func ReadJsonBody ¶
func ReadJsonBody(body io.ReadCloser, out interface{}) (err error)
read from ReadCloser and unmarshal to out; `out` should be of POINTER type
func SetupConfig ¶
func SetupConfig()
func StringInSlice ¶
func Ternary ¶
func Ternary(IF bool, THEN interface{}, ELSE interface{}) interface{}
mimic `?:` operator Need type assertion to convert output to expected type
func UnescapeColon ¶
func UnicodeIndex ¶
Types ¶
type Config ¶
type Config struct {
S3Domain []string `toml:"s3domain"` // Domain name of YIG
Region string `toml:"region"` // Region name this instance belongs to, e.g cn-bj-1
Plugins map[string]PluginConfig `toml:"plugins"`
LogPath string `toml:"log_path"`
AccessLogPath string `toml:"access_log_path"`
AccessLogFormat string `toml:"access_log_format"`
PanicLogPath string `toml:"panic_log_path"`
PidFile string `toml:"pid_file"`
BindApiAddress string `toml:"api_listener"`
BindAdminAddress string `toml:"admin_listener"`
SSLKeyPath string `toml:"ssl_key_path"`
SSLCertPath string `toml:"ssl_cert_path"`
ZookeeperAddress string `toml:"zk_address"`
InstanceId string // if empty, generated one at server startup
ConcurrentRequestLimit int
HbaseZnodeParent string // won't change default("/hbase") if leave this option empty
HbaseTimeout time.Duration // in seconds
DebugMode bool `toml:"debug_mode"`
AdminKey string `toml:"admin_key"` //used for tools/admin to communicate with yig
GcThread int `toml:"gc_thread"`
LcThread int //used for tools/lc only, set worker numbers to do lc
LcDebug bool //used for tools/lc only, if this was set true, will treat days as seconds
LogLevel int `toml:"log_level"` //1-20
CephConfigPattern string `toml:"ceph_config_pattern"`
ReservedOrigins string `toml:"reserved_origins"` // www.ccc.com,www.bbb.com,127.0.0.1
MetaStore string `toml:"meta_store"`
TidbInfo string `toml:"tidb_info"`
KeepAlive bool `toml:"keepalive"`
//About cache
RedisAddress string `toml:"redis_address"` // redis connection string, e.g localhost:1234
RedisConnectionNumber int `toml:"redis_connection_number"` // number of connections to redis(i.e max concurrent request number)
RedisPassword string `toml:"redis_password"` // redis auth password
MetaCacheType int `toml:"meta_cache_type"`
EnableDataCache bool `toml:"enable_data_cache"`
RedisMode int `toml:"redis_mode"`
RedisNodes []string `toml:"redis_nodes"`
RedisSentinelMasterName string `toml:"redis_sentinel_master_name"`
RedisConnectTimeout int `toml:"redis_connect_timeout"`
RedisReadTimeout int `toml:"redis_read_timeout"`
RedisWriteTimeout int `toml:"redis_write_timeout"`
RedisKeepAlive int `toml:"redis_keepalive"`
RedisPoolMaxIdle int `toml:"redis_pool_max_idle"`
RedisPoolIdleTimeout int `toml:"redis_pool_idle_timeout"`
// If the value is not 0, the cached ping detection will be turned on, and the interval is the number of seconds.
CacheCircuitCheckInterval int `toml:"cache_circuit_check_interval"`
// This property sets the amount of seconds, after tripping the circuit,
// to reject requests before allowing attempts again to determine if the circuit should again be closed.
CacheCircuitCloseSleepWindow int `toml:"cache_circuit_close_sleep_window"`
// This value is how may consecutive passing requests are required before the circuit is closed
CacheCircuitCloseRequiredCount int `toml:"cache_circuit_close_required_count"`
// This property sets the minimum number of requests in a rolling window that will trip the circuit.
CacheCircuitOpenThreshold int `toml:"cache_circuit_open_threshold"`
DownLoadBufPoolSize int `toml:"download_buf_pool_size"`
KMS KMSConfig `toml:"kms"`
// Message Bus
MsgBus MsgBusConfig `toml:"msg_bus"`
}
var CONFIG Config
type MsgBusConfig ¶
type MsgBusConfig struct {
// Controls whether to enable message bus when receive the request.
Enabled bool `toml:"msg_bus_enable"`
// Controls the under implementation of message bus: 1 for kafka.
Type int `toml:"msg_bus_type"`
// Controls the message topic used by message bus.
Topic string `toml:"msg_bus_topic"`
// Controls the request timeout for sending a req through message bus.
RequestTimeoutMs int `toml:"msg_bus_request_timeout_ms"`
// Controls the total timeout for sending a req through message bus.
// It will timeout if min(MessageTimeoutMs, SendMaxRetries * RequestTimeoutMs) meets.
MessageTimeoutMs int `toml:"msg_bus_message_timeout_ms"`
// Controls the retry time used by message bus if it fails to send a req.
SendMaxRetries int `toml:"msg_bus_send_max_retries"`
// Controls the settings for the implementation of message bus.
// For kafka, the 'broker_list' must be set, like 'broker_list = "kafka:29092"'
Server map[string]interface{} `toml:"msg_bus_server"`
}
type PluginConfig ¶
Click to show internal directories.
Click to hide internal directories.