service

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

*

  • 数据模型的存储逻辑

Index

Constants

View Source
const (
	//DB_NAME = "fbase_mock_console"
	DB_NAME = "fbase"

	TABLE_NAME_USER          = "fbase_user"
	TABLE_NAME_CLUSTER       = "fbase_cluster"
	TABLE_NAME_ROLE          = "fbase_role"
	TABLE_NAME_PRIVILEGE     = "fbase_privilege"
	TABLE_NAME_SQL_APPLY     = "fbase_sql_apply"
	TABLE_NAME_LOCK_NSP      = "fbase_lock_nsp"
	TABLE_NAME_CONFIGURE_NSP = "fbase_configure_nsp"
	TABLE_NAME_METRIC_SERVER = "metric_server"

	STATUS_APPLY  = 1
	STATUS_AUDIT  = 2
	STATUS_REJECT = 3

	LOCK_CLIENT_NAMESPACE_PREFIX = ""
)

Variables

This section is empty.

Functions

func InitService

func InitService(c *config.Config)

Types

type Service

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

func NewService

func NewService() *Service

func (*Service) AddPeer

func (s *Service) AddPeer(clusterId int, rangeId string) error

func (*Service) AddRole

func (s *Service) AddRole(roleId int, roleName string) error

func (*Service) AdjustScheduler

func (s *Service) AdjustScheduler(clusterId, optType int, scheduler string) error

func (*Service) ApplyConfigureNsp added in v0.7.2

func (s *Service) ApplyConfigureNsp(cId int, dbName, tableName, applyer string, cTime int64) error

func (*Service) ApplyLockNsp added in v0.7.2

func (s *Service) ApplyLockNsp(cId int, dbName, tableName, applyer string, cTime int64) error

func (*Service) ApplyNamespace added in v0.7.2

func (s *Service) ApplyNamespace(cId int, dbName, tableName, applyer string, cTime int64, storeTable string) error

func (*Service) ApplySql added in v0.6.3

func (s *Service) ApplySql(dbName, tableName, sentence, applyer, remark string, cTime int64) error

func (*Service) AuditConfigureNsp added in v0.7.2

func (s *Service) AuditConfigureNsp(ids []string, status int, auditor string) error

func (*Service) AuditLockNsp added in v0.7.2

func (s *Service) AuditLockNsp(ids []string, status int, auditor string) error

func (*Service) AuditSql added in v0.6.3

func (s *Service) AuditSql(ids []string, status int, auditor string) error

func (*Service) BatchCreateTopologyRange

func (s *Service) BatchCreateTopologyRange(clusterId int, dbName, tableName string) error

func (*Service) BatchRecoverRange

func (s *Service) BatchRecoverRange(clusterId int, dbName, tableName string) error

func (*Service) ChangeRangeLeader

func (s *Service) ChangeRangeLeader(clusterId int, rangeId int, peerId int) error

切换主

func (*Service) CheckTopology

func (s *Service) CheckTopology(clusterId int, dbName, tableName string) error

func (*Service) ComputeClientToken added in v0.7.2

func (s *Service) ComputeClientToken(dbId, tableId int) string

func (*Service) CreateCluster

func (s *Service) CreateCluster(cId int, cName, masterUrl, gateHttpUrl, gateSqlUrl, cToken string, cTime int64) error

func (*Service) CreateDb

func (s *Service) CreateDb(cId int, dbName string) (*models.DbInfo, error)

func (*Service) CreateMetricServer added in v0.6.3

func (s *Service) CreateMetricServer(addr string) error

func (*Service) CreateTable

func (s *Service) CreateTable(cId int, dbName, tableName, policy, rangeKeys string, columnJsonArray, regxsJsonArray interface{}) (*models.TableInfo, error)

func (*Service) CreateTopologyRange

func (s *Service) CreateTopologyRange(clusterId int, dbName, tableName, startKey, endKey string) error

func (*Service) DelPrivilege

func (s *Service) DelPrivilege(privileges []models.UserPrivilege) error

func (*Service) DelRole

func (s *Service) DelRole(roleIds []int) error

func (*Service) DeleteConfigureNsp added in v0.7.2

func (s *Service) DeleteConfigureNsp(ids []string) error

func (*Service) DeleteDb added in v0.7.2

func (s *Service) DeleteDb(cId int, dbName string) error

func (*Service) DeleteLockNsp added in v0.7.2

func (s *Service) DeleteLockNsp(ids []string) error

func (*Service) DeleteMetricServer added in v0.6.3

func (s *Service) DeleteMetricServer(addrs []string) error

func (*Service) DeleteNodes

func (s *Service) DeleteNodes(clusterId int, nodeIds string) error

func (*Service) DeleteNsp added in v0.7.2

func (s *Service) DeleteNsp(ids []string, storeTable string) error

func (*Service) DeletePeer

func (s *Service) DeletePeer(clusterId int, rangeId, peerId string) (interface{}, error)

func (*Service) DeleteRange

func (s *Service) DeleteRange(clusterId int, rangeId int) error

func (*Service) DeleteTable

func (s *Service) DeleteTable(cId int, dbName, tableName, flag string) error

func (*Service) EditTable

func (s *Service) EditTable(cId int, dbName, tableName, rangeKeys string, columnJsonArray, regxsJsonArray interface{}) error

func (*Service) ForceUnLock added in v0.7.2

func (s *Service) ForceUnLock(clusterId int, dbName, tableName, key string) error

func (*Service) GetAllClusters

func (s *Service) GetAllClusters() ([]*models.ClusterInfo, error)

func (*Service) GetAllConfigure added in v0.7.2

func (s *Service) GetAllConfigure(clusterId int, dbName, tableName string, pageInfo *models.PagerInfo) ([]*models.ConfigureInfo, error)

go by http command

func (*Service) GetAllConfigureNsp added in v0.7.2

func (s *Service) GetAllConfigureNsp(userName string, isAdmin bool, pageInfo *models.PagerInfo) (int, []*models.NamespaceApply, error)

=============configure center start================

func (*Service) GetAllDb

func (s *Service) GetAllDb(cId int) (*[]models.DbInfo, error)

func (*Service) GetAllLock added in v0.7.2

func (s *Service) GetAllLock(clusterId int, dbName, tableName string, pageInfo *models.PagerInfo) ([]*models.LockInfo, error)

go by http command

func (*Service) GetAllLockNsp added in v0.7.2

func (s *Service) GetAllLockNsp(userName string, isAdmin bool, pageInfo *models.PagerInfo) (int, []*models.NamespaceApply, error)

=============lock start==============

func (*Service) GetAllMetricServer added in v0.6.3

func (s *Service) GetAllMetricServer() ([]models.MetricServer, error)

func (*Service) GetAllNamespace

func (s *Service) GetAllNamespace(userName string, isAdmin bool, pageInfo *models.PagerInfo, tableName string) (int, []*models.NamespaceApply, error)

func (*Service) GetAllSqlApply added in v0.6.3

func (s *Service) GetAllSqlApply(userName string, isAdmin bool, pageInfo *models.PagerInfo) (int, []*models.SqlApply, error)

=============sql apply start==============

func (*Service) GetAllTables

func (s *Service) GetAllTables(cId int, dbId, dbName string) (*[]models.TableInfo, error)

func (*Service) GetClusterById

func (s *Service) GetClusterById(ids ...int64) ([]*models.ClusterInfo, error)

func (*Service) GetClusterInfo added in v0.7.2

func (s *Service) GetClusterInfo(clusterId int) (*models.ClusterInfo, error)

func (*Service) GetClusterTopology

func (s *Service) GetClusterTopology(clusterId int) (interface{}, error)

func (*Service) GetConfigureClusterList added in v0.7.2

func (s *Service) GetConfigureClusterList() ([]*models.ClusterInfo, error)

func (*Service) GetDb

func (s *Service) GetDb() *sql.DB

func (*Service) GetLockClusterList added in v0.7.2

func (s *Service) GetLockClusterList() ([]*models.ClusterInfo, error)

func (*Service) GetMasterAll

func (s *Service) GetMasterAll(cId int, token string) (*models.Member, error)

func (*Service) GetMasterLeader

func (s *Service) GetMasterLeader(cId int, token string) (*models.MsNode, error)

func (*Service) GetMetricConfig added in v0.6.3

func (s *Service) GetMetricConfig(cId int) (map[string]*models.MetricConfig, error)

func (*Service) GetNamespaceById added in v0.7.2

func (s *Service) GetNamespaceById(applyId, storeTable string) (*models.NamespaceApply, error)

func (*Service) GetNodeViewInfo

func (s *Service) GetNodeViewInfo(cId int) ([]*models.DsNode, error)

func (*Service) GetPeerInfo

func (s *Service) GetPeerInfo(clusterId int, dbName, tableName string, rangeId int) (interface{}, error)

func (*Service) GetPresentTask

func (s *Service) GetPresentTask(clusterId int) (interface{}, error)

func (*Service) GetPrivilegeInfo

func (s *Service) GetPrivilegeInfo(offset, limit int, order string) ([]*models.UserPrivilege, error)

func (*Service) GetRangeDuplicate

func (s *Service) GetRangeDuplicate(clusterId int, dbName, tableName string) (interface{}, error)

func (*Service) GetRangeOpsTopN

func (s *Service) GetRangeOpsTopN(clusterId int, topN int) (interface{}, error)

func (*Service) GetRangeTopoByNodeId

func (s *Service) GetRangeTopoByNodeId(clusterId, nodeId int) (interface{}, error)

func (*Service) GetRangeTopoByRangeId

func (s *Service) GetRangeTopoByRangeId(clusterId int, rangeId int) (interface{}, error)

func (*Service) GetRangeViewInfo

func (s *Service) GetRangeViewInfo(dbName, tName string, clusterId uint64) ([]*models.Route, error)

func (*Service) GetRoleInfo

func (s *Service) GetRoleInfo(offset, limit int, order string) ([]*models.Role, error)

func (*Service) GetSchedulerAll

func (s *Service) GetSchedulerAll(clusterId int) (map[string]bool, error)

func (*Service) GetSchedulerDetail

func (s *Service) GetSchedulerDetail(clusterId int, name string) (interface{}, error)

func (*Service) GetSqlApplyInfo added in v0.6.3

func (s *Service) GetSqlApplyInfo(id string) (*models.SqlApply, error)

func (*Service) GetTableColumns

func (s *Service) GetTableColumns(cId int, tableName, dbName string) (*models.TableInfo, error)

func (*Service) GetTableTopologyMissing

func (s *Service) GetTableTopologyMissing(clusterId int, dbName, tableName string) (interface{}, error)

func (*Service) GetTaskType

func (s *Service) GetTaskType(clusterId int) ([]string, error)

func (*Service) GetUnhealthyRanges

func (s *Service) GetUnhealthyRanges(clusterId int, dbName, tableName string, rangeId string) (interface{}, error)

func (*Service) GetUnstableRanges

func (s *Service) GetUnstableRanges(clusterId int, dbName, tableName string) (interface{}, error)

func (*Service) GetUserInfoByErp

func (s *Service) GetUserInfoByErp(erp string) (*models.UserInfo, error)

func (*Service) InitCluster

func (s *Service) InitCluster(cId int, masterUrl string, token string) error

func (*Service) IsAdmin

func (s *Service) IsAdmin(userName string) (bool, error)

func (*Service) OfflineRange

func (s *Service) OfflineRange(clusterId int, dbName, tableName string, rangeId, peerId int) error

func (*Service) OperateDb

func (s *Service) OperateDb(clusterId int, paramMap map[string]string) (int64, error)

func (*Service) QueryDb

func (s *Service) QueryDb(clusterId int, paramMap map[string]string) (interface{}, error)

func (*Service) RebuildRange

func (s *Service) RebuildRange(clusterId int, dbName, tableName string, rangeId int) error

func (*Service) ReplaceRange

func (s *Service) ReplaceRange(clusterId int, dbName, tableName string, rangeId, peerId int) error

func (*Service) SetClusterToggle

func (s *Service) SetClusterToggle(clusterId int, autoTransfer, autoFailover, autoSplit string) error

func (*Service) SetMasterLogLevel

func (s *Service) SetMasterLogLevel(clusterId int, logLevel string) error

func (*Service) SetMetricConfig added in v0.6.3

func (s *Service) SetMetricConfig(cId int, addr, interval string) (map[string]string, error)

func (*Service) SetNodeLogIn

func (s *Service) SetNodeLogIn(clusterId, nodeId int) error

func (*Service) SetNodeLogLevel

func (s *Service) SetNodeLogLevel(clusterId, nodeId int, logLevel string) error

func (*Service) SetNodeLogOut

func (s *Service) SetNodeLogOut(clusterId, nodeId int) error

func (*Service) SetNodeUpgrade

func (s *Service) SetNodeUpgrade(clusterId, nodeId int) error

func (*Service) TaskOperate

func (s *Service) TaskOperate(clusterId int, operate string, taskIds string) (interface{}, error)

func (*Service) TransferRange

func (s *Service) TransferRange(clusterId int, rangeId int, peerId int) error

迁移

func (*Service) UpdateConfigureNsp added in v0.7.2

func (s *Service) UpdateConfigureNsp(applyId, applyer string) error

func (*Service) UpdateLockNsp

func (s *Service) UpdateLockNsp(applyId, applyer string) error

func (*Service) UpdateNsp added in v0.7.2

func (s *Service) UpdateNsp(applyId, applyer, storeTable string) error

func (*Service) UpdatePrivilege

func (s *Service) UpdatePrivilege(userName string, clusterId, roleId int) error

func (*Service) UpdateRange

func (s *Service) UpdateRange(clusterId int, dbName, tableName string, rangeId, peerId int) error

Jump to

Keyboard shortcuts

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