Documentation ¶
Index ¶
- Constants
- Variables
- func BucketIDHex(id, numBucket int) string
- func DumpConfig(config interface{})
- func IsValidKeySize(ksz uint32) bool
- func IsValidValueSize(vsz uint32) bool
- func LoadYamlConfig(config interface{}, path string) error
- func NewZK(root string, servers []string) (c *zkClient, err error)
- func UpdateLocalRoute(content []byte)
- type DBRouteConfig
- type MCConfig
- type RouteTable
- type Server
- type ServerConfig
Constants ¶
View Source
const AccessLogVersion = "V1"
View Source
const AnalysisLogVersion = "V2"
Variables ¶
View Source
var ( ServerConf ServerConfig = DefaultServerConfig Route RouteTable MCConf MCConfig = DefaultMCConfig AllowReload bool )
View Source
var ( ZKClient *zkClient LocalRoutePath string )
View Source
var (
DefaultMCConfig = MCConfig{
MaxReq: 16,
MaxKeyLen: 250,
BodyMaxStr: "50M",
BodyBigStr: "1M",
BodyInCStr: "4K",
FlushMaxStr: "100M",
TimeoutMS: 3000,
}
)
View Source
var DefaultRouteConfig = DBRouteConfig{NumBucket: 16, BucketsStat: make([]int, 16)}
DefaultRouteConfig = route.RouteConfig{NumBucket: 256, Buckets: make([]int, 256)}
View Source
var ( DefaultServerConfig = ServerConfig{ Hostname: "127.0.0.1", Listen: "0.0.0.0", Port: 7900, WebPort: 7903, Threads: 4, ZKServers: nil, ErrorLog: "./gobeansdb.log", AccessLog: "", StaticDir: "./", } )
View Source
var Version = "2.1.0.18"
`Version` can be changed in gobeansproxy.
Functions ¶
func BucketIDHex ¶
func DumpConfig ¶
func DumpConfig(config interface{})
func IsValidKeySize ¶
func IsValidValueSize ¶
func LoadYamlConfig ¶
func UpdateLocalRoute ¶
func UpdateLocalRoute(content []byte)
Types ¶
type DBRouteConfig ¶
type MCConfig ¶
type MCConfig struct { MaxKeyLen int `yaml:"max_key_len,omitempty"` MaxReq int `yaml:"max_req,omitempty"` // max num of requsets serve at the same time BodyMax int64 `yaml:"-"` // fail set/read_file if larger then this BodyBig int64 `yaml:"-"` // set may fail if memory is in shorage (determine by "storage") BodyInC int64 `yaml:"-"` // alloc body in cgo if larger then this FlushMax int64 `yaml:"-"` // if flush buffer is larger, may fail BIG set request (return NOT_FOUND) FlushMaxStr string `yaml:"flush_max_str"` BodyMaxStr string `yaml:"body_max_str,omitempty"` BodyBigStr string `yaml:"body_big_str,omitempty"` BodyInCStr string `yaml:"body_c_str,omitempty"` TimeoutMS int `yaml:"timeout_ms,omitempty"` }
type RouteTable ¶
type RouteTable struct { NumBucket int Main []Server Backup []string Buckets map[int]map[string]bool `yaml:"-"` Servers map[string]map[int]bool `yaml:"-"` }
func LoadRouteTableLocal ¶
func LoadRouteTableLocal(path string) (*RouteTable, error)
func LoadRouteTableZK ¶
func LoadRouteTableZK(path, cluster string, zkservers []string) (*RouteTable, error)
func (*RouteTable) GetDBRouteConfig ¶
func (rt *RouteTable) GetDBRouteConfig(addr string) (r DBRouteConfig)
func (*RouteTable) LoadFromYaml ¶
func (rt *RouteTable) LoadFromYaml(data []byte) error
type Server ¶
type ServerConfig ¶
type ServerConfig struct { Hostname string `yaml:",omitempty"` ZKPath string `yaml:",omitempty"` // root path in zk ZKServers []string `yaml:",omitempty"` // e.g. "zk1:2181,zk2:2181" Listen string `yaml:",omitempty"` // ip Port int `yaml:",omitempty"` WebPort int `yaml:",omitempty"` Threads int `yaml:",omitempty"` // NumCPU ErrorLog string `yaml:",omitempty"` AccessLog string `yaml:",omitempty"` AnalysisLog string `yanl:",omitempty"` StaticDir string `yaml:",omitempty"` // directory for static files, e.g. *.html }
func (*ServerConfig) Addr ¶
func (c *ServerConfig) Addr() string
Click to show internal directories.
Click to hide internal directories.