load

package
v0.0.0-...-4f9d474 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSecretNotFound = errors.New("secret not found") // secret 未找到
	ErrPolicyNotFound = errors.New("policy not found") // policy 未找到
)

Functions

This section is empty.

Types

type Cache

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

Cache 用于存储 secrets 和 policies.

func GetCacheInstance

func GetCacheInstance(s store.IStore) (*Cache, error)

GetCacheInstance 基于指定 store 实例获取 Cache 实例.

func (*Cache) GetPolicy

func (c *Cache) GetPolicy(key string) ([]*ladon.DefaultPolicy, error)

GetPolicy 获取指定用户的 ladon policy 详情.

func (*Cache) GetSecret

func (c *Cache) GetSecret(key string) (*pb.SecretInfo, error)

GetSecret 获取指定用户对应的 secret 详情.

func (*Cache) Reload

func (c *Cache) Reload() error

Reload 实现 Loader 接口的重载方法,用于重载 secrets 和 policies.

type Load

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

Load 用于重载 secrets 和 policies.

func NewLoader

func NewLoader(ctx context.Context, loader Loader) *Load

NewLoader 创建一个 Load.

func (*Load) DoReload

func (l *Load) DoReload()

DoReload 进行 secrets 和 policies 同步.

func (*Load) Start

func (l *Load) Start()

Start 启动 Load 服务.

type Loader

type Loader interface {
	Reload() error
}

Loader 定义了重载 secrets 和 policies 的方法.

type Notification

type Notification struct {
	Command       NotificationCommand `json:"command"`
	Payload       string              `json:"payload"`
	Signature     string              `json:"signature"`
	SignatureAlgo crypto.Hash         `json:"algorithm"`
}

Notification 是一个用于发布和订阅消息编码类型.

func (*Notification) Sign

func (n *Notification) Sign()

Sign 使用 SHA256 算法进行签名.

type NotificationCommand

type NotificationCommand string

NotificationCommand 定义一个新的通知类型.

const (
	RedisPubSubChannel                      = "skt.notifications"
	NoticePolicyChanged NotificationCommand = "PolicyChanged"
	NoticeSecretChanged NotificationCommand = "SecretChanged"
)

定义 Redis 订阅相关键和事件.

Jump to

Keyboard shortcuts

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