Documentation ¶
Index ¶
- Constants
- func GroupDir(product string) string
- func GroupPath(product string, gid int) string
- func JodisPath(product string, token string) string
- func LockPath(product string) string
- func ParseForwardMethod(s string) (int, bool)
- func ProductDir(product string) string
- func ProxyDir(product string) string
- func ProxyPath(product string, token string) string
- func SentinelPath(product string) string
- func SlotPath(product string, sid int) string
- func ValidateProduct(name string) error
- type Client
- type Group
- type GroupServer
- type GroupSlice
- type Proxy
- type ProxySlice
- type Sentinel
- type Slot
- type SlotMapping
- type Store
- func (s *Store) Acquire(topom *Topom) error
- func (s *Store) Client() Client
- func (s *Store) Close() error
- func (s *Store) DeleteGroup(gid int) error
- func (s *Store) DeleteProxy(token string) error
- func (s *Store) GroupDir() string
- func (s *Store) GroupPath(gid int) string
- func (s *Store) ListGroup() (map[int]*Group, error)
- func (s *Store) ListProxy() (map[string]*Proxy, error)
- func (s *Store) LoadGroup(gid int, must bool) (*Group, error)
- func (s *Store) LoadProxy(token string, must bool) (*Proxy, error)
- func (s *Store) LoadSentinel(must bool) (*Sentinel, error)
- func (s *Store) LoadSlotMapping(sid int, must bool) (*SlotMapping, error)
- func (s *Store) LoadTopom(must bool) (*Topom, error)
- func (s *Store) LockPath() string
- func (s *Store) ProxyDir() string
- func (s *Store) ProxyPath(token string) string
- func (s *Store) Release() error
- func (s *Store) SentinelPath() string
- func (s *Store) SlotMappings() ([]*SlotMapping, error)
- func (s *Store) SlotPath(sid int) string
- func (s *Store) UpdateGroup(g *Group) error
- func (s *Store) UpdateProxy(p *Proxy) error
- func (s *Store) UpdateSentinel(p *Sentinel) error
- func (s *Store) UpdateSlotMapping(m *SlotMapping) error
- type Topom
Constants ¶
View Source
const ( ActionNothing = "" ActionPending = "pending" ActionPreparing = "preparing" ActionPrepared = "prepared" ActionMigrating = "migrating" ActionFinished = "finished" ActionSyncing = "syncing" )
View Source
const ( ForwardSync = iota ForwardSemiAsync )
View Source
const CodisDir = "/codis3"
View Source
const JodisDir = "/jodis"
View Source
const MaxGroupId = 9999
View Source
const MaxSlotNum = 1024
Variables ¶
This section is empty.
Functions ¶
func ParseForwardMethod ¶
func ProductDir ¶
func SentinelPath ¶
func ValidateProduct ¶
Types ¶
type Client ¶
type Client interface { Create(path string, data []byte) error Update(path string, data []byte) error Delete(path string) error Read(path string, must bool) ([]byte, error) List(path string, must bool) ([]string, error) Close() error WatchInOrder(path string) (<-chan struct{}, []string, error) CreateEphemeral(path string, data []byte) (<-chan struct{}, error) CreateEphemeralInOrder(path string, data []byte) (<-chan struct{}, string, error) }
type Group ¶
type Group struct { Id int `json:"id"` Servers []*GroupServer `json:"servers"` Promoting struct { Index int `json:"index,omitempty"` State string `json:"state,omitempty"` } `json:"promoting"` OutOfSync bool `json:"out_of_sync"` }
type GroupServer ¶
type GroupSlice ¶
type GroupSlice []*Group
func (GroupSlice) Len ¶
func (s GroupSlice) Len() int
func (GroupSlice) Less ¶
func (s GroupSlice) Less(i, j int) bool
func (GroupSlice) Swap ¶
func (s GroupSlice) Swap(i, j int)
type Proxy ¶
type Proxy struct { Id int `json:"id,omitempty"` Token string `json:"token"` StartTime string `json:"start_time"` AdminAddr string `json:"admin_addr"` ProtoType string `json:"proto_type"` ProxyAddr string `json:"proxy_addr"` JodisPath string `json:"jodis_path,omitempty"` ProductName string `json:"product_name"` Pid int `json:"pid"` Pwd string `json:"pwd"` Sys string `json:"sys"` Hostname string `json:"hostname"` DataCenter string `json:"datacenter"` }
type ProxySlice ¶
type ProxySlice []*Proxy
func (ProxySlice) Len ¶
func (s ProxySlice) Len() int
func (ProxySlice) Less ¶
func (s ProxySlice) Less(i, j int) bool
func (ProxySlice) Swap ¶
func (s ProxySlice) Swap(i, j int)
type Sentinel ¶
type Slot ¶
type Slot struct { Id int `json:"id"` Locked bool `json:"locked,omitempty"` BackendAddr string `json:"backend_addr,omitempty"` BackendAddrGroupId int `json:"backend_addr_group_id,omitempty"` MigrateFrom string `json:"migrate_from,omitempty"` MigrateFromGroupId int `json:"migrate_from_group_id,omitempty"` ForwardMethod int `json:"forward_method,omitempty"` ReplicaGroups [][]string `json:"replica_groups,omitempty"` }
type SlotMapping ¶
type SlotMapping struct { Id int `json:"id"` GroupId int `json:"group_id"` Action struct { Index int `json:"index,omitempty"` State string `json:"state,omitempty"` TargetId int `json:"target_id,omitempty"` } `json:"action"` }
func (*SlotMapping) Encode ¶
func (m *SlotMapping) Encode() []byte
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DeleteGroup ¶
func (*Store) DeleteProxy ¶
func (*Store) LoadSlotMapping ¶
func (s *Store) LoadSlotMapping(sid int, must bool) (*SlotMapping, error)
func (*Store) SentinelPath ¶
func (*Store) SlotMappings ¶
func (s *Store) SlotMappings() ([]*SlotMapping, error)
func (*Store) UpdateGroup ¶
func (*Store) UpdateProxy ¶
func (*Store) UpdateSentinel ¶
func (*Store) UpdateSlotMapping ¶
func (s *Store) UpdateSlotMapping(m *SlotMapping) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.