cache

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const FindParentScript = `` /* 655-byte string literal not displayed */
View Source
const (
	// 全局模型结构缓存
	ModelCacheKey = "_model_cache"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonResourceIface

type CommonResourceIface interface {
	GetKind() string
	GetID() uint
	GetTenantID() uint
	GetProjectID() uint
	GetEnvironmentID() uint
	GetVirtualSpaceID() uint
	GetName() string
	GetCluster() string
	GetNamespace() string
	GetOwners() []CommonResourceIface
}

type Entity

type Entity struct {
	Name      string    `json:",omitempty"`
	Kind      string    `json:",omitempty"`
	ID        uint      `json:",omitempty"`
	Namespace string    `json:",omitempty"`
	Cluster   string    `json:",omitempty"`
	Owner     []*Entity `json:",omitempty"`
	Children  []string  `json:",omitempty"`
}

func (*Entity) GetCluster

func (n *Entity) GetCluster() string

func (*Entity) GetEnvironmentID

func (n *Entity) GetEnvironmentID() uint

func (*Entity) GetID

func (n *Entity) GetID() uint

func (*Entity) GetKind

func (n *Entity) GetKind() string

func (*Entity) GetName

func (n *Entity) GetName() string

func (*Entity) GetNamespace

func (n *Entity) GetNamespace() string

func (*Entity) GetOwners

func (n *Entity) GetOwners() []CommonResourceIface

func (*Entity) GetProjectID

func (n *Entity) GetProjectID() uint

func (*Entity) GetTenantID

func (n *Entity) GetTenantID() uint

func (*Entity) GetVirtualSpaceID

func (n *Entity) GetVirtualSpaceID() uint

func (*Entity) MarshalBinary

func (n *Entity) MarshalBinary() ([]byte, error)

func (*Entity) UnmarshalBinary

func (n *Entity) UnmarshalBinary(data []byte) error

type ModelCache

type ModelCache struct {
	DB    *gorm.DB
	Redis *redis.Client
}

func (*ModelCache) BuildCacheIfNotExist

func (t *ModelCache) BuildCacheIfNotExist() error

func (*ModelCache) DelEnvironment

func (t *ModelCache) DelEnvironment(pid, eid uint, cluster, namespace string) error

func (*ModelCache) DelProject

func (t *ModelCache) DelProject(tid, pid uint) error

func (*ModelCache) DelTenant

func (t *ModelCache) DelTenant(tid uint) error

func (*ModelCache) DelVirtualSpace

func (t *ModelCache) DelVirtualSpace(vid uint) error

func (*ModelCache) FindEnvironment

func (c *ModelCache) FindEnvironment(cluster, namespace string) CommonResourceIface

func (*ModelCache) FindParents

func (c *ModelCache) FindParents(kind string, id uint) []CommonResourceIface

func (*ModelCache) FindResource

func (c *ModelCache) FindResource(kind string, id uint) CommonResourceIface

func (*ModelCache) FlushUserAuthority

func (c *ModelCache) FlushUserAuthority(user models.CommonUserIface) *UserAuthority

func (*ModelCache) GetUserAuthority

func (c *ModelCache) GetUserAuthority(user models.CommonUserIface) *UserAuthority

func (*ModelCache) UpsertEnvironment

func (t *ModelCache) UpsertEnvironment(pid, eid uint, name, cluster, namespace string) error

func (*ModelCache) UpsertProject

func (t *ModelCache) UpsertProject(tid, pid uint, name string) error

func (*ModelCache) UpsertTenant

func (t *ModelCache) UpsertTenant(tid uint, name string) error

func (*ModelCache) UpsertVirtualSpace

func (t *ModelCache) UpsertVirtualSpace(vid uint, name string) error

type UserAuthority

type UserAuthority struct {
	SystemRole    string          `json:"systemRole"`
	Tenants       []*UserResource `json:"tenant"`
	Projects      []*UserResource `json:"projects"`
	Environments  []*UserResource `json:"environments"`
	VirtualSpaces []*UserResource `json:"virtualSpaces"`
}

UserAuthority 用户权限

func (*UserAuthority) GetResourceRole

func (auth *UserAuthority) GetResourceRole(kind string, id uint) string

func (*UserAuthority) IsAnyTenantAdmin

func (auth *UserAuthority) IsAnyTenantAdmin() bool

func (*UserAuthority) IsEnvironmentOperator

func (auth *UserAuthority) IsEnvironmentOperator(envid uint) bool

func (*UserAuthority) IsEnvironmentReader

func (auth *UserAuthority) IsEnvironmentReader(envid uint) bool

func (*UserAuthority) IsProjectAdmin

func (auth *UserAuthority) IsProjectAdmin(projectid uint) bool

func (*UserAuthority) IsProjectDev

func (auth *UserAuthority) IsProjectDev(projectid uint) bool

func (*UserAuthority) IsProjectOps

func (auth *UserAuthority) IsProjectOps(projectid uint) bool

func (*UserAuthority) IsProjectTest

func (auth *UserAuthority) IsProjectTest(projectid uint) bool

func (*UserAuthority) IsSystemAdmin

func (auth *UserAuthority) IsSystemAdmin() bool

func (*UserAuthority) IsTenantAdmin

func (auth *UserAuthority) IsTenantAdmin(tenantid uint) bool

func (*UserAuthority) IsTenantMember

func (auth *UserAuthority) IsTenantMember(tenantid uint) bool

func (*UserAuthority) IsVirtualSpaceAdmin

func (auth *UserAuthority) IsVirtualSpaceAdmin(vsid uint) bool

func (*UserAuthority) IsVirtualSpaceMember

func (auth *UserAuthority) IsVirtualSpaceMember(vsid uint) bool

func (*UserAuthority) MarshalBinary

func (auth *UserAuthority) MarshalBinary() ([]byte, error)

func (*UserAuthority) UnmarshalBinary

func (auth *UserAuthority) UnmarshalBinary(data []byte) error

type UserResource

type UserResource struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Role    string `json:"role"`
	IsAdmin bool   `json:"isAdmin"`
}

Jump to

Keyboard shortcuts

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