redis

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidQueueName = "InvalidQueue"

	RESTOREINFO = "Restore:"
)

Variables

View Source
var DataTables = []RedisDatabase{FileTable}

Functions

func GenMutexKey

func GenMutexKey(object *types.Object) string

func GenMutexKeyForRestore

func GenMutexKeyForRestore(freezer *types.Freezer) string

func HashSum

func HashSum(ObjectName string) (string, error)

Get Object to HighWayHash for redis

func Initialize

func Initialize()

func InitializeCluster

func InitializeCluster() interface{}

func InitializeSingle

func InitializeSingle() interface{}

func RemoveLock

func RemoveLock(key string)

Types

type ClusterRedis

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

func (*ClusterRedis) Check

func (c *ClusterRedis) Check()

func (*ClusterRedis) Close

func (c *ClusterRedis) Close()

func (*ClusterRedis) Get

func (c *ClusterRedis) Get(table RedisDatabase, key string,
	unmarshal func([]byte) (interface{}, error)) (value interface{}, err error)

func (*ClusterRedis) GetBytes

func (c *ClusterRedis) GetBytes(key string, start int64, end int64) ([]byte, error)

func (*ClusterRedis) GetUsage

func (c *ClusterRedis) GetUsage(key string) (value string, err error)

func (*ClusterRedis) Invalid

func (c *ClusterRedis) Invalid(table RedisDatabase, key string) (err error)

func (*ClusterRedis) Remove

func (c *ClusterRedis) Remove(table RedisDatabase, key string) error

func (*ClusterRedis) RemoveLock

func (c *ClusterRedis) RemoveLock(key string)

func (*ClusterRedis) Set

func (c *ClusterRedis) Set(table RedisDatabase, key string, value interface{}) error

func (*ClusterRedis) SetBytes

func (c *ClusterRedis) SetBytes(key string, value []byte) (err error)

type Redis

type Redis interface {
	Close()
	Set(table RedisDatabase, key string, value interface{}) error
	Get(table RedisDatabase, key string,
		unmarshal func([]byte) (interface{}, error)) (interface{}, error)
	Remove(table RedisDatabase, key string) error
	RemoveLock(key string)

	// Get Usages
	// `start` and `end` are inclusive
	GetUsage(key string) (string, error)

	// Set file bytes
	SetBytes(key string, value []byte) (err error)

	// Get file bytes
	// `start` and `end` are inclusive
	// FIXME: this API causes an extra memory copy, need to patch radix to fix it
	GetBytes(key string, start int64, end int64) ([]byte, error)

	// Publish the invalid message to other YIG instances through Redis
	Invalid(table RedisDatabase, key string) (err error)

	Check()
}
var RedisConn Redis

type RedisDatabase

type RedisDatabase int
const (
	UserTable RedisDatabase = iota
	BucketTable
	ObjectTable
	FileTable
	ClusterTable
)

func (RedisDatabase) InvalidQueue

func (r RedisDatabase) InvalidQueue() string

func (RedisDatabase) String

func (r RedisDatabase) String() string

type SingleRedis

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

func (*SingleRedis) Check

func (s *SingleRedis) Check()

func (*SingleRedis) Close

func (s *SingleRedis) Close()

func (*SingleRedis) Get

func (s *SingleRedis) Get(table RedisDatabase, key string,
	unmarshal func([]byte) (interface{}, error)) (value interface{}, err error)

func (*SingleRedis) GetBytes

func (s *SingleRedis) GetBytes(key string, start int64, end int64) ([]byte, error)

func (*SingleRedis) GetUsage

func (s *SingleRedis) GetUsage(key string) (value string, err error)

func (*SingleRedis) Invalid

func (s *SingleRedis) Invalid(table RedisDatabase, key string) (err error)

func (*SingleRedis) Remove

func (s *SingleRedis) Remove(table RedisDatabase, key string) error

func (*SingleRedis) RemoveLock

func (s *SingleRedis) RemoveLock(key string)

func (*SingleRedis) Set

func (s *SingleRedis) Set(table RedisDatabase, key string, value interface{}) error

func (*SingleRedis) SetBytes

func (s *SingleRedis) SetBytes(key string, value []byte) (err error)

Jump to

Keyboard shortcuts

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