Versions in this module Expand all Collapse all v1 v1.0.1 Mar 6, 2023 v1.0.0 Nov 2, 2022 Changes in this version + const FNV1A_INIT + const FNV1A_PRIME + const MaxBodyLength + const MaxKeyLength + const VERSION + const VIRTUAL_NODES + var ConnectTimeout time.Duration = time.Millisecond * 300 + var MaxFreeConns = 20 + var ReadTimeout time.Duration = time.Millisecond * 2000 + var WriteTimeout time.Duration = time.Millisecond * 2000 + func NewMapStore() *mapStore + func WriteFull(w io.Writer, buf []byte) error + type AutoScheduler struct + func NewAutoScheduler(config []string, bs int) *AutoScheduler + func (c *AutoScheduler) DivideKeysByBucket(keys []string) [][]string + func (c *AutoScheduler) Feedback(host *Host, key string, adjust float64) + func (c *AutoScheduler) GetHostsByKey(key string) []*Host + func (c *AutoScheduler) Stats() map[string][]float64 + type Client struct + N int + R int + W int + func NewClient(sch Scheduler, N, W, R int) (c *Client) + func (c *Client) Append(key string, value []byte) (ok bool, targets []string, final_err error) + func (c *Client) Delete(key string) (r bool, targets []string, err error) + func (c *Client) Get(key string) (r *Item, targets []string, err error) + func (c *Client) GetMulti(keys []string) (rs map[string]*Item, targets []string, err error) + func (c *Client) Incr(key string, value int) (result int, targets []string, err error) + func (c *Client) Len() int + func (c *Client) Set(key string, item *Item, noreply bool) (ok bool, targets []string, final_err error) + type ConsistantHashScheduler struct + func (c *ConsistantHashScheduler) DivideKeysByBucket(keys []string) [][]string + func (c *ConsistantHashScheduler) GetHostsByKey(key string) []*Host + func (c ConsistantHashScheduler) Feedback(host *Host, key string, adjust float64) + func (c ConsistantHashScheduler) Stats() map[string][]float64 + type DistributeStorage interface + Append func(key string, value []byte) (bool, []string, error) + Delete func(key string) (bool, []string, error) + Get func(key string) (*Item, []string, error) + GetMulti func(keys []string) (map[string]*Item, []string, error) + Incr func(key string, value int) (int, []string, error) + Len func() int + Set func(key string, item *Item, noreply bool) (bool, []string, error) + type Feedback struct + type HashMethod func(v []byte) (h uint32) + type Host struct + Addr string + func NewHost(addr string) *Host + func (host *Host) Append(key string, value []byte) (bool, error) + func (host *Host) Close() + func (host *Host) Delete(key string) (bool, error) + func (host *Host) Get(key string) (*Item, error) + func (host *Host) GetMulti(keys []string) (map[string]*Item, error) + func (host *Host) Incr(key string, value int) (int, error) + func (host *Host) Len() int + func (host *Host) Set(key string, item *Item, noreply bool) (bool, error) + func (host *Host) Stat(keys []string) (map[string]string, error) + type Item struct + Body []byte + Cas int + Exptime int + Flag int + func (it *Item) String() (s string) + type ManualScheduler struct + N int + func NewManualScheduler(config map[string][]string, bs, n int) *ManualScheduler + func (c *ManualScheduler) DivideKeysByBucket(keys []string) [][]string + func (c *ManualScheduler) Feedback(host *Host, key string, adjust float64) + func (c *ManualScheduler) GetHostsByKey(key string) (hosts []*Host) + func (c *ManualScheduler) Stats() map[string][]float64 + type ModScheduler struct + func (c *ModScheduler) DivideKeysByBucket(keys []string) [][]string + func (c *ModScheduler) GetHostsByKey(key string) []*Host + func (c *ModScheduler) Stats() map[string][]float64 + func (c ModScheduler) Feedback(host *Host, key string, adjust float64) + type RClient struct + N int + R int + W int + func NewRClient(sch Scheduler, N, W, R int) (c *RClient) + func (c *RClient) Append(key string, value []byte) (ok bool, targets []string, final_err error) + func (c *RClient) Delete(key string) (r bool, targets []string, err error) + func (c *RClient) Get(key string) (r *Item, targets []string, err error) + func (c *RClient) GetMulti(keys []string) (rs map[string]*Item, targets []string, err error) + func (c *RClient) Incr(key string, value int) (result int, target []string, err error) + func (c *RClient) Len() int + func (c *RClient) Set(key string, item *Item, noreply bool) (ok bool, targets []string, final_err error) + type Request struct + Cmd string + Item *Item + Keys []string + NoReply bool + func (req *Request) Check(resp *Response) error + func (req *Request) Clear() + func (req *Request) Process(store DistributeStorage, stat *Stats) (resp *Response, targets []string, err error) + func (req *Request) Read(b *bufio.Reader) (e error) + func (req *Request) String() (s string) + func (req *Request) Write(w io.Writer) (e error) + type Response struct + func (resp *Response) CleanBuffer() + func (resp *Response) Read(b *bufio.Reader) error + func (resp *Response) String() (s string) + func (resp *Response) Write(w io.Writer) error + type Scheduler interface + DivideKeysByBucket func(keys []string) [][]string + Feedback func(host *Host, key string, adjust float64) + GetHostsByKey func(key string) []*Host + Stats func() map[string][]float64 + func NewConsistantHashScheduler(hosts []string, hashname string) Scheduler + func NewModScheduler(hosts []string, hashname string) Scheduler + type Stats struct + func NewStats() *Stats + func (s *Stats) Stats() map[string]int64 + func (s *Stats) UpdateStat(key string, value int64) + type StdLogger interface + Print func(v ...interface{}) + Printf func(format string, v ...interface{}) + Println func(v ...interface{}) + var Logger StdLogger = log.New(ioutil.Discard, "[BeansDB-Client] ", log.LstdFlags) + type Storage interface + Append func(key string, value []byte) (bool, error) + Delete func(key string) (bool, error) + Get func(key string) (*Item, error) + GetMulti func(keys []string) (map[string]*Item, error) + Incr func(key string, value int) (int, error) + Len func() int + Set func(key string, item *Item, noreply bool) (bool, error)