topom

package
v0.0.0-...-3d19640 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfig = `` /* 1214-byte string literal not displayed */
View Source
const MaxSlotNum = models.MaxSlotNum

Variables

View Source
var ErrClosedTopom = errors.New("use of closed topom")
View Source
var ErrNotOnline = errors.New("topom is not online")

Functions

This section is empty.

Types

type ApiClient

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

func NewApiClient

func NewApiClient(addr string) *ApiClient

func (*ApiClient) AddSentinel

func (c *ApiClient) AddSentinel(addr string) error

func (*ApiClient) CreateGroup

func (c *ApiClient) CreateGroup(gid int) error

func (*ApiClient) CreateProxy

func (c *ApiClient) CreateProxy(addr string) error

func (*ApiClient) DelSentinel

func (c *ApiClient) DelSentinel(addr string, force bool) error

func (*ApiClient) EnableReplicaGroups

func (c *ApiClient) EnableReplicaGroups(gid int, addr string, value bool) error

func (*ApiClient) EnableReplicaGroupsAll

func (c *ApiClient) EnableReplicaGroupsAll(value bool) error

func (*ApiClient) GroupAddServer

func (c *ApiClient) GroupAddServer(gid int, dc, addr string) error

func (*ApiClient) GroupDelServer

func (c *ApiClient) GroupDelServer(gid int, addr string) error

func (*ApiClient) GroupPromoteServer

func (c *ApiClient) GroupPromoteServer(gid int, addr string) error

func (*ApiClient) LogLevel

func (c *ApiClient) LogLevel(level log.LogLevel) error

func (*ApiClient) Model

func (c *ApiClient) Model() (*models.Topom, error)

func (*ApiClient) OnlineProxy

func (c *ApiClient) OnlineProxy(addr string) error

func (*ApiClient) Overview

func (c *ApiClient) Overview() (*Overview, error)

func (*ApiClient) ReinitProxy

func (c *ApiClient) ReinitProxy(token string) error

func (*ApiClient) Reload

func (c *ApiClient) Reload() error

func (*ApiClient) RemoveGroup

func (c *ApiClient) RemoveGroup(gid int) error

func (*ApiClient) RemoveProxy

func (c *ApiClient) RemoveProxy(token string, force bool) error

func (*ApiClient) ResyncGroup

func (c *ApiClient) ResyncGroup(gid int) error

func (*ApiClient) ResyncGroupAll

func (c *ApiClient) ResyncGroupAll() error

func (*ApiClient) ResyncSentinels

func (c *ApiClient) ResyncSentinels() error

func (*ApiClient) SetSlotActionDisabled

func (c *ApiClient) SetSlotActionDisabled(disabled bool) error

func (*ApiClient) SetSlotActionInterval

func (c *ApiClient) SetSlotActionInterval(usecs int) error

func (*ApiClient) SetXAuth

func (c *ApiClient) SetXAuth(name string)

func (*ApiClient) Shutdown

func (c *ApiClient) Shutdown() error

func (*ApiClient) SlotCreateAction

func (c *ApiClient) SlotCreateAction(sid int, gid int) error

func (*ApiClient) SlotCreateActionRange

func (c *ApiClient) SlotCreateActionRange(beg, end int, gid int) error

func (*ApiClient) SlotCreateActionSome

func (c *ApiClient) SlotCreateActionSome(groupFrom, groupTo int, numSlots int) error

func (*ApiClient) SlotRemoveAction

func (c *ApiClient) SlotRemoveAction(sid int) error

func (*ApiClient) Slots

func (c *ApiClient) Slots() ([]*models.Slot, error)

func (*ApiClient) SlotsAssignGroup

func (c *ApiClient) SlotsAssignGroup(slots []*models.SlotMapping) error

func (*ApiClient) SlotsAssignOffline

func (c *ApiClient) SlotsAssignOffline(slots []*models.SlotMapping) error

func (*ApiClient) SlotsRebalance

func (c *ApiClient) SlotsRebalance(confirm bool) (map[int]int, error)

func (*ApiClient) Stats

func (c *ApiClient) Stats() (*Stats, error)

func (*ApiClient) SyncCreateAction

func (c *ApiClient) SyncCreateAction(addr string) error

func (*ApiClient) SyncRemoveAction

func (c *ApiClient) SyncRemoveAction(addr string) error

func (*ApiClient) XPing

func (c *ApiClient) XPing() error

type Config

type Config struct {
	CoordinatorName string `toml:"coordinator_name" json:"coordinator_name"`
	CoordinatorAddr string `toml:"coordinator_addr" json:"coordinator_addr"`
	CoordinatorAuth string `toml:"coordinator_auth" json:"coordinator_auth"`

	AdminAddr string `toml:"admin_addr" json:"admin_addr"`

	HostAdmin string `toml:"-" json:"-"`

	ProductName string `toml:"product_name" json:"product_name"`
	ProductAuth string `toml:"product_auth" json:"-"`

	MigrationMethod        string            `toml:"migration_method" json:"migration_method"`
	MigrationParallelSlots int               `toml:"migration_parallel_slots" json:"migration_parallel_slots"`
	MigrationAsyncMaxBulks int               `toml:"migration_async_maxbulks" json:"migration_async_maxbulks"`
	MigrationAsyncMaxBytes bytesize.Int64    `toml:"migration_async_maxbytes" json:"migration_async_maxbytes"`
	MigrationAsyncNumKeys  int               `toml:"migration_async_numkeys" json:"migration_async_numkeys"`
	MigrationTimeout       timesize.Duration `toml:"migration_timeout" json:"migration_timeout"`

	SentinelClientTimeout        timesize.Duration `toml:"sentinel_client_timeout" json:"sentinel_client_timeout"`
	SentinelQuorum               int               `toml:"sentinel_quorum" json:"sentinel_quorum"`
	SentinelParallelSyncs        int               `toml:"sentinel_parallel_syncs" json:"sentinel_parallel_syncs"`
	SentinelDownAfter            timesize.Duration `toml:"sentinel_down_after" json:"sentinel_down_after"`
	SentinelFailoverTimeout      timesize.Duration `toml:"sentinel_failover_timeout" json:"sentinel_failover_timeout"`
	SentinelNotificationScript   string            `toml:"sentinel_notification_script" json:"sentinel_notification_script"`
	SentinelClientReconfigScript string            `toml:"sentinel_client_reconfig_script" json:"sentinel_client_reconfig_script"`
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(path string) error

func (*Config) String

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

type Overview

type Overview struct {
	Version string        `json:"version"`
	Compile string        `json:"compile"`
	Config  *Config       `json:"config,omitempty"`
	Model   *models.Topom `json:"model,omitempty"`
	Stats   *Stats        `json:"stats,omitempty"`
}

type ProxyStats

type ProxyStats struct {
	Stats *proxy.Stats     `json:"stats,omitempty"`
	Error *rpc.RemoteError `json:"error,omitempty"`

	UnixTime int64 `json:"unixtime"`
	Timeout  bool  `json:"timeout,omitempty"`
}

type RedisStats

type RedisStats struct {
	Stats map[string]string `json:"stats,omitempty"`
	Error *rpc.RemoteError  `json:"error,omitempty"`

	Sentinel map[string]*redis.SentinelGroup `json:"sentinel,omitempty"`

	UnixTime int64 `json:"unixtime"`
	Timeout  bool  `json:"timeout,omitempty"`
}

type Stats

type Stats struct {
	Closed bool `json:"closed"`

	Slots []*models.SlotMapping `json:"slots"`

	Group struct {
		Models []*models.Group        `json:"models"`
		Stats  map[string]*RedisStats `json:"stats"`
	} `json:"group"`

	Proxy struct {
		Models []*models.Proxy        `json:"models"`
		Stats  map[string]*ProxyStats `json:"stats"`
	} `json:"proxy"`

	SlotAction struct {
		Interval int64 `json:"interval"`
		Disabled bool  `json:"disabled"`

		Progress struct {
			Status string `json:"status"`
		} `json:"progress"`

		Executor int64 `json:"executor"`
	} `json:"slot_action"`

	HA struct {
		Model   *models.Sentinel       `json:"model"`
		Stats   map[string]*RedisStats `json:"stats"`
		Masters map[string]string      `json:"masters"`
	} `json:"sentinels"`
}

type Topom

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

func New

func New(client models.Client, config *Config) (*Topom, error)

func (*Topom) AddSentinel

func (s *Topom) AddSentinel(addr string) error

func (*Topom) Close

func (s *Topom) Close() error

func (*Topom) Config

func (s *Topom) Config() *Config

func (*Topom) CreateGroup

func (s *Topom) CreateGroup(gid int) error

func (*Topom) CreateProxy

func (s *Topom) CreateProxy(addr string) error

func (*Topom) DelSentinel

func (s *Topom) DelSentinel(addr string, force bool) error

func (*Topom) EnableReplicaGroups

func (s *Topom) EnableReplicaGroups(gid int, addr string, value bool) error

func (*Topom) EnableReplicaGroupsAll

func (s *Topom) EnableReplicaGroupsAll(value bool) error

func (*Topom) GetSlotActionDisabled

func (s *Topom) GetSlotActionDisabled() bool

func (*Topom) GetSlotActionInterval

func (s *Topom) GetSlotActionInterval() int

func (*Topom) GroupAddServer

func (s *Topom) GroupAddServer(gid int, dc, addr string) error

func (*Topom) GroupDelServer

func (s *Topom) GroupDelServer(gid int, addr string) error

func (*Topom) GroupPromoteServer

func (s *Topom) GroupPromoteServer(gid int, addr string) error

func (*Topom) IsClosed

func (s *Topom) IsClosed() bool

func (*Topom) IsOnline

func (s *Topom) IsOnline() bool

func (*Topom) Model

func (s *Topom) Model() *models.Topom

func (*Topom) OnlineProxy

func (s *Topom) OnlineProxy(addr string) error

func (*Topom) Overview

func (s *Topom) Overview() (*Overview, error)

func (*Topom) ProcessSlotAction

func (s *Topom) ProcessSlotAction() error

func (*Topom) ProcessSyncAction

func (s *Topom) ProcessSyncAction() error

func (*Topom) RefreshProxyStats

func (s *Topom) RefreshProxyStats(timeout time.Duration) (*sync2.Future, error)

func (*Topom) RefreshRedisStats

func (s *Topom) RefreshRedisStats(timeout time.Duration) (*sync2.Future, error)

func (*Topom) ReinitProxy

func (s *Topom) ReinitProxy(token string) error

func (*Topom) Reload

func (s *Topom) Reload() error

func (*Topom) RemoveGroup

func (s *Topom) RemoveGroup(gid int) error

func (*Topom) RemoveProxy

func (s *Topom) RemoveProxy(token string, force bool) error

func (*Topom) ResyncGroup

func (s *Topom) ResyncGroup(gid int) error

func (*Topom) ResyncGroupAll

func (s *Topom) ResyncGroupAll() error

func (*Topom) ResyncSentinels

func (s *Topom) ResyncSentinels() error

func (*Topom) SetSlotActionDisabled

func (s *Topom) SetSlotActionDisabled(value bool)

func (*Topom) SetSlotActionInterval

func (s *Topom) SetSlotActionInterval(us int)

func (*Topom) SlotActionComplete

func (s *Topom) SlotActionComplete(sid int) error

func (*Topom) SlotActionPrepare

func (s *Topom) SlotActionPrepare() (int, bool, error)

func (*Topom) SlotActionPrepareFilter

func (s *Topom) SlotActionPrepareFilter(accept, update func(m *models.SlotMapping) bool) (int, bool, error)

func (*Topom) SlotCreateAction

func (s *Topom) SlotCreateAction(sid int, gid int) error

func (*Topom) SlotCreateActionRange

func (s *Topom) SlotCreateActionRange(beg, end int, gid int, must bool) error

func (*Topom) SlotCreateActionSome

func (s *Topom) SlotCreateActionSome(groupFrom, groupTo int, numSlots int) error

func (*Topom) SlotRemoveAction

func (s *Topom) SlotRemoveAction(sid int) error

func (*Topom) Slots

func (s *Topom) Slots() ([]*models.Slot, error)

func (*Topom) SlotsAssignGroup

func (s *Topom) SlotsAssignGroup(slots []*models.SlotMapping) error

func (*Topom) SlotsAssignOffline

func (s *Topom) SlotsAssignOffline(slots []*models.SlotMapping) error

func (*Topom) SlotsRebalance

func (s *Topom) SlotsRebalance(confirm bool) (map[int]int, error)

func (*Topom) Start

func (s *Topom) Start(routines bool) error

func (*Topom) Stats

func (s *Topom) Stats() (*Stats, error)

func (*Topom) SwitchMasters

func (s *Topom) SwitchMasters(masters map[int]string) error

func (*Topom) SyncActionComplete

func (s *Topom) SyncActionComplete(addr string, failed bool) error

func (*Topom) SyncActionPrepare

func (s *Topom) SyncActionPrepare() (string, error)

func (*Topom) SyncCreateAction

func (s *Topom) SyncCreateAction(addr string) error

func (*Topom) SyncRemoveAction

func (s *Topom) SyncRemoveAction(addr string) error

func (*Topom) XAuth

func (s *Topom) XAuth() string

Jump to

Keyboard shortcuts

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