boltdb

package
v1.18.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CbFieldLevel        = "Level"
	CbFieldSrcService   = "SrcService"
	CbFieldSrcNamespace = "SrcNamespace"
	CbFieldDstService   = "DstService"
	CbFieldDstNamespace = "DstNamespace"
	CbFieldDstMethod    = "DstMethod"
	CbFieldRule         = "Rule"
)
View Source
const (
	VersionForMaster      string = "master"
	CBFieldNameValid      string = "Valid"
	CBFieldNameVersion    string = "Version"
	CBFieldNameID         string = "ID"
	CBFieldNameModifyTime string = "ModifyTime"

	CBRFieldNameServiceID   string = "ServiceID"
	CBRFieldNameRuleID      string = "RuleID"
	CBRFieldNameRuleVersion string = "RuleVersion"

	CBRelationFieldServiceID   string = "ServiceID"
	CBRelationFieldRuleID      string = "RuleID"
	CBRelationFieldRuleVersion string = "RuleVersion"
	CBRelationFieldValid       string = "Valid"
	CBRelationFieldCreateTime  string = "CreateTime"
	CBRelationFieldModifyTime  string = "ModifyTime"
)
View Source
const (
	ClientFieldHost       string = "Host"
	ClientFieldType       string = "Type"
	ClientFieldVersion    string = "Version"
	ClientFieldLocation   string = "Location"
	ClientFieldId         string = "Id"
	ClientFieldStatArrStr string = "StatArrStr"
	ClientFieldCtime      string = "Ctime"
	ClientFieldMtime      string = "Mtime"
	ClientFieldValid      string = "Valid"
)
View Source
const (
	FileFieldId          string = "Id"
	FileFieldName        string = "Name"
	FileFieldNamespace   string = "Namespace"
	FileFieldGroup       string = "Group"
	FileFieldContent     string = "Content"
	FileFieldComment     string = "Comment"
	FileFieldFormat      string = "Format"
	FileFieldFlag        string = "Flag"
	FileFieldCreateTime  string = "CreateTime"
	FileFieldCreateBy    string = "CreateBy"
	FileFieldModifyTime  string = "ModifyTime"
	FileFieldModifyBy    string = "ModifyBy"
	FileFieldValid       string = "Valid"
	FileFieldMetadata    string = "Metadata"
	FileFieldEncrypt     string = "Encrypt"
	FileFieldEncryptAlgo string = "EncryptAlgo"
)
View Source
const (
	FileGroupFieldId         string = "Id"
	FileGroupFieldName       string = "Name"
	FileGroupFieldNamespace  string = "Namespace"
	FileGroupFieldComment    string = "Comment"
	FileGroupFieldCreateBy   string = "CreateBy"
	FileGroupFieldModifyBy   string = "ModifyBy"
	FileGroupFieldCreateTime string = "CreateTime"
	FileGroupFieldModifyTime string = "ModifyTime"
	FileGroupFieldValid      string = "Valid"
	FileGroupFieldBusiness   string = "Business"
	FileGroupFieldDepartment string = "Department"
	FileGroupFieldMetadata   string = "Metadata"
)
View Source
const (
	FileReleaseFieldId         string = "Id"
	FileReleaseFieldName       string = "Name"
	FileReleaseFieldNamespace  string = "Namespace"
	FileReleaseFieldGroup      string = "Group"
	FileReleaseFieldFileName   string = "FileName"
	FileReleaseFieldContent    string = "Content"
	FileReleaseFieldComment    string = "Comment"
	FileReleaseFieldMd5        string = "Md5"
	FileReleaseFieldVersion    string = "Version"
	FileReleaseFieldFlag       string = "Flag"
	FileReleaseFieldCreateTime string = "CreateTime"
	FileReleaseFieldCreateBy   string = "CreateBy"
	FileReleaseFieldModifyTime string = "ModifyTime"
	FileReleaseFieldModifyBy   string = "ModifyBy"
	FileReleaseFieldValid      string = "Valid"
	FileReleaseFieldActive     string = "Active"
	FileReleaseFieldMetadata   string = "Metadata"
	FileReleaseFieldType       string = "Typ"
)
View Source
const (
	FileHistoryFieldId         string = "Id"
	FileHistoryFieldName       string = "Name"
	FileHistoryFieldNamespace  string = "Namespace"
	FileHistoryFieldGroup      string = "Group"
	FileHistoryFieldFileName   string = "FileName"
	FileHistoryFieldFormat     string = "Format"
	FileHistoryFieldTags       string = "Tags"
	FileHistoryFieldContent    string = "Content"
	FileHistoryFieldComment    string = "Comment"
	FileHistoryFieldMd5        string = "Md5"
	FileHistoryFieldType       string = "Type"
	FileHistoryFieldStatus     string = "Status"
	FileHistoryFieldCreateBy   string = "CreateBy"
	FileHistoryFieldModifyBy   string = "ModifyBy"
	FileHistoryFieldCreateTime string = "CreateTime"
	FileHistoryFieldModifyTime string = "ModifyTime"
	FileHistoryFieldValid      string = "Valid"
)
View Source
const (

	// SystemNamespace system namespace
	SystemNamespace = "Polaris"
	// STORENAME database storage name
	STORENAME = "boltdbStore"
	// DefaultConnMaxLifetime default maximum connection lifetime
	DefaultConnMaxLifetime = 60 * 30 // 默认是30分钟
)
View Source
const (
	CommonFieldValid       = "Valid"
	CommonFieldEnableTime  = "EnableTime"
	CommonFieldModifyTime  = "ModifyTime"
	CommonFieldRevision    = "Revision"
	CommonFieldID          = "ID"
	CommonFieldName        = "Name"
	CommonFieldNamespace   = "Namespace"
	CommonFieldDescription = "Description"
	CommonFieldEnable      = "Enable"
)
View Source
const (
	GroupFieldID          string = "ID"
	GroupFieldName        string = "Name"
	GroupFieldOwner       string = "Owner"
	GroupFieldToken       string = "Token"
	GroupFieldTokenEnable string = "TokenEnable"
	GroupFieldValid       string = "Valid"
	GroupFieldComment     string = "Comment"
	GroupFieldCreateTime  string = "CreateTime"
	GroupFieldModifyTime  string = "ModifyTime"
	GroupFieldUserIds     string = "UserIds"
)
View Source
const (
	DeleteFlagValue    byte   = 1
	DataValidFieldName string = "Valid"
)
View Source
const (
	OwnerAttribute string = "owner"
	NameAttribute  string = "name"
)
View Source
const (
	RateLimitFieldID         string = "ID"
	RateLimitFieldServiceID  string = "ServiceID"
	RateLimitFieldClusterID  string = "ClusterID"
	RateLimitFieldEnableTime string = "EnableTime"
	RateLimitFieldName       string = "Name"
	RateLimitFieldDisable    string = "Disable"
	RateLimitFieldMethod     string = "Method"
	RateLimitFieldLabels     string = "Labels"
	RateLimitFieldPriority   string = "Priority"
	RateLimitFieldRule       string = "Rule"
	RateLimitFieldRevision   string = "Revision"
	RateLimitFieldValid      string = "Valid"
	RateLimitFieldCreateTime string = "CreateTime"
	RateLimitFieldModifyTime string = "ModifyTime"
	RateConfFieldMtime       string = "ModifyTime"
	RateConfFieldServiceID   string = "ServiceID"
	RateConfFieldValid       string = "Valid"
)
View Source
const (
	SvcFieldID         string = "ID"
	SvcFieldName       string = "Name"
	SvcFieldNamespace  string = "Namespace"
	SvcFieldBusiness   string = "Business"
	SvcFieldPorts      string = "Ports"
	SvcFieldMeta       string = "Meta"
	SvcFieldComment    string = "Comment"
	SvcFieldDepartment string = "Department"
	SvcFieldModifyTime string = "ModifyTime"
	SvcFieldToken      string = "Token"
	SvcFieldOwner      string = "Owner"
	SvcFieldRevision   string = "Revision"
	SvcFieldReference  string = "Reference"
	SvcFieldValid      string = "Valid"
	SvcFieldCmdbMod1   string = "CmdbMod1"
	SvcFieldCmdbMod2   string = "CmdbMod2"
	SvcFieldCmdbMod3   string = "CmdbMod3"
	SvcFieldExportTo   string = "ExportTo"
)
View Source
const (
	ContractFieldID         = "ID"
	ContractFieldNamespace  = "Namespace"
	ContractFieldService    = "Service"
	ContractFieldName       = "Name"
	ContractFieldProtocol   = "Protocol"
	ContractFieldVersion    = "Version"
	ContractFieldRevision   = "Revision"
	ContractFieldContent    = "Content"
	ContractFieldInterfaces = "Interfaces"
	ContractFieldCreateTime = "CreateTime"
	ContractFieldModifyTime = "ModifyTime"
	ContractFieldValid      = "Valid"
)
View Source
const (
	StrategyFieldID              string = "ID"
	StrategyFieldName            string = "Name"
	StrategyFieldAction          string = "Action"
	StrategyFieldComment         string = "Comment"
	StrategyFieldUsersPrincipal  string = "Users"
	StrategyFieldGroupsPrincipal string = "Groups"
	StrategyFieldDefault         string = "Default"
	StrategyFieldOwner           string = "Owner"
	StrategyFieldNsResources     string = "NsResources"
	StrategyFieldSvcResources    string = "SvcResources"
	StrategyFieldCfgResources    string = "CfgResources"
	StrategyFieldValid           string = "Valid"
	StrategyFieldRevision        string = "Revision"
	StrategyFieldCreateTime      string = "CreateTime"
	StrategyFieldModifyTime      string = "ModifyTime"
)
View Source
const (

	// UserFieldID 用户ID字段
	UserFieldID string = "ID"
	// UserFieldName 用户名字段
	UserFieldName string = "Name"
	// UserFieldPassword 用户密码字段
	UserFieldPassword string = "Password"
	// UserFieldOwner 用户Owner字段
	UserFieldOwner string = "Owner"
	// UserFieldSource 用户来源字段
	UserFieldSource string = "Source"
	// UserFieldType 用户类型字段
	UserFieldType string = "Type"
	// UserFieldToken 用户Token字段
	UserFieldToken string = "Token"
	// UserFieldTokenEnable 用户Token是否可用字段
	UserFieldTokenEnable string = "TokenEnable"
	// UserFieldValid 用户逻辑删除字段
	UserFieldValid string = "Valid"
	// UserFieldComment 用户备注字段
	UserFieldComment string = "Comment"
	// UserFieldCreateTime 用户创建时间字段
	UserFieldCreateTime string = "CreateTime"
	// UserFieldModifyTime 用户修改时间字段
	UserFieldModifyTime string = "ModifyTime"
	// UserFieldMobile 用户手机号信息
	UserFieldMobile string = "Mobile"
	// UserFieldEmail 用户邮箱信息
	UserFieldEmail string = "Email"
)
View Source
const (
	GrayResourceFieldModifyTime string = "ModifyTime"
)

Variables

View Source
var (
	// ErrorMultipleGroupFound is returned when multiple groups are found.
	ErrorMultipleGroupFound error = errors.New("multiple group found")
	// ErrorGroupNotFound is returned when a group is not found.
	ErrorGroupNotFound error = errors.New("usergroup not found")
)
View Source
var (
	ErrBadParam       = errors.New("missing some params")
	ErrMultipleResult = errors.New("multiple ratelimit find")
)
View Source
var (
	ErrorMultiDefaultStrategy error = errors.New("multiple strategy found")
	ErrorStrategyNotFound     error = errors.New("strategy not fonud")
)
View Source
var (
	ErrMultipleConfigFileFound = errors.New("multiple config_file found")
)
View Source
var (
	ErrMultipleConfigFileGroupFound error = errors.New("multiple config_file_group found")
)
View Source
var (
	ErrMultipleConfigFileReleaseFound error = errors.New("multiple config_file_release found")
)
View Source
var (
	// ErrMultipleRoutingV2Found 多个路由配置
	ErrMultipleRoutingV2Found = errors.New("multiple routing v2 found")
)
View Source
var (
	ErrMultipleSvcFound = errors.New("multiple service find")
)
View Source
var (
	// ErrMultipleUserFound 多个用户
	ErrMultipleUserFound = errors.New("multiple user found")
)
View Source
var (
	ErrorValueInvisible = errors.New("value is Invisible")
)

Functions

func DoTransactionIfNeed

func DoTransactionIfNeed(sTx store.Tx, handler BoltHandler, handle transactionFunc) ([]interface{}, error)

func NewBoltTx

func NewBoltTx(delegateTx *bolt.Tx) store.Tx

Types

type BoltConfig

type BoltConfig struct {
	// FileName boltdb store file
	FileName string
}

BoltConfig config to initialize boltdb

func (*BoltConfig) Parse

func (c *BoltConfig) Parse(opt map[string]interface{})

Parse parse yaml config

type BoltHandler

type BoltHandler interface {

	// SaveValue insert data object, each data object should be identified by unique key
	SaveValue(typ string, key string, object interface{}) error

	// DeleteValues delete data object by unique key
	DeleteValues(typ string, key []string) error

	// UpdateValue update properties of data object
	UpdateValue(typ string, key string, properties map[string]interface{}) error

	// LoadValues load data objects by unique keys, return value is 'key->object' map
	LoadValues(typ string, keys []string, typObject interface{}) (map[string]interface{}, error)

	// LoadValuesByFilter filter data objects by condition, return value is 'key->object' map
	LoadValuesByFilter(typ string, fields []string,
		typObject interface{}, filter func(map[string]interface{}) bool) (map[string]interface{}, error)

	// LoadValuesAll load all saved data objects, return value is 'key->object' map
	LoadValuesAll(typ string, typObject interface{}) (map[string]interface{}, error)

	// IterateFields iterate all saved data objects
	IterateFields(typ string, field string, typObject interface{}, process func(interface{})) error

	// CountValues count all data objects
	CountValues(typ string) (int, error)

	// Execute execute scripts directly
	Execute(writable bool, process func(tx *bolt.Tx) error) error

	// StartTx start new tx
	StartTx() (store.Tx, error)

	// Close boltdb
	Close() error
}

BoltHandler encapsulate operations around boltdb

func NewBoltHandler

func NewBoltHandler(config *BoltConfig) (BoltHandler, error)

NewBoltHandler create the boltdb handler

type ConfigFileRelease added in v1.17.3

type ConfigFileRelease struct {
	Id         uint64
	Name       string
	Namespace  string
	Group      string
	FileName   string
	Version    uint64
	Comment    string
	Md5        string
	Flag       int
	Active     bool
	Valid      bool
	Format     string
	Metadata   map[string]string
	CreateTime time.Time
	CreateBy   string
	ModifyTime time.Time
	ModifyBy   string
	Content    string
	Typ        string
}

type DefaultData added in v1.18.0

type DefaultData struct {
	Namespaces []*model.Namespace `yaml:"namespaces"`
	Users      []*model.User      `yaml:"users"`
}

DefaultData 默认数据信息

type IDHolder

type IDHolder struct {
	ID uint64
}

type Namespace added in v1.18.0

type Namespace struct {
	Name    string
	Comment string
	Token   string
	Owner   string
	Valid   bool
	// ServiceExportTo 服务可见性设置
	ServiceExportTo string
	CreateTime      time.Time
	ModifyTime      time.Time
}

Namespace 命名空间结构体

type NamespaceSlice

type NamespaceSlice []*model.Namespace

func (NamespaceSlice) Len

func (ns NamespaceSlice) Len() int

Len length of namespace slice

func (NamespaceSlice) Less

func (ns NamespaceSlice) Less(i, j int) bool

Less compare namespace

func (NamespaceSlice) Swap

func (ns NamespaceSlice) Swap(i, j int)

Swap swap elements

type Service added in v1.18.0

type Service struct {
	ID         string
	Name       string
	Namespace  string
	Ports      string
	Meta       map[string]string
	Comment    string
	Business   string
	Department string
	CmdbMod1   string
	CmdbMod2   string
	CmdbMod3   string
	Token      string
	Owner      string
	// ExportTo 服务可见性暴露设置
	ExportTo    string
	Revision    string
	Reference   string
	ReferFilter string
	PlatformID  string
	Valid       bool
	CreateTime  time.Time
	ModifyTime  time.Time
	Mtime       int64
	Ctime       int64
}

type ServiceContract added in v1.18.0

type ServiceContract struct {
	ID string
	// 所属命名空间
	Namespace string
	// 所属服务名称
	Service string
	// 契约名称
	Name string
	// 协议,http/grpc/dubbo/thrift
	Protocol string
	// 契约版本
	Version string
	// 信息摘要
	Revision string
	// 额外描述
	Content string
	// 接口描述信息
	Interfaces string
	// 创建时间
	CreateTime time.Time
	// 更新时间
	ModifyTime time.Time
	// 是否有效
	Valid bool
}

type Tx

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

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) CreateReadView added in v1.17.3

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