mysqlopt

package
v0.0.1-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TickTime  = 2
	LeaseTime = 10
)
View Source
const (
	// SystemNamespace system namespace
	SystemNamespace = "Polaris"
	// STORENAME database storage name
	STORENAME = "mysqlOptStore"
	// DefaultConnMaxLifetime default maximum connection lifetime
	DefaultConnMaxLifetime = 60 * 30 // 默认是30分钟

)
View Source
const (
	// IDAttribute is the name of the attribute that stores the ID of the object.
	IDAttribute string = "id"

	// NameAttribute will be used as the name of the attribute that stores the name of the object.
	NameAttribute string = "name"

	// FlagAttribute will be used as the name of the attribute that stores the flag of the object.
	FlagAttribute string = "flag"

	// GroupIDAttribute will be used as the name of the attribute that stores the group ID of the object.
	GroupIDAttribute string = "group_id"
)
View Source
const (

	// OwnerAttribute
	OwnerAttribute string = "owner"

	// And
	And string = " and"
)

Variables

View Source
var (
	RuleFilters map[string]string = map[string]string{
		"res_id":         "ar.res_id",
		"res_type":       "ar.res_type",
		"default":        "ag.default",
		"owner":          "ag.owner",
		"name":           "ag.name",
		"principal_id":   "ap.principal_id",
		"principal_type": "ap.principal_role",
	}

	RuleNeedLikeFilters map[string]struct{} = map[string]struct{}{
		"name": {},
	}
)
View Source
var (
	ErrTxIsNil = errors.New("tx is nil")
)

Functions

func BatchOperation

func BatchOperation(label string, data []interface{}, handler BatchHandler) error

BatchOperation 批量操作 @note 每次最多操作100个

func BatchQuery

func BatchQuery(label string, data []interface{}, handler BatchHandler) error

BatchQuery 批量查询数据的对外接口 每次最多查询200个

func NewSqlDBTx

func NewSqlDBTx(delegateTx *BaseTx) store.Tx

func PlaceholdersN

func PlaceholdersN(size int) string

PlaceholdersN 构造多个占位符

func Retry

func Retry(label string, handle func() error)

Retry 重试主函数 最多重试20次,每次等待5ms*重试次数

func RetryTransaction

func RetryTransaction(label string, handle func() error) error

RetryTransaction 事务重试

Types

type BaseDB

type BaseDB struct {
	*sql.DB
	// contains filtered or unexported fields
}

BaseDB 对sql.DB的封装

func NewBaseDB

func NewBaseDB(cfg *dbConfig, parsePwd plugin.ParsePassword) (*BaseDB, error)

NewBaseDB 新建一个BaseDB

func (*BaseDB) Begin

func (b *BaseDB) Begin() (*BaseTx, error)

Begin 重写db.Begin

func (*BaseDB) Exec

func (b *BaseDB) Exec(query string, args ...interface{}) (sql.Result, error)

Exec 重写db.Exec函数 提供重试功能

func (*BaseDB) Query

func (b *BaseDB) Query(query string, args ...interface{}) (*sql.Rows, error)

Query 重写db.Query函数

func (*BaseDB) QueryRow

func (b *BaseDB) QueryRow(query string, args ...interface{}) *sql.Row

QueryRow 重写db.Query函数

type BaseTx

type BaseTx struct {
	*sql.Tx
}

BaseTx 对sql.Tx的封装

func (*BaseTx) Commit

func (b *BaseTx) Commit() error

Commit .

func (*BaseTx) Rollback

func (b *BaseTx) Rollback() error

Rollback .

type BatchHandler

type BatchHandler func(objects []interface{}) error

BatchHandler 批量查询数据的回调函数

type LeaderElectionStore

type LeaderElectionStore interface {
	// CreateLeaderElection
	CreateLeaderElection(key string) error
	// GetVersion get current version
	GetVersion(key string) (int64, error)
	// CompareAndSwapVersion cas version
	CompareAndSwapVersion(key string, curVersion int64, newVersion int64, leader string) (bool, error)
	// CheckMtimeExpired check mtime expired
	CheckMtimeExpired(key string, leaseTime int32) (string, bool, error)
	// ListLeaderElections list all leaderelection
	ListLeaderElections() ([]*model.LeaderElection, error)
}

LeaderElectionStore store inteface

type Order

type Order struct {
	Filed    string
	Sequence string
}

Order 排序结构体

type Page

type Page struct {
	Offset uint32
	Limit  uint32
}

Page 分页结构体

type QueryHandler

type QueryHandler func(query string, args ...interface{}) (*sql.Rows, error)

QueryHandler is the interface that wraps the basic Query method.

type StableOptStore

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

StableOptStore 实现了Store接口

func (StableOptStore) ActiveConfigFileReleaseTx

func (cfr StableOptStore) ActiveConfigFileReleaseTx(tx store.Tx, release *model.ConfigFileRelease) error

ActiveConfigFileReleaseTx

func (StableOptStore) AddGroup

func (u StableOptStore) AddGroup(group *model.UserGroupDetail) error

AddGroup 创建一个用户组

func (StableOptStore) AddInstance

func (ins StableOptStore) AddInstance(instance *model.Instance) error

AddInstance 添加实例

func (StableOptStore) AddNamespace

func (ns StableOptStore) AddNamespace(namespace *model.Namespace) error

AddNamespace 添加命名空间

func (StableOptStore) AddService

func (ss StableOptStore) AddService(s *model.Service) error

AddService 增加服务

func (StableOptStore) AddServiceContractInterfaces

func (s StableOptStore) AddServiceContractInterfaces(contract *model.EnrichServiceContract) error

AddServiceContractInterfaces 创建服务契约API接口

func (StableOptStore) AddStrategy

func (s StableOptStore) AddStrategy(strategy *model.StrategyDetail) error

func (StableOptStore) AddUser

func (u StableOptStore) AddUser(user *model.User) error

AddUser 添加用户

func (StableOptStore) AppendServiceContractInterfaces

func (s StableOptStore) AppendServiceContractInterfaces(contract *model.EnrichServiceContract) error

AppendServiceContractInterfaces 追加服务契约API接口

func (StableOptStore) BatchAddClients

func (cs StableOptStore) BatchAddClients(clients []*model.Client) error

BatchAddClients 增加多个实例

func (StableOptStore) BatchAddInstances

func (ins StableOptStore) BatchAddInstances(instances []*model.Instance) error

BatchAddInstances 批量增加实例

func (StableOptStore) BatchAppendInstanceMetadata

func (ins StableOptStore) BatchAppendInstanceMetadata(requests []*store.InstanceMetadataRequest) error

BatchAppendInstanceMetadata 追加实例 metadata

func (StableOptStore) BatchCleanDeletedClients

func (m StableOptStore) BatchCleanDeletedClients(timeout time.Duration, batchSize uint32) (uint32, error)

BatchCleanDeletedClients batch clean soft deleted clients

func (StableOptStore) BatchCleanDeletedInstances

func (m StableOptStore) BatchCleanDeletedInstances(timeout time.Duration, batchSize uint32) (uint32, error)

BatchCleanDeletedInstances batch clean soft deleted instances

func (StableOptStore) BatchDeleteClients

func (cs StableOptStore) BatchDeleteClients(ids []string) error

BatchDeleteClients 批量删除实例,flag=1

func (StableOptStore) BatchDeleteInstances

func (ins StableOptStore) BatchDeleteInstances(ids []interface{}) error

BatchDeleteInstances 批量删除实例

func (StableOptStore) BatchGetInstanceIsolate

func (ins StableOptStore) BatchGetInstanceIsolate(ids map[string]bool) (map[string]bool, error)

BatchGetInstanceIsolate 检查实例是否存在

func (StableOptStore) BatchRemoveInstanceMetadata

func (ins StableOptStore) BatchRemoveInstanceMetadata(requests []*store.InstanceMetadataRequest) error

BatchRemoveInstanceMetadata 删除实例指定的 metadata

func (StableOptStore) BatchSetInstanceHealthStatus

func (ins StableOptStore) BatchSetInstanceHealthStatus(ids []interface{}, isolate int, revision string) error

BatchSetInstanceHealthStatus 批量设置健康状态

func (StableOptStore) BatchSetInstanceIsolate

func (ins StableOptStore) BatchSetInstanceIsolate(ids []interface{}, isolate int, revision string) error

BatchSetInstanceIsolate 批量设置实例隔离状态

func (StableOptStore) CleanConfigFileReleaseHistory

func (rh StableOptStore) CleanConfigFileReleaseHistory(endTime time.Time, limit uint64) error

CleanConfigFileReleaseHistory 清理配置发布历史

func (StableOptStore) CleanConfigFileReleasesTx

func (cfr StableOptStore) CleanConfigFileReleasesTx(tx store.Tx,
	namespace, group, fileName string) error

CleanConfigFileReleasesTx

func (StableOptStore) CleanDeletedConfigFileRelease

func (cfr StableOptStore) CleanDeletedConfigFileRelease(endTime time.Time, limit uint64) error

CleanDeletedConfigFileRelease 清理配置发布历史

func (StableOptStore) CleanGrayResource

func (g StableOptStore) CleanGrayResource(tx store.Tx, data *model.GrayResource) error

func (StableOptStore) CleanInstance

func (ins StableOptStore) CleanInstance(instanceID string) error

CleanInstance 清理数据

func (StableOptStore) CountConfigFileEachGroup

func (cf StableOptStore) CountConfigFileEachGroup() (map[string]map[string]int64, error)

CountConfigFileEachGroup

func (StableOptStore) CountConfigFiles

func (cfr StableOptStore) CountConfigFiles(namespace, group string) (uint64, error)

CountConfigFiles 获取一个配置文件组下的文件数量

func (StableOptStore) CountConfigGroups

func (fg StableOptStore) CountConfigGroups(namespace string) (uint64, error)

CountConfigGroups

func (StableOptStore) CountConfigReleases

func (cfr StableOptStore) CountConfigReleases(namespace, group string, onlyActive bool) (uint64, error)

CountConfigReleases 获取一个配置文件组下的文件数量

func (StableOptStore) CreateCircuitBreakerRule

func (c StableOptStore) CreateCircuitBreakerRule(cbRule *model.CircuitBreakerRule) error

func (StableOptStore) CreateClient

func (cs StableOptStore) CreateClient(client *model.Client) error

CreateClient insert the client info

func (StableOptStore) CreateConfigFileGroup

func (fg StableOptStore) CreateConfigFileGroup(
	fileGroup *model.ConfigFileGroup) (*model.ConfigFileGroup, error)

CreateConfigFileGroup 创建配置文件组

func (StableOptStore) CreateConfigFileReleaseHistory

func (rh StableOptStore) CreateConfigFileReleaseHistory(
	history *model.ConfigFileReleaseHistory) error

CreateConfigFileReleaseHistory 创建配置文件发布历史记录

func (StableOptStore) CreateConfigFileReleaseTx

func (cfr StableOptStore) CreateConfigFileReleaseTx(tx store.Tx, data *model.ConfigFileRelease) error

CreateConfigFileRelease 新建配置文件发布

func (StableOptStore) CreateConfigFileTemplate

func (cf StableOptStore) CreateConfigFileTemplate(
	template *model.ConfigFileTemplate) (*model.ConfigFileTemplate, error)

CreateConfigFileTemplate create config file template

func (StableOptStore) CreateConfigFileTx

func (cf StableOptStore) CreateConfigFileTx(tx store.Tx, file *model.ConfigFile) error

CreateConfigFile 创建配置文件

func (StableOptStore) CreateFaultDetectRule

func (f StableOptStore) CreateFaultDetectRule(fdRule *model.FaultDetectRule) error

CreateFaultDetectRule create fault detect rule

func (StableOptStore) CreateGrayResourceTx

func (g StableOptStore) CreateGrayResourceTx(tx store.Tx, data *model.GrayResource) error

CreateGrayResourceTx 创建灰度资源

func (StableOptStore) CreateRateLimit

func (rls StableOptStore) CreateRateLimit(limit *model.RateLimit) error

CreateRateLimit 新建限流规则

func (StableOptStore) CreateRoutingConfig

func (rs StableOptStore) CreateRoutingConfig(conf *model.RoutingConfig) error

CreateRoutingConfig 新建RoutingConfig

func (StableOptStore) CreateRoutingConfigV2

func (r StableOptStore) CreateRoutingConfigV2(conf *model.RouterConfig) error

CreateRoutingConfigV2 Add a new routing configuration

func (StableOptStore) CreateRoutingConfigV2Tx

func (r StableOptStore) CreateRoutingConfigV2Tx(tx store.Tx, conf *model.RouterConfig) error

func (StableOptStore) CreateServiceContract

func (s StableOptStore) CreateServiceContract(contract *model.ServiceContract) error

CreateServiceContract 创建服务契约

func (*StableOptStore) CreateTransaction

func (s *StableOptStore) CreateTransaction() (store.Transaction, error)

CreateTransaction 创建一个事务

func (StableOptStore) DeleteCircuitBreakerRule

func (c StableOptStore) DeleteCircuitBreakerRule(id string) error

DeleteCircuitBreakerRule 删除熔断规则

func (StableOptStore) DeleteConfigFileGroup

func (fg StableOptStore) DeleteConfigFileGroup(namespace, name string) error

DeleteConfigFileGroup 删除配置文件组

func (StableOptStore) DeleteConfigFileReleaseTx

func (cfr StableOptStore) DeleteConfigFileReleaseTx(tx store.Tx, data *model.ConfigFileReleaseKey) error

DeleteConfigFileRelease

func (StableOptStore) DeleteConfigFileTx

func (cf StableOptStore) DeleteConfigFileTx(tx store.Tx, namespace, group, name string) error

DeleteConfigFileTx 删除配置文件

func (StableOptStore) DeleteFaultDetectRule

func (f StableOptStore) DeleteFaultDetectRule(id string) error

DeleteFaultDetectRule delete fault detect rule

func (StableOptStore) DeleteGrayResource

func (g StableOptStore) DeleteGrayResource(tx store.Tx, data *model.GrayResource) error

DeleteGrayResource 删除灰度资源

func (StableOptStore) DeleteGroup

func (u StableOptStore) DeleteGroup(group *model.UserGroupDetail) error

DeleteGroup 删除用户组

func (StableOptStore) DeleteInstance

func (ins StableOptStore) DeleteInstance(instanceID string) error

DeleteInstance 删除一个实例,删除实例实际上是把flag置为1

func (StableOptStore) DeleteRateLimit

func (rls StableOptStore) DeleteRateLimit(limit *model.RateLimit) error

DeleteRateLimit 删除限流规则

func (StableOptStore) DeleteRoutingConfig

func (rs StableOptStore) DeleteRoutingConfig(serviceID string) error

DeleteRoutingConfig 删除

func (StableOptStore) DeleteRoutingConfigTx

func (rs StableOptStore) DeleteRoutingConfigTx(tx store.Tx, serviceID string) error

DeleteRoutingConfigTx 删除

func (StableOptStore) DeleteRoutingConfigV2

func (r StableOptStore) DeleteRoutingConfigV2(ruleID string) error

DeleteRoutingConfigV2 Delete a routing configuration

func (StableOptStore) DeleteService

func (ss StableOptStore) DeleteService(id, serviceName, namespaceName string) error

DeleteService 删除服务

func (StableOptStore) DeleteServiceAlias

func (ss StableOptStore) DeleteServiceAlias(name string, namespace string) error

DeleteServiceAlias 删除服务别名

func (StableOptStore) DeleteServiceContract

func (s StableOptStore) DeleteServiceContract(contract *model.ServiceContract) error

DeleteServiceContract 删除服务契约 删除该版本的全部数据

func (StableOptStore) DeleteServiceContractInterfaces

func (s StableOptStore) DeleteServiceContractInterfaces(contract *model.EnrichServiceContract) error

DeleteServiceContractInterfaces 删除服务契约API接口

func (StableOptStore) DeleteStrategy

func (s StableOptStore) DeleteStrategy(id string) error

func (StableOptStore) DeleteUser

func (u StableOptStore) DeleteUser(user *model.User) error

DeleteUser delete user by user id

func (*StableOptStore) Destroy

func (s *StableOptStore) Destroy() error

Destroy 退出函数

func (StableOptStore) EnableCircuitBreakerRule

func (c StableOptStore) EnableCircuitBreakerRule(cbRule *model.CircuitBreakerRule) error

EnableCircuitBreakerRule enable circuitbreaker rule

func (StableOptStore) EnableRateLimit

func (rls StableOptStore) EnableRateLimit(limit *model.RateLimit) error

EnableRateLimit 启用限流规则

func (StableOptStore) EnableRouting

func (r StableOptStore) EnableRouting(conf *model.RouterConfig) error

EnableRateLimit Enable current limit rules

func (StableOptStore) GenNextL5Sid

func (l5 StableOptStore) GenNextL5Sid(layoutID uint32) (string, error)

GenNextL5Sid 获取下一个sid

func (StableOptStore) GetCircuitBreakerRules

func (c StableOptStore) GetCircuitBreakerRules(
	filter map[string]string, offset uint32, limit uint32) (uint32, []*model.CircuitBreakerRule, error)

func (StableOptStore) GetCircuitBreakerRulesForCache

func (c StableOptStore) GetCircuitBreakerRulesForCache(
	mtime time.Time, firstUpdate bool) ([]*model.CircuitBreakerRule, error)

GetCircuitBreakerRulesForCache list circuitbreaker rules by query

func (StableOptStore) GetClientStat

func (cs StableOptStore) GetClientStat(clientID string) ([]*model.ClientStatStore, error)

func (StableOptStore) GetConfigFile

func (cf StableOptStore) GetConfigFile(namespace, group, name string) (*model.ConfigFile, error)

GetConfigFile 获取配置文件

func (StableOptStore) GetConfigFileActiveRelease

func (cfr StableOptStore) GetConfigFileActiveRelease(file *model.ConfigFileKey) (
	*model.ConfigFileRelease, error)

GetConfigFileActiveRelease .

func (StableOptStore) GetConfigFileActiveReleaseTx

func (cfr StableOptStore) GetConfigFileActiveReleaseTx(tx store.Tx,
	file *model.ConfigFileKey) (*model.ConfigFileRelease, error)

GetConfigFileActiveReleaseTx .

func (StableOptStore) GetConfigFileBetaReleaseTx

func (cfr StableOptStore) GetConfigFileBetaReleaseTx(tx store.Tx,
	file *model.ConfigFileKey) (*model.ConfigFileRelease, error)

GetConfigFileBetaReleaseTx .

func (StableOptStore) GetConfigFileGroup

func (fg StableOptStore) GetConfigFileGroup(namespace, name string) (*model.ConfigFileGroup, error)

GetConfigFileGroup 获取配置文件组

func (StableOptStore) GetConfigFileRelease

func (cfr StableOptStore) GetConfigFileRelease(req *model.ConfigFileReleaseKey) (
	*model.ConfigFileRelease, error)

GetConfigFileRelease 获取配置文件发布,只返回 flag=0 的记录

func (StableOptStore) GetConfigFileReleaseTx

func (cfr StableOptStore) GetConfigFileReleaseTx(tx store.Tx,
	req *model.ConfigFileReleaseKey) (*model.ConfigFileRelease, error)

GetConfigFileReleaseTx 在已开启的事务中获取配置文件发布内容,只获取 flag=0 的记录

func (StableOptStore) GetConfigFileTemplate

func (cf StableOptStore) GetConfigFileTemplate(name string) (*model.ConfigFileTemplate, error)

GetConfigFileTemplate get config file template by name

func (StableOptStore) GetConfigFileTx

func (cf StableOptStore) GetConfigFileTx(tx store.Tx,
	namespace, group, name string) (*model.ConfigFile, error)

GetConfigFile 获取配置文件

func (StableOptStore) GetDefaultStrategyDetailByPrincipal

func (s StableOptStore) GetDefaultStrategyDetailByPrincipal(principalId string,
	principalType model.PrincipalType) (*model.StrategyDetail, error)

GetDefaultStrategyDetailByPrincipal 获取默认策略

func (StableOptStore) GetExpandInstances

func (ins StableOptStore) GetExpandInstances(filter, metaFilter map[string]string, offset uint32,
	limit uint32) (uint32, []*model.Instance, error)

GetExpandInstances 根据过滤条件查看对应服务实例及数目

func (StableOptStore) GetExtendRateLimits

func (rls StableOptStore) GetExtendRateLimits(
	filter map[string]string, offset uint32, limit uint32) (uint32, []*model.ExtendRateLimit, error)

GetExtendRateLimits 根据过滤条件获取限流规则及数目

func (StableOptStore) GetFaultDetectRules

func (f StableOptStore) GetFaultDetectRules(
	filter map[string]string, offset uint32, limit uint32) (uint32, []*model.FaultDetectRule, error)

GetFaultDetectRules get all fault detect rules by query and limit

func (StableOptStore) GetFaultDetectRulesForCache

func (f StableOptStore) GetFaultDetectRulesForCache(
	mtime time.Time, firstUpdate bool) ([]*model.FaultDetectRule, error)

GetFaultDetectRulesForCache get increment circuitbreaker rules

func (StableOptStore) GetGroup

func (u StableOptStore) GetGroup(groupId string) (*model.UserGroupDetail, error)

GetGroup 根据用户组ID获取用户组

func (StableOptStore) GetGroupByName

func (u StableOptStore) GetGroupByName(name, owner string) (*model.UserGroup, error)

GetGroupByName 根据 owner、name 获取用户组

func (StableOptStore) GetGroups

func (u StableOptStore) GetGroups(filters map[string]string, offset uint32, limit uint32) (uint32,
	[]*model.UserGroup, error)

GetGroups 根据不同的请求情况进行不同的用户组列表查询

func (StableOptStore) GetGroupsForCache

func (u StableOptStore) GetGroupsForCache(mtime time.Time, firstUpdate bool) ([]*model.UserGroupDetail, error)

GetGroupsForCache .

func (StableOptStore) GetInstance

func (ins StableOptStore) GetInstance(instanceID string) (*model.Instance, error)

GetInstance 获取单个实例详情,只返回有效的数据

func (StableOptStore) GetInstancesBrief

func (ins StableOptStore) GetInstancesBrief(ids map[string]bool) (map[string]*model.Instance, error)

GetInstancesBrief 批量获取实例的serviceID

func (StableOptStore) GetInstancesCount

func (ins StableOptStore) GetInstancesCount() (uint32, error)

GetInstancesCount 获取有效的实例总数

func (StableOptStore) GetInstancesCountTx

func (ins StableOptStore) GetInstancesCountTx(tx store.Tx) (uint32, error)

GetInstancesCountTx .

func (StableOptStore) GetInstancesMainByService

func (ins StableOptStore) GetInstancesMainByService(serviceID, host string) ([]*model.Instance, error)

GetInstancesMainByService 根据服务和host获取实例 @note 不包括metadata

func (StableOptStore) GetL5Extend

func (l5 StableOptStore) GetL5Extend(serviceID string) (map[string]interface{}, error)

GetL5Extend 获取L5扩展数据

func (StableOptStore) GetMoreClients

func (cs StableOptStore) GetMoreClients(mtime time.Time, firstUpdate bool) (map[string]*model.Client, error)

GetMoreClients 根据mtime获取增量clients,返回所有store的变更信息

func (StableOptStore) GetMoreConfigGroup

func (fg StableOptStore) GetMoreConfigGroup(firstUpdate bool,
	mtime time.Time) ([]*model.ConfigFileGroup, error)

func (StableOptStore) GetMoreGrayResouces

func (g StableOptStore) GetMoreGrayResouces(firstUpdate bool,
	modifyTime time.Time) ([]*model.GrayResource, error)

GetMoreGrayResouces 获取最近更新的灰度资源, 此方法用于 cache 增量更新,需要注意 modifyTime 应为数据库时间戳

func (StableOptStore) GetMoreInstances

func (ins StableOptStore) GetMoreInstances(tx store.Tx, mtime time.Time, firstUpdate, needMeta bool,
	serviceID []string) (map[string]*model.Instance, error)

GetMoreInstances 根据mtime获取增量修改数据 这里会返回所有的数据的,包括valid=false的数据 对于首次拉取,firstUpdate=true,只会拉取flag!=1的数据

func (StableOptStore) GetMoreL5Extend

func (l5 StableOptStore) GetMoreL5Extend(mtime time.Time) (map[string]map[string]interface{}, error)

GetMoreL5Extend 获取更多的增量数据

func (StableOptStore) GetMoreL5IPConfigs

func (l5 StableOptStore) GetMoreL5IPConfigs(flow uint32) ([]*model.IPConfig, error)

GetMoreL5IPConfigs 获取更多的L5 IPConfig信息

func (StableOptStore) GetMoreL5Policies

func (l5 StableOptStore) GetMoreL5Policies(flow uint32) ([]*model.Policy, error)

GetMoreL5Policies 获取更多的L5 Policy信息

func (StableOptStore) GetMoreL5Routes

func (l5 StableOptStore) GetMoreL5Routes(flow uint32) ([]*model.Route, error)

GetMoreL5Routes 获取更多的L5 Route信息

func (StableOptStore) GetMoreL5Sections

func (l5 StableOptStore) GetMoreL5Sections(flow uint32) ([]*model.Section, error)

GetMoreL5Sections 获取更多的L5 Section信息

func (StableOptStore) GetMoreNamespaces

func (ns StableOptStore) GetMoreNamespaces(mtime time.Time) ([]*model.Namespace, error)

GetMoreNamespaces 根据mtime获取命名空间

func (StableOptStore) GetMoreReleaseFile

func (cfr StableOptStore) GetMoreReleaseFile(firstUpdate bool,
	modifyTime time.Time) ([]*model.ConfigFileRelease, error)

GetMoreReleaseFile 获取最近更新的配置文件发布, 此方法用于 cache 增量更新,需要注意 modifyTime 应为数据库时间戳

func (StableOptStore) GetMoreServiceContracts

func (s StableOptStore) GetMoreServiceContracts(firstUpdate bool, mtime time.Time) (
	[]*model.EnrichServiceContract, error)

GetMoreServiceContracts 查询服务契约数据

func (StableOptStore) GetMoreServices

func (ss StableOptStore) GetMoreServices(mtime time.Time, firstUpdate, disableBusiness, needMeta bool) (
	map[string]*model.Service, error)

GetMoreServices 根据modify_time获取增量数据

func (StableOptStore) GetNamespace

func (ns StableOptStore) GetNamespace(name string) (*model.Namespace, error)

GetNamespace 根据名字获取命名空间详情,只返回有效的

func (StableOptStore) GetNamespaces

func (ns StableOptStore) GetNamespaces(filter map[string][]string, offset, limit int) (
	[]*model.Namespace, uint32, error)

GetNamespaces 根据过滤条件查询命名空间及数目

func (StableOptStore) GetRateLimitWithID

func (rls StableOptStore) GetRateLimitWithID(id string) (*model.RateLimit, error)

GetRateLimitWithID 根据限流规则ID获取限流规则

func (StableOptStore) GetRateLimitsForCache

func (rls StableOptStore) GetRateLimitsForCache(mtime time.Time,
	firstUpdate bool) ([]*model.RateLimit, error)

GetRateLimitsForCache 根据修改时间拉取增量限流规则及最新版本号

func (StableOptStore) GetRoutingConfigV2WithID

func (r StableOptStore) GetRoutingConfigV2WithID(ruleID string) (*model.RouterConfig, error)

GetRoutingConfigV2WithID Pull the routing configuration according to the rules ID

func (StableOptStore) GetRoutingConfigV2WithIDTx

func (r StableOptStore) GetRoutingConfigV2WithIDTx(tx store.Tx, ruleID string) (*model.RouterConfig, error)

GetRoutingConfigV2WithIDTx Pull the routing configuration according to the rules ID

func (StableOptStore) GetRoutingConfigWithID

func (rs StableOptStore) GetRoutingConfigWithID(id string) (*model.RoutingConfig, error)

GetRoutingConfigWithID 根据服务ID获取对应的配置

func (StableOptStore) GetRoutingConfigWithService

func (rs StableOptStore) GetRoutingConfigWithService(
	name string, namespace string) (*model.RoutingConfig, error)

GetRoutingConfigWithService 根据服务名+namespace获取对应的配置

func (StableOptStore) GetRoutingConfigs

func (rs StableOptStore) GetRoutingConfigs(filter map[string]string,
	offset uint32, limit uint32) (uint32, []*model.ExtendRoutingConfig, error)

GetRoutingConfigs 获取路由配置列表

func (StableOptStore) GetRoutingConfigsForCache

func (rs StableOptStore) GetRoutingConfigsForCache(
	mtime time.Time, firstUpdate bool) ([]*model.RoutingConfig, error)

GetRoutingConfigsForCache 缓存增量拉取

func (StableOptStore) GetRoutingConfigsV2ForCache

func (r StableOptStore) GetRoutingConfigsV2ForCache(
	mtime time.Time, firstUpdate bool) ([]*model.RouterConfig, error)

GetRoutingConfigsV2ForCache Pull the incremental routing configuration information through mtime

func (StableOptStore) GetService

func (ss StableOptStore) GetService(name string, namespace string) (*model.Service, error)

GetService 获取服务详情,只返回有效的数据

func (StableOptStore) GetServiceAliases

func (ss StableOptStore) GetServiceAliases(filter map[string]string, offset uint32, limit uint32) (uint32,
	[]*model.ServiceAlias, error)

GetServiceAliases 获取服务别名列表

func (StableOptStore) GetServiceByID

func (ss StableOptStore) GetServiceByID(id string) (*model.Service, error)

GetServiceByID 根据服务ID查询服务详情

func (StableOptStore) GetServiceContract

func (s StableOptStore) GetServiceContract(id string) (data *model.EnrichServiceContract, err error)

GetServiceContract 通过ID查询服务契约数据

func (StableOptStore) GetServices

func (ss StableOptStore) GetServices(serviceFilters, serviceMetas map[string]string, instanceFilters *store.InstanceArgs,
	offset, limit uint32) (uint32, []*model.Service, error)

GetServices 根据相关条件查询对应服务及数目,不包括别名

func (StableOptStore) GetServicesBatch

func (ss StableOptStore) GetServicesBatch(services []*model.Service) ([]*model.Service, error)

GetServicesBatch 查询多个服务的id

func (StableOptStore) GetServicesCount

func (ss StableOptStore) GetServicesCount() (uint32, error)

GetServicesCount 获取所有服务总数

func (StableOptStore) GetSourceServiceToken

func (ss StableOptStore) GetSourceServiceToken(name string, namespace string) (*model.Service, error)

GetSourceServiceToken 获取只获取服务token 返回服务ID,服务token

func (StableOptStore) GetStrategies

func (s StableOptStore) GetStrategies(filters map[string]string, offset uint32, limit uint32) (uint32,
	[]*model.StrategyDetail, error)

GetStrategies 获取策略列表

func (StableOptStore) GetStrategyDetail

func (s StableOptStore) GetStrategyDetail(id string) (*model.StrategyDetail, error)

GetStrategyDetail 获取策略详情

func (StableOptStore) GetStrategyDetailsForCache

func (s StableOptStore) GetStrategyDetailsForCache(mtime time.Time,
	firstUpdate bool) ([]*model.StrategyDetail, error)

func (StableOptStore) GetStrategyResources

func (s StableOptStore) GetStrategyResources(principalId string,
	principalRole model.PrincipalType) ([]model.StrategyResource, error)

GetStrategyResources 获取对应 principal 能操作的所有资源

func (StableOptStore) GetSubCount

func (u StableOptStore) GetSubCount(user *model.User) (uint32, error)

GetSubCount get user's sub count

func (StableOptStore) GetSystemServices

func (ss StableOptStore) GetSystemServices() ([]*model.Service, error)

GetSystemServices 获取系统服务

func (StableOptStore) GetUnHealthyInstances

func (m StableOptStore) GetUnHealthyInstances(timeout time.Duration, limit uint32) ([]string, error)

func (StableOptStore) GetUnixSecond

func (t StableOptStore) GetUnixSecond(maxWait time.Duration) (int64, error)

GetUnixSecond 获取当前时间,单位秒

func (StableOptStore) GetUser

func (u StableOptStore) GetUser(id string) (*model.User, error)

GetUser get user by user id

func (StableOptStore) GetUserByIds

func (u StableOptStore) GetUserByIds(ids []string) ([]*model.User, error)

GetUserByIds Get user list data according to user ID

func (StableOptStore) GetUserByName

func (u StableOptStore) GetUserByName(name, ownerId string) (*model.User, error)

GetUserByName 根据用户名、owner 获取用户

func (StableOptStore) GetUsers

func (u StableOptStore) GetUsers(filters map[string]string, offset uint32, limit uint32) (uint32,
	[]*model.User, error)

GetUsers Query user list information Case 1. From the user's perspective, normal query conditions Case 2. From the perspective of the user group, query is the list of users involved under a user group.

func (StableOptStore) GetUsersForCache

func (u StableOptStore) GetUsersForCache(mtime time.Time, firstUpdate bool) ([]*model.User, error)

GetUsersForCache Get user information, mainly for cache

func (StableOptStore) HasCircuitBreakerRule

func (c StableOptStore) HasCircuitBreakerRule(id string) (bool, error)

HasCircuitBreakerRule check circuitbreaker rule exists

func (StableOptStore) HasCircuitBreakerRuleByName

func (c StableOptStore) HasCircuitBreakerRuleByName(name string, namespace string) (bool, error)

HasCircuitBreakerRuleByName check circuitbreaker rule exists by name

func (StableOptStore) HasCircuitBreakerRuleByNameExcludeId

func (c StableOptStore) HasCircuitBreakerRuleByNameExcludeId(
	name string, namespace string, id string) (bool, error)

HasCircuitBreakerRuleByNameExcludeId check circuitbreaker rule exists by name exclude id

func (StableOptStore) HasFaultDetectRule

func (f StableOptStore) HasFaultDetectRule(id string) (bool, error)

HasFaultDetectRule check fault detect rule exists

func (StableOptStore) HasFaultDetectRuleByName

func (f StableOptStore) HasFaultDetectRuleByName(name string, namespace string) (bool, error)

HasFaultDetectRuleByName check fault detect rule exists by name

func (StableOptStore) HasFaultDetectRuleByNameExcludeId

func (f StableOptStore) HasFaultDetectRuleByNameExcludeId(
	name string, namespace string, id string) (bool, error)

HasFaultDetectRuleByNameExcludeId check fault detect rule exists by name not this id

func (StableOptStore) InactiveConfigFileReleaseTx

func (cfr StableOptStore) InactiveConfigFileReleaseTx(tx store.Tx, release *model.ConfigFileRelease) error

func (*StableOptStore) Initialize

func (s *StableOptStore) Initialize(conf *store.Config) error

Initialize 初始化函数

func (StableOptStore) IsLeader

func (m StableOptStore) IsLeader(key string) bool

IsLeader check leader

func (StableOptStore) ListLeaderElections

func (m StableOptStore) ListLeaderElections() ([]*model.LeaderElection, error)

ListLeaderElections list election records

func (StableOptStore) LockConfigFile

func (cf StableOptStore) LockConfigFile(tx store.Tx, file *model.ConfigFileKey) (*model.ConfigFile, error)

LockConfigFile 加锁配置文件

func (StableOptStore) LooseAddStrategyResources

func (s StableOptStore) LooseAddStrategyResources(resources []model.StrategyResource) error

LooseAddStrategyResources loose add strategy resources

func (*StableOptStore) Name

func (s *StableOptStore) Name() string

Name 实现Name函数

func (StableOptStore) QueryAllConfigFileTemplates

func (cf StableOptStore) QueryAllConfigFileTemplates() ([]*model.ConfigFileTemplate, error)

QueryAllConfigFileTemplates query all config file templates

func (StableOptStore) QueryConfigFileReleaseHistories

func (rh StableOptStore) QueryConfigFileReleaseHistories(filter map[string]string,
	offset, limit uint32) (uint32, []*model.ConfigFileReleaseHistory, error)

QueryConfigFileReleaseHistories 获取配置文件的发布历史记录

func (StableOptStore) QueryConfigFiles

func (cf StableOptStore) QueryConfigFiles(filter map[string]string, offset, limit uint32) (
	uint32, []*model.ConfigFile, error)

QueryConfigFiles 翻页查询配置文件,group、name可为模糊匹配

func (StableOptStore) ReleaseLeaderElection

func (m StableOptStore) ReleaseLeaderElection(key string) error

ReleaseLeaderElection release election lock

func (StableOptStore) RemoveStrategyResources

func (s StableOptStore) RemoveStrategyResources(resources []model.StrategyResource) error

RemoveStrategyResources 删除策略的资源

func (StableOptStore) SetInstanceHealthStatus

func (ins StableOptStore) SetInstanceHealthStatus(instanceID string, flag int, revision string) error

SetInstanceHealthStatus 设置实例健康状态

func (StableOptStore) SetL5Extend

func (l5 StableOptStore) SetL5Extend(serviceID string, meta map[string]interface{}) (map[string]interface{}, error)

SetL5Extend 保存L5扩展数据

func (StableOptStore) StartLeaderElection

func (m StableOptStore) StartLeaderElection(key string) error

StartLeaderElection start the election procedure

func (*StableOptStore) StartReadTx

func (s *StableOptStore) StartReadTx() (store.Tx, error)

func (*StableOptStore) StartTx

func (s *StableOptStore) StartTx() (store.Tx, error)

func (StableOptStore) StopLeaderElections

func (m StableOptStore) StopLeaderElections()

StopLeaderElections stop the election procedure

func (StableOptStore) UpdateCircuitBreakerRule

func (c StableOptStore) UpdateCircuitBreakerRule(cbRule *model.CircuitBreakerRule) error

UpdateCircuitBreakerRule 更新熔断规则

func (StableOptStore) UpdateClient

func (cs StableOptStore) UpdateClient(client *model.Client) error

UpdateClient update the client info

func (StableOptStore) UpdateConfigFileGroup

func (fg StableOptStore) UpdateConfigFileGroup(fileGroup *model.ConfigFileGroup) error

UpdateConfigFileGroup 更新配置文件组信息

func (StableOptStore) UpdateConfigFileTx

func (cf StableOptStore) UpdateConfigFileTx(tx store.Tx, file *model.ConfigFile) error

UpdateConfigFile 更新配置文件

func (StableOptStore) UpdateFaultDetectRule

func (f StableOptStore) UpdateFaultDetectRule(fdRule *model.FaultDetectRule) error

UpdateFaultDetectRule update fault detect rule

func (StableOptStore) UpdateGroup

func (u StableOptStore) UpdateGroup(group *model.ModifyUserGroup) error

UpdateGroup 更新用户组

func (StableOptStore) UpdateInstance

func (ins StableOptStore) UpdateInstance(instance *model.Instance) error

UpdateInstance 更新实例

func (StableOptStore) UpdateNamespace

func (ns StableOptStore) UpdateNamespace(namespace *model.Namespace) error

UpdateNamespace 更新命名空间,目前只更新owner

func (StableOptStore) UpdateNamespaceToken

func (ns StableOptStore) UpdateNamespaceToken(name string, token string) error

UpdateNamespaceToken 更新命名空间token

func (StableOptStore) UpdateRateLimit

func (rls StableOptStore) UpdateRateLimit(limit *model.RateLimit) error

UpdateRateLimit 更新限流规则

func (StableOptStore) UpdateRoutingConfig

func (rs StableOptStore) UpdateRoutingConfig(conf *model.RoutingConfig) error

UpdateRoutingConfig 更新

func (StableOptStore) UpdateRoutingConfigV2

func (r StableOptStore) UpdateRoutingConfigV2(conf *model.RouterConfig) error

UpdateRoutingConfigV2 Update a routing configuration

func (StableOptStore) UpdateRoutingConfigV2Tx

func (r StableOptStore) UpdateRoutingConfigV2Tx(tx store.Tx, conf *model.RouterConfig) error

func (StableOptStore) UpdateService

func (ss StableOptStore) UpdateService(service *model.Service, needUpdateOwner bool) error

UpdateService 更新完整的服务信息

func (StableOptStore) UpdateServiceAlias

func (ss StableOptStore) UpdateServiceAlias(alias *model.Service, needUpdateOwner bool) error

UpdateServiceAlias 更新服务别名

func (StableOptStore) UpdateServiceContract

func (s StableOptStore) UpdateServiceContract(contract *model.ServiceContract) error

UpdateServiceContract 更新服务契约信息

func (StableOptStore) UpdateServiceToken

func (ss StableOptStore) UpdateServiceToken(id string, token string, revision string) error

UpdateServiceToken 更新服务token

func (StableOptStore) UpdateStrategy

func (s StableOptStore) UpdateStrategy(strategy *model.ModifyStrategyDetail) error

UpdateStrategy 更新鉴权规则

func (StableOptStore) UpdateUser

func (u StableOptStore) UpdateUser(user *model.User) error

UpdateUser 更新用户信息

type Tx

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

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) CreateReadView

func (t *Tx) CreateReadView() error

func (*Tx) GetDelegateTx

func (t *Tx) GetDelegateTx() interface{}

func (*Tx) Rollback

func (t *Tx) Rollback() error

Jump to

Keyboard shortcuts

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