dashcore

package
v0.0.0-...-9b3b26b Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var AdminKey = "user_token"
View Source
var ErrClosedDashCore = errors.New("use of closed dashcore")
View Source
var ErrInitGroupID = errors.New("group id is zero")
View Source
var ErrNotOnline = errors.New("DashCore is not online")
View Source
var NeedLoginErr = errors.New("need login first")

Functions

This section is empty.

Types

type AdminModel

type AdminModel string
var RaftAdminModel AdminModel = "raft"

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"`
	AdminModel string `toml:"admin_model" json:"admin_model"`

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

	ReadCrossCloud int `toml:"read_cross_cloud" json:"read_cross_cloud"`

	ProductName string   `toml:"product_name" json:"product_name"`
	ProductAuth string   `toml:"product_auth" json:"product_auth"`
	Database    DBConfig `toml:"database"`
}

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 DBConfig

type DBConfig struct {
	Username string `toml:"username"`
	Password string `toml:"password"`
	HostPort string `toml:"hostport"`
	DBName   string `toml:"dbname"`
}

type DashCore

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

func New

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

func (*DashCore) AdminLogin

func (s *DashCore) AdminLogin(session sessions.Session, admin *models.Admin) (*models.Admin, error)

func (*DashCore) AdminModel

func (s *DashCore) AdminModel() AdminModel

func (*DashCore) ChangeServerRole

func (s *DashCore) ChangeServerRole(gid int, serveRole, addr string) error

func (*DashCore) Close

func (s *DashCore) Close() error

func (*DashCore) Compact

func (s *DashCore) Compact(addr, dbType string) error

func (*DashCore) Config

func (s *DashCore) Config() *Config

func (*DashCore) CreateAdmin

func (s *DashCore) CreateAdmin(admin *models.Admin) error

func (*DashCore) CreateGroup

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

func (*DashCore) CreatePConfig

func (s *DashCore) CreatePConfig(pconfig *models.Pconfig) error

func (*DashCore) CreateProxy

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

func (*DashCore) DeRaftGroup

func (s *DashCore) DeRaftGroup(gid int, addr, token string) error

func (*DashCore) DeraftAllGroup

func (s *DashCore) DeraftAllGroup(token, cloudType string) error

func (*DashCore) EnableReplicaGroups

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

func (*DashCore) EnableReplicaGroupsAll

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

func (*DashCore) GetAdmin

func (s *DashCore) GetAdmin(name string) (*models.Admin, error)

func (*DashCore) GetAdminList

func (s *DashCore) GetAdminList() (map[string]*models.Admin, error)

func (*DashCore) GetClusterMembership

func (s *DashCore) GetClusterMembership(gid int, addr string) (*uredis.MembershipV2, error)

func (*DashCore) GetLoginAdmin

func (s *DashCore) GetLoginAdmin(session sessions.Session) (*models.Admin, error)

func (*DashCore) GetMigrateList

func (s *DashCore) GetMigrateList() ([]*models.Migrate, error)

func (*DashCore) GetNodeHostInfo

func (s *DashCore) GetNodeHostInfo(gid int, addr string) (string, error)

func (*DashCore) GetPConfig

func (s *DashCore) GetPConfig(name string) (*models.Pconfig, error)

func (*DashCore) GetPConfigList

func (s *DashCore) GetPConfigList() (map[string]*models.Pconfig, error)

func (*DashCore) GroupAddServer

func (s *DashCore) GroupAddServer(gid int, serveRole, ct, addr string) error

func (*DashCore) GroupDelServer

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

func (*DashCore) GroupMountOrOfflineNode

func (s *DashCore) GroupMountOrOfflineNode(model int, gid int, serverAddr string, raftAddr string, nodeId int) error

func (*DashCore) GroupPromoteServer

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

func (*DashCore) InitDefaultPconfig

func (s *DashCore) InitDefaultPconfig()

func (*DashCore) InverseReplicaGroupsAll

func (s *DashCore) InverseReplicaGroupsAll(gid int, addr string) error

func (*DashCore) IsClosed

func (s *DashCore) IsClosed() bool

func (*DashCore) IsOnline

func (s *DashCore) IsOnline() bool

func (*DashCore) LogCompactGroup

func (s *DashCore) LogCompactGroup(gid int) error

func (*DashCore) Model

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

func (*DashCore) OnlineProxy

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

func (*DashCore) Overview

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

func (*DashCore) ProcessSlotAction

func (s *DashCore) ProcessSlotAction() error

func (*DashCore) ReRaftGroup

func (s *DashCore) ReRaftGroup(gid int, addr, token string, port int) error

func (*DashCore) ReadCrossCloud

func (s *DashCore) ReadCrossCloud(flag string) error

func (*DashCore) RefreshProxyStats

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

func (*DashCore) RefreshRedisStats

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

func (*DashCore) ReinitProxy

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

func (*DashCore) Reload

func (s *DashCore) Reload() error

func (*DashCore) RemoveAdmin

func (s *DashCore) RemoveAdmin(username string) error

func (*DashCore) RemoveGroup

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

func (*DashCore) RemovePConfig

func (s *DashCore) RemovePConfig(name string) error

func (*DashCore) RemoveProxy

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

func (*DashCore) ResyncAllPconfig

func (s *DashCore) ResyncAllPconfig() error

func (*DashCore) ResyncGroup

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

func (*DashCore) ResyncGroupAll

func (s *DashCore) ResyncGroupAll() error

func (*DashCore) ResyncOnePconfig

func (s *DashCore) ResyncOnePconfig(name string) error

func (*DashCore) SetSlotActionDisabled

func (s *DashCore) SetSlotActionDisabled(value bool)

func (*DashCore) SlotActionComplete

func (s *DashCore) SlotActionComplete(sourceAddr string, sid int) error

func (*DashCore) SlotActionMigratingMinIndex

func (s *DashCore) SlotActionMigratingMinIndex() (int, bool, error)

func (*DashCore) SlotActionPrepare

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

func (*DashCore) SlotActionPrepareFilter

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

func (*DashCore) SlotCreateAction

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

func (*DashCore) SlotCreateActionInit

func (s *DashCore) SlotCreateActionInit() error

func (*DashCore) SlotCreateActionRange

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

func (*DashCore) SlotCreateActionSome

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

func (*DashCore) SlotRemoveAction

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

func (*DashCore) Slots

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

func (*DashCore) SlotsAssignGroup

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

func (*DashCore) SlotsAssignOffline

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

func (*DashCore) SlotsRebalance

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

func (*DashCore) Start

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

func (*DashCore) Stats

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

func (*DashCore) SyncCreateAction

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

func (*DashCore) SyncRemoveAction

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

func (*DashCore) UpdateAdmin

func (s *DashCore) UpdateAdmin(admin *models.Admin) error

func (*DashCore) UpdateDepartment

func (s *DashCore) UpdateDepartment(newDepartment string) error

func (*DashCore) UpdatePConfig

func (s *DashCore) UpdatePConfig(pconfig *models.Pconfig) error

func (*DashCore) XAuth

func (s *DashCore) XAuth() string

type Overview

type Overview struct {
	Version string           `json:"version"`
	Compile string           `json:"compile"`
	Config  *Config          `json:"config,omitempty"`
	Model   *models.DashCore `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"`

	UnixTime   int64  `json:"unixtime"`
	Timeout    bool   `json:"timeout,omitempty"`
	VersionTag string `json:"version_tag"`

	ReadCrossCloud bool `json:"read_cross_cloud"`
}

type Stats

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

	ReadCrossCloud bool `json:"read_cross_cloud"`

	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 {
		Disabled bool `json:"disabled"`

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

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

	GroupSyncStats []string `json:"group_sync_stats"`
}

Jump to

Keyboard shortcuts

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