helper

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *log.Logger

Functions

func CopiedBytes

func CopiedBytes(source []byte) (destination []byte)

func Debug added in v1.1.0

func Debug(format string, args ...interface{})

func Debugln added in v1.1.0

func Debugln(args ...interface{})

func ErrorIf added in v1.1.0

func ErrorIf(err error, msg string, data ...interface{})

errorIf synonymous with fatalIf but doesn't exit on error != nil

func FatalIf added in v1.1.0

func FatalIf(err error, msg string, data ...interface{})

fatalIf wrapper function which takes error and prints error messages.

func FileExists

func FileExists(path string) bool

func Filter

func Filter(xs []string, f func(string) bool) []string

func GenerateRandomId

func GenerateRandomId() []byte

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 Map

func Map(xs []string, f func(string) string) []string

func MsgPackMarshal

func MsgPackMarshal(v interface{}) ([]byte, error)

func MsgPackUnMarshal

func MsgPackUnMarshal(data []byte, v interface{}) error

func SetupConfig

func SetupConfig()

func StringInSlice

func StringInSlice(s string, ss []string) bool

func SubString

func SubString(str string, begin, length int) (substr string)

func Ternary

func Ternary(IF bool, THEN interface{}, ELSE interface{}) interface{}

mimic `?:` operator Need type assertion to convert output to expected type

func UnicodeIndex

func UnicodeIndex(str, substr string) int

Types

type Config

type Config struct {
	S3Domain                   string // Domain name of YIG
	Region                     string // Region name this instance belongs to, e.g cn-bj-1
	IamEndpoint                string // le IAM endpoint address
	IamKey                     string
	IamSecret                  string
	LogPath                    string
	PanicLogPath               string
	PidFile                    string
	BindApiAddress             string
	BindAdminAddress           string
	SSLKeyPath                 string
	SSLCertPath                string
	ZookeeperAddress           string
	RedisAddress               string // redis connection string, e.g localhost:1234
	RedisConnectionNumber      int    // number of connections to redis(i.e max concurrent request number)
	RedisPassword              string // redis auth passowrd
	InMemoryCacheMaxEntryCount int
	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
	DebugMode                  bool
	AdminKey                   string //used for tools/admin to communicate with yig
	GcThread                   int
	MetaCacheType              int
	EnableDataCache            bool
	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  //1-20
	CephConfigPattern          string
	ReservedOrigins            string // www.ccc.com,www.bbb.com,127.0.0.1
	MetaStore                  string
	TidbInfo                   string
	KeepAlive                  bool
}
var CONFIG Config

Jump to

Keyboard shortcuts

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