storage

package
v0.0.0-...-1ae172a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotWatch = errors.New("watch key is not subscribed")
View Source
var ErrTimeout = errors.New("result timeout")

Functions

This section is empty.

Types

type FilterFunc

type FilterFunc func(interface{}) bool

type ListFunc

type ListFunc func() ([]interface{}, error)

type RedisStorage

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

func (*RedisStorage) Delegate

func (r *RedisStorage) Delegate(obj interface{})

func (*RedisStorage) DelegateErr

func (r *RedisStorage) DelegateErr(err error)

func (*RedisStorage) Id

func (r *RedisStorage) Id() string

func (*RedisStorage) Key

func (r *RedisStorage) Key() string

func (*RedisStorage) Notify

func (r *RedisStorage) Notify(data interface{}) error

func (*RedisStorage) NotifyResponse

func (r *RedisStorage) NotifyResponse(traceId string, resp []byte) error

func (*RedisStorage) NotifyResult

func (r *RedisStorage) NotifyResult(traceId string, timeout int, data interface{}) ([]byte, error)

func (*RedisStorage) NotifyWatch

func (r *RedisStorage) NotifyWatch(traceId string, stopCh <-chan struct{}) <-chan []byte

func (*RedisStorage) Result

func (r *RedisStorage) Result() <-chan interface{}

func (*RedisStorage) Run

func (r *RedisStorage) Run()

func (*RedisStorage) Stop

func (r *RedisStorage) Stop() error

func (*RedisStorage) WatchErr

func (r *RedisStorage) WatchErr() <-chan error

func (*RedisStorage) Watched

func (r *RedisStorage) Watched() (bool, error)

type SharedWatch

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

SharedWatch 在一个实例中共享同一个watchKey的监听

func (*SharedWatch) Stop

func (s *SharedWatch) Stop(watchKey string, delegate sharedWatchDelegate)

Stop 停止对该委托对象的监听

func (*SharedWatch) Watch

func (s *SharedWatch) Watch(client *redis.Client, watchKey string, delegate sharedWatchDelegate, dataType datatype.DataType)

Watch 对watchKey进行监听,如果已监听,则直接添加委托

type Storage

type Storage interface {
	Key() string
	Stop() error
	Run()
	Result() <-chan interface{}
	WatchErr() <-chan error
	Notify(interface{}) error
	Watched() (bool, error)
	NotifyResult(traceId string, timeout int, data interface{}) ([]byte, error)
	NotifyWatch(traceId string, stopCh <-chan struct{}) <-chan []byte
	NotifyResponse(traceId string, resp []byte) error
}

func NewRedisStorage

func NewRedisStorage(redisClient *redis.Client, watchKey string, listFunc ListFunc, filterFunc FilterFunc, resyncSec int, dataType datatype.DataType) Storage

Jump to

Keyboard shortcuts

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