cc: github.com/jxwr/cc/meta Index | Files

package meta

import "github.com/jxwr/cc/meta"

Index

Package Files

config.go leader.go meta.go zk.go

Constants

const (
    DEFAULT_AUTOFAILOVER_INTERVAL  time.Duration = 5 * time.Minute // 5min
    DEFAULT_MIGRATE_KEYS_EACH_TIME               = 100
    DEFAULT_MIGRATE_TIMEOUT                      = 2000
)
const (
    PERM_DIRECTORY = zookeeper.PermAdmin | zookeeper.PermCreate | zookeeper.PermDelete | zookeeper.PermRead | zookeeper.PermWrite
    PERM_FILE      = zookeeper.PermAdmin | zookeeper.PermRead | zookeeper.PermWrite
)

func AddFailoverRecord Uses

func AddFailoverRecord(record *FailoverRecord) error

func AllRegions Uses

func AllRegions() []string

func AppName Uses

func AppName() string

func AutoFailover Uses

func AutoFailover() bool

func ClusterLeaderZNodeName Uses

func ClusterLeaderZNodeName() string

func CreateRecursive Uses

func CreateRecursive(zconn *zookeeper.Conn, zkPath, value string, flags int32, aclv []zookeeper.ACL) (pathCreated string, err error)

func DialZk Uses

func DialZk(zkAddr string) (*zookeeper.Conn, <-chan zookeeper.Event, error)

func GetUserToken Uses

func GetUserToken(user string) (string, error)

func IsClusterLeader Uses

func IsClusterLeader() bool

func IsDoingFailover Uses

func IsDoingFailover() (bool, error)

func IsInMasterRegion Uses

func IsInMasterRegion() bool

func IsRegionLeader Uses

func IsRegionLeader() bool

func LastFailoverTime Uses

func LastFailoverTime() (*time.Time, error)

func LeaderHttpAddress Uses

func LeaderHttpAddress() string

func LocalRegion Uses

func LocalRegion() string

func MarkFailoverDoing Uses

func MarkFailoverDoing(record *FailoverRecord) error

func MasterRegion Uses

func MasterRegion() string

func MergeSeeds Uses

func MergeSeeds(seeds []*topo.Node)

func PostSeeds Uses

func PostSeeds()

func RegionLeaderHttpAddress Uses

func RegionLeaderHttpAddress() string

func RegionLeaderZNodeName Uses

func RegionLeaderZNodeName() string

func Run Uses

func Run(appName, localRegion string, httpPort, wsPort int, zkAddr string, seeds []*topo.Node, initCh chan error)

func Seeds Uses

func Seeds() []*topo.Node

func UnmarkFailoverDoing Uses

func UnmarkFailoverDoing() error

type AppConfig Uses

type AppConfig struct {
    AppName               string
    AutoEnableSlaveRead   bool
    AutoEnableMasterWrite bool
    AutoFailover          bool
    AutoFailoverInterval  time.Duration
    MasterRegion          string
    Regions               []string
    MigrateKeysEachTime   int
    MigrateTimeout        int
}

func GetAppConfig Uses

func GetAppConfig() *AppConfig

type ControllerConfig Uses

type ControllerConfig struct {
    Ip       string
    HttpPort int
    WsPort   int
    Region   string
}

func ClusterLeaderConfig Uses

func ClusterLeaderConfig() *ControllerConfig

type FailoverRecord Uses

type FailoverRecord struct {
    AppName   string
    NodeId    string
    NodeAddr  string
    Timestamp time.Time
    Region    string
    Tag       string
    Role      string
    Ranges    []topo.Range
}

type Meta Uses

type Meta struct {
    // contains filtered or unexported fields
}

func (*Meta) AddFailoverRecord Uses

func (m *Meta) AddFailoverRecord(record *FailoverRecord) error

func (*Meta) CheckLeaders Uses

func (m *Meta) CheckLeaders(watch bool) (string, string, <-chan zookeeper.Event, error)

func (*Meta) ElectLeader Uses

func (m *Meta) ElectLeader() (<-chan zookeeper.Event, error)

func (*Meta) FetchAppConfig Uses

func (m *Meta) FetchAppConfig() (*AppConfig, <-chan zookeeper.Event, error)

func (*Meta) FetchControllerConfig Uses

func (m *Meta) FetchControllerConfig(zkNode string) (*ControllerConfig, <-chan zookeeper.Event, error)

func (*Meta) HasSeed Uses

func (self *Meta) HasSeed(seed *topo.Node) bool

func (*Meta) IsDoingFailover Uses

func (m *Meta) IsDoingFailover() (bool, error)

func (*Meta) LastFailoverRecord Uses

func (m *Meta) LastFailoverRecord() (*FailoverRecord, error)

func (*Meta) MarkFailoverDoing Uses

func (m *Meta) MarkFailoverDoing(record *FailoverRecord) error

func (*Meta) RegisterLocalController Uses

func (m *Meta) RegisterLocalController() error

func (*Meta) UnmarkFailoverDoing Uses

func (m *Meta) UnmarkFailoverDoing() error

Package meta imports 14 packages (graph). Updated 2016-07-21. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).