core

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRPushAndExpire = fmt.Errorf("RPushAndExpire failed")
)

Functions

func NewMsgBus

func NewMsgBus(client IRedisClient) xmsgbus.IMsgBus

func NewSharedStorage

func NewSharedStorage(client IRedisClient) xmsgbus.ISharedStorage

Types

type AckData

type AckData struct {
	ListKey string
	Data    string
}

type IRedisClient

type IRedisClient interface {
	SAdd(ctx context.Context, key string, members ...interface{}) error
	SMembers(ctx context.Context, key string) ([]string, error)
	SRem(ctx context.Context, key string, members ...interface{}) error

	Get(ctx context.Context, key string) ([]byte, error)

	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) (string, error)
	SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
	SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) error

	Keys(ctx context.Context, pattern string) ([]string, error)

	Del(ctx context.Context, keys ...string) error

	BLPop(ctx context.Context, timeout time.Duration, keys ...string) ([]string, error)

	RPushAndExpire(ctx context.Context, key string, value string, ttl time.Duration) error
}

type MsgBus

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

func (*MsgBus) AddChannel

func (x *MsgBus) AddChannel(ctx context.Context, topic string, channel string) error

func (*MsgBus) ListChannel

func (x *MsgBus) ListChannel(ctx context.Context, topic string) ([]string, error)

func (*MsgBus) Pop

func (x *MsgBus) Pop(ctx context.Context, topic, channel string, blockTimeout time.Duration) ([]byte, func(), error)

func (*MsgBus) Push

func (x *MsgBus) Push(ctx context.Context, topic string, bs []byte) error

func (*MsgBus) RemoveChannel

func (x *MsgBus) RemoveChannel(ctx context.Context, topic string, channel string) error

type SharedStorage

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

func (*SharedStorage) Del

func (x *SharedStorage) Del(ctx context.Context, key string) error

func (*SharedStorage) Keys

func (x *SharedStorage) Keys(ctx context.Context, prefix string) ([]string, error)

func (*SharedStorage) SetEx

func (x *SharedStorage) SetEx(ctx context.Context, key string, value interface{}, ttl time.Duration) error

Jump to

Keyboard shortcuts

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