util

package
v0.0.0-...-2aa8555 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	R = Op("r")
	W = Op("w")
)

Valid redic.Op

View Source
const (
	SysPrefix        = "bifrost"
	DefaultDelimiter = ":"
)

Variables

View Source
var (
	ERR_NOT_NECESSARY = errors.New("clean action is not necessary")
	NO_SERVER_START   = "queue has not started"
)

Functions

func DecodeInt64

func DecodeInt64(d []byte) int64

DecodeFloat64 decode the float64 object from binary

func EncodeInt64

func EncodeInt64(vi int64) []byte

EncodeInt64 encode the int64 object to binary

Types

type CheckFunc

type CheckFunc func() (bool, error)

type Op

type Op string

Op is the operation type of redis, can be W(write) or R(read)

type Queue

type Queue interface {
	// DedupEnqueue(clientid string, messageID uint16, topic string, message *pbMessage.Message) (uint64, error)
	// DedupRelease(clientid string, messageID uint16) error
	// Clear(clientid string) error
	Enqueue(key string, message *pbMessage.Message) ([]byte, error)
	GetN(key string, index []byte, count int64) ([]byte, []*pbMessage.Message, error)
	Index(key string) ([]byte, error)
	Delete(key string) error
	Close() error
	WatchDelete(key string, test CheckFunc) error
}

func NewQueue

func NewQueue(config *conf.Queue) (Queue, error)

type Redic

type Redic interface {
	Get(op Op, key string) redis.Conn
	LoadScripts(scripts ...*redis.Script) error
	Close() error
}

Redic is a master + slave redis cluster

func New

func New(c *conf.Redis) Redic

New a Redis cluster

Jump to

Keyboard shortcuts

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