engine

package
v0.0.0-...-9b3b26b Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MigrateStatusPrepare = 0
	MigrateStatusProcess = 1
	MigrateStatusFinish  = 2
	MigrateStatusError   = 3
)
View Source
const (
	HeaderStartLen    = 1
	HeaderFileSizeLen = 8
	HeaderNameLen     = 2
	HeaderEndLen      = 1
)

Variables

View Source
var (
	StartHeader = byte('$')
	EndHeader   = byte('\n')
)
View Source
var MigrateLuaScript = "redis.call(KEYS)"

Functions

This section is empty.

Types

type Bitalos

type Bitalos struct {
	Meta    *dbmeta.Meta
	Migrate *Migrate
	// contains filtered or unexported fields
}

func NewBitalos

func NewBitalos(dir string) (*Bitalos, error)

func (*Bitalos) Append

func (b *Bitalos) Append(key []byte, khash uint32, value []byte) (int64, error)

func (*Bitalos) BitCount

func (b *Bitalos) BitCount(key []byte, khash uint32, start int, end int) (int64, error)

func (*Bitalos) BitPos

func (b *Bitalos) BitPos(key []byte, khash uint32, on int, start int, end int) (int64, error)

func (*Bitalos) BitalosdbUsage

func (b *Bitalos) BitalosdbUsage(bu *bitsdb.BitsUsage)

func (*Bitalos) CacheInfo

func (b *Bitalos) CacheInfo() []byte

func (*Bitalos) CheckRedirectAndLockFunc

func (b *Bitalos) CheckRedirectAndLockFunc(cmd string, key []byte, khash uint32) (bool, func())

func (*Bitalos) CheckpointPrepareEnd

func (b *Bitalos) CheckpointPrepareEnd()

func (*Bitalos) CheckpointPrepareStart

func (b *Bitalos) CheckpointPrepareStart()

func (*Bitalos) CleanSnapshot

func (b *Bitalos) CleanSnapshot()

func (*Bitalos) Close

func (b *Bitalos) Close()

func (*Bitalos) Compact

func (b *Bitalos) Compact()

func (*Bitalos) DebugInfo

func (b *Bitalos) DebugInfo() []byte

func (*Bitalos) Decr

func (b *Bitalos) Decr(key []byte, khash uint32) (int64, error)

func (*Bitalos) DecrBy

func (b *Bitalos) DecrBy(key []byte, khash uint32, decrement int64) (int64, error)

func (*Bitalos) Del

func (b *Bitalos) Del(khash uint32, keys ...[]byte) (int64, error)

func (*Bitalos) DoSnapshot

func (b *Bitalos) DoSnapshot(snapshotPath string) (interface{}, error)

func (*Bitalos) Exists

func (b *Bitalos) Exists(key []byte, khash uint32) (int64, error)

func (*Bitalos) ExistsLuaScript

func (b *Bitalos) ExistsLuaScript(key []byte) (int64, error)

func (*Bitalos) Expire

func (b *Bitalos) Expire(key []byte, khash uint32, duration int64) (int64, error)

func (*Bitalos) ExpireAt

func (b *Bitalos) ExpireAt(key []byte, khash uint32, when int64) (int64, error)

func (*Bitalos) Flush

func (b *Bitalos) Flush(reason btools.FlushType, compactIndex uint64)

func (*Bitalos) FlushAllDB

func (b *Bitalos) FlushAllDB()

func (*Bitalos) FlushLuaScript

func (b *Bitalos) FlushLuaScript() error

func (*Bitalos) Get

func (b *Bitalos) Get(key []byte, khash uint32) ([]byte, func(), error)

func (*Bitalos) GetBit

func (b *Bitalos) GetBit(key []byte, khash uint32, offset int) (int64, error)

func (*Bitalos) GetIsDelExpire

func (b *Bitalos) GetIsDelExpire() int

func (*Bitalos) GetLuaScript

func (b *Bitalos) GetLuaScript(key []byte) ([]byte, func())

func (*Bitalos) GetRange

func (b *Bitalos) GetRange(key []byte, khash uint32, start int, end int) ([]byte, func(), error)

func (*Bitalos) GetSet

func (b *Bitalos) GetSet(key []byte, khash uint32, value []byte) ([]byte, func(), error)

func (*Bitalos) HClear

func (b *Bitalos) HClear(khash uint32, key ...[]byte) (int64, error)

func (*Bitalos) HDel

func (b *Bitalos) HDel(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) HGet

func (b *Bitalos) HGet(key []byte, khash uint32, field []byte) ([]byte, func(), error)

func (*Bitalos) HGetAll

func (b *Bitalos) HGetAll(key []byte, khash uint32) ([]btools.FVPair, []func(), error)

func (*Bitalos) HIncrBy

func (b *Bitalos) HIncrBy(key []byte, khash uint32, field []byte, delta int64) (int64, error)

func (*Bitalos) HKeys

func (b *Bitalos) HKeys(key []byte, khash uint32) ([][]byte, []func(), error)

func (*Bitalos) HLen

func (b *Bitalos) HLen(key []byte, khash uint32) (int64, error)

func (*Bitalos) HMget

func (b *Bitalos) HMget(key []byte, khash uint32, args ...[]byte) ([][]byte, []func(), error)

func (*Bitalos) HMset

func (b *Bitalos) HMset(key []byte, khash uint32, args ...btools.FVPair) error

func (*Bitalos) HScan

func (b *Bitalos) HScan(key []byte, khash uint32, cursor []byte, count int, match string) ([]byte, []btools.FVPair, error)

func (*Bitalos) HSet

func (b *Bitalos) HSet(key []byte, khash uint32, field []byte, value []byte) (int64, error)

func (*Bitalos) HValues

func (b *Bitalos) HValues(key []byte, khash uint32) ([][]byte, []func(), error)

func (*Bitalos) Incr

func (b *Bitalos) Incr(key []byte, khash uint32) (int64, error)

func (*Bitalos) IncrBy

func (b *Bitalos) IncrBy(key []byte, khash uint32, increment int64) (int64, error)

func (*Bitalos) IncrByFloat

func (b *Bitalos) IncrByFloat(key []byte, khash uint32, increment float64) (float64, error)

func (*Bitalos) IsBitsdbClosed

func (b *Bitalos) IsBitsdbClosed() bool

func (*Bitalos) IsOpenRaftRestore

func (b *Bitalos) IsOpenRaftRestore() bool

func (*Bitalos) LClear

func (b *Bitalos) LClear(khash uint32, key ...[]byte) (int64, error)

func (*Bitalos) LIndex

func (b *Bitalos) LIndex(key []byte, khash uint32, index int64) ([]byte, func(), error)

func (*Bitalos) LInsert

func (b *Bitalos) LInsert(key []byte, khash uint32, isbefore bool, pivot, value []byte) (int64, error)

func (*Bitalos) LLen

func (b *Bitalos) LLen(key []byte, khash uint32) (int64, error)

func (*Bitalos) LPop

func (b *Bitalos) LPop(key []byte, khash uint32) ([]byte, func(), error)

func (*Bitalos) LPush

func (b *Bitalos) LPush(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) LPushX

func (b *Bitalos) LPushX(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) LRange

func (b *Bitalos) LRange(key []byte, khash uint32, start int64, stop int64) ([][]byte, error)

func (*Bitalos) LRem

func (b *Bitalos) LRem(key []byte, khash uint32, count int64, value []byte) (int64, error)

func (*Bitalos) LSet

func (b *Bitalos) LSet(key []byte, khash uint32, index int64, value []byte) error

func (*Bitalos) LTrim

func (b *Bitalos) LTrim(key []byte, khash uint32, start, stop int64) error

func (*Bitalos) LTrimBack

func (b *Bitalos) LTrimBack(key []byte, khash uint32, trimSize int64) (int64, error)

func (*Bitalos) LTrimFront

func (b *Bitalos) LTrimFront(key []byte, khash uint32, trimSize int64) (int64, error)

func (*Bitalos) LuaScriptLen

func (b *Bitalos) LuaScriptLen() int64

func (*Bitalos) MGet

func (b *Bitalos) MGet(khash uint32, keys ...[]byte) ([][]byte, []func(), error)

func (*Bitalos) MSet

func (b *Bitalos) MSet(khash uint32, args ...btools.KVPair) error

func (*Bitalos) MigrateOver

func (b *Bitalos) MigrateOver(slotId uint64) error

func (*Bitalos) MigrateStart

func (b *Bitalos) MigrateStart(
	from string, host string, slot uint32, isMaster func() bool, migrateDelToSlave func(uint32, [][]byte) error,
) (*Migrate, error)

func (*Bitalos) NewMigrate

func (b *Bitalos) NewMigrate(slot uint32, tohost string, fromhost string) *Migrate

func (*Bitalos) PExpire

func (b *Bitalos) PExpire(key []byte, khash uint32, duration int64) (int64, error)

func (*Bitalos) PExpireAt

func (b *Bitalos) PExpireAt(key []byte, khash uint32, when int64) (int64, error)

func (*Bitalos) PSetEX

func (b *Bitalos) PSetEX(key []byte, khash uint32, duration int64, value []byte) error

func (*Bitalos) PSetNXEX

func (b *Bitalos) PSetNXEX(key []byte, khash uint32, duration int64, value []byte) (int64, error)

func (*Bitalos) PTTl

func (b *Bitalos) PTTl(key []byte, khash uint32) (int64, error)

func (*Bitalos) Persist

func (b *Bitalos) Persist(key []byte, khash uint32) (int64, error)

func (*Bitalos) RPop

func (b *Bitalos) RPop(key []byte, khash uint32) ([]byte, func(), error)

func (*Bitalos) RPush

func (b *Bitalos) RPush(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) RPushX

func (b *Bitalos) RPushX(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) RaftReset

func (b *Bitalos) RaftReset()

func (*Bitalos) RecoverFromSnapshot

func (b *Bitalos) RecoverFromSnapshot(r io.Reader, done <-chan struct{}) (string, error)

func (*Bitalos) Redirect

func (b *Bitalos) Redirect(cmd string, key []byte, reqData [][]byte, rw *resp.Writer) error

func (*Bitalos) SAdd

func (b *Bitalos) SAdd(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) SCard

func (b *Bitalos) SCard(key []byte, khash uint32) (int64, error)

func (*Bitalos) SClear

func (b *Bitalos) SClear(khash uint32, key ...[]byte) (int64, error)

func (*Bitalos) SIsMember

func (b *Bitalos) SIsMember(key []byte, khash uint32, member []byte) (int64, error)

func (*Bitalos) SMembers

func (b *Bitalos) SMembers(key []byte, khash uint32) ([][]byte, error)

func (*Bitalos) SPop

func (b *Bitalos) SPop(key []byte, khash uint32, count int64) ([][]byte, error)

func (*Bitalos) SRandMember

func (b *Bitalos) SRandMember(key []byte, khash uint32, count int64) ([][]byte, error)

func (*Bitalos) SRem

func (b *Bitalos) SRem(key []byte, khash uint32, args ...[]byte) (int64, error)

func (*Bitalos) SScan

func (b *Bitalos) SScan(key []byte, khash uint32, cursor []byte, count int, match string) ([]byte, [][]byte, error)

func (*Bitalos) SaveSnapshot

func (b *Bitalos) SaveSnapshot(ctx interface{}, w io.Writer, done <-chan struct{}) error

func (*Bitalos) Scan

func (b *Bitalos) Scan(cursor []byte, count int, match string, dt btools.DataType) ([]byte, [][]byte, error)

func (*Bitalos) ScanDelExpire

func (b *Bitalos) ScanDelExpire(jobId uint64)

func (*Bitalos) ScanDelExpireAsync

func (b *Bitalos) ScanDelExpireAsync()

func (*Bitalos) Set

func (b *Bitalos) Set(key []byte, khash uint32, value []byte) error

func (*Bitalos) SetAutoCompact

func (b *Bitalos) SetAutoCompact(val bool)

func (*Bitalos) SetBit

func (b *Bitalos) SetBit(key []byte, khash uint32, offset int, on int) (int64, error)

func (*Bitalos) SetEX

func (b *Bitalos) SetEX(key []byte, khash uint32, duration int64, value []byte) error

func (*Bitalos) SetLuaScript

func (b *Bitalos) SetLuaScript(key []byte, script []byte) error

func (*Bitalos) SetNX

func (b *Bitalos) SetNX(key []byte, khash uint32, value []byte) (int64, error)

func (*Bitalos) SetNXEX

func (b *Bitalos) SetNXEX(key []byte, khash uint32, duration int64, value []byte) (int64, error)

func (*Bitalos) SetQPS

func (b *Bitalos) SetQPS(qps uint64)

func (*Bitalos) SetRange

func (b *Bitalos) SetRange(key []byte, khash uint32, offset int, value []byte) (int64, error)

func (*Bitalos) StrLen

func (b *Bitalos) StrLen(key []byte, khash uint32) (int64, error)

func (*Bitalos) TTl

func (b *Bitalos) TTl(key []byte, khash uint32) (int64, error)

func (*Bitalos) Type

func (b *Bitalos) Type(key []byte, khash uint32) (string, error)

func (*Bitalos) ZAdd

func (b *Bitalos) ZAdd(
	key []byte, khash uint32, args ...btools.ScorePair,
) (int64, error)

func (*Bitalos) ZCard

func (b *Bitalos) ZCard(key []byte, khash uint32) (int64, error)

func (*Bitalos) ZClear

func (b *Bitalos) ZClear(khash uint32, key ...[]byte) (int64, error)

func (*Bitalos) ZCount

func (b *Bitalos) ZCount(
	key []byte, khash uint32,
	min float64, max float64,
	leftClose bool, rightClose bool,
) (int64, error)

func (*Bitalos) ZIncrBy

func (b *Bitalos) ZIncrBy(
	key []byte, khash uint32, delta float64, member []byte,
) (float64, error)

func (*Bitalos) ZLexCount

func (b *Bitalos) ZLexCount(
	key []byte, khash uint32,
	min []byte, max []byte,
	leftClose bool, rightClose bool,
) (int64, error)

func (*Bitalos) ZRangeByLex

func (b *Bitalos) ZRangeByLex(
	key []byte, khash uint32,
	min []byte, max []byte,
	leftClose bool, rightClose bool,
	offset int, count int,
) ([][]byte, error)

func (*Bitalos) ZRangeByScoreGeneric

func (b *Bitalos) ZRangeByScoreGeneric(
	key []byte, khash uint32,
	min float64, max float64,
	leftClose bool, rightClose bool,
	offset int, count int, reverse bool,
) ([]btools.ScorePair, error)

func (*Bitalos) ZRangeGeneric

func (b *Bitalos) ZRangeGeneric(
	key []byte, khash uint32, start int64, stop int64, reverse bool,
) ([]btools.ScorePair, error)

func (*Bitalos) ZRank

func (b *Bitalos) ZRank(key []byte, khash uint32, member []byte) (int64, error)

func (*Bitalos) ZRem

func (b *Bitalos) ZRem(
	key []byte, khash uint32, members ...[]byte,
) (int64, error)

func (*Bitalos) ZRemRangeByLex

func (b *Bitalos) ZRemRangeByLex(
	key []byte, khash uint32,
	min []byte, max []byte,
	leftClose bool, rightClose bool,
) (int64, error)

func (*Bitalos) ZRemRangeByRank

func (b *Bitalos) ZRemRangeByRank(
	key []byte, khash uint32, start int64, stop int64,
) (int64, error)

func (*Bitalos) ZRemRangeByScore

func (b *Bitalos) ZRemRangeByScore(
	key []byte, khash uint32,
	min float64, max float64,
	leftClose bool, rightClose bool,
) (int64, error)

func (*Bitalos) ZRevRank

func (b *Bitalos) ZRevRank(key []byte, khash uint32, member []byte) (int64, error)

func (*Bitalos) ZScan

func (b *Bitalos) ZScan(key []byte, khash uint32, cursor []byte, count int, match string) ([]byte, []btools.ScorePair, error)

func (*Bitalos) ZScore

func (b *Bitalos) ZScore(key []byte, khash uint32, member []byte) (float64, error)

type KeyLockerPool

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

func NewKeyLockerPool

func NewKeyLockerPool() *KeyLockerPool

func (*KeyLockerPool) LockKey

func (lp *KeyLockerPool) LockKey(khash uint32, cmd string) func()

type Locker

type Locker struct {
	sync.RWMutex
}

func (*Locker) DoLock

func (c *Locker) DoLock(cmd string) func()

type Migrate

type Migrate struct {
	Conn      *redis.Pool
	IsMigrate atomic.Int32 `json:"is_migrate"`
	// contains filtered or unexported fields
}

func (*Migrate) Info

func (m *Migrate) Info() string

type SnapshotDetail

type SnapshotDetail struct {
	SnapshotPath string
	UpdateIndex  uint64
}

func (SnapshotDetail) Clean

func (detail SnapshotDetail) Clean()

type SnapshotFile

type SnapshotFile struct {
	Size int64
	Name string
}

Jump to

Keyboard shortcuts

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