storage

package
v0.0.0-...-344df76 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package storage init

Package storage xxx

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalRedisSession *RedisSession
	GlobalStorage      Storage
)

Globals

View Source
var LocalCache, _ = NewSlotCache()

LocalCache :

Functions

func InitStorage

func InitStorage()

InitStorage init storage client

Types

type RedisSession

type RedisSession struct {
	Client *redis.Client
}

RedisSession :

func GetDefaultRedisSession

func GetDefaultRedisSession() *RedisSession

GetDefaultRedisSession : get default redis session for default database

func (*RedisSession) Close

func (r *RedisSession) Close()

Close : close redis session

func (*RedisSession) Init

func (r *RedisSession) Init() error

Init : init the redis client

type SlotCache

type SlotCache struct {
	Slot              *cache.Cache
	DefaultExpiration time.Duration
}

SlotCache :

func NewSlotCache

func NewSlotCache() (*SlotCache, error)

NewSlotCache :

type Storage

type Storage interface {
	// LogRule operation
	CreateLogRule(ctx context.Context, lc *entity.LogRule) (string, error)
	UpdateLogRule(ctx context.Context, id string, lc entity.M) error
	DeleteLogRule(ctx context.Context, id string) error
	ListLogRules(ctx context.Context, cond *operator.Condition, opt *utils.ListOption) (
		int64, []*entity.LogRule, error)
	GetLogRule(ctx context.Context, id string) (*entity.LogRule, error)
	// GetIndexSetID return stdIndexSetID and fileIndexSetID
	GetIndexSetID(ctx context.Context, projectID, clusterID string) (int, int, error)
	CreateOldIndexSetID(ctx context.Context, logIndex *entity.LogIndex) error
	GetOldIndexSetID(ctx context.Context, projectID string) (*entity.LogIndex, error)
}

Storage 提供了数据库操作的接口

func New

func New(db drivers.DB) Storage

New return a new ResourceManagerModel instance

Directories

Path Synopsis
Package entity storage entity
Package entity storage entity
Package logindex log index
Package logindex log index
Package logrule log rule
Package logrule log rule

Jump to

Keyboard shortcuts

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