forked from p93542168/wheat-cache
commit
981a3341ef
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,13 @@
|
|||
### 事件驱动 2.0
|
||||
|
||||
### event 1.0 存在的问题
|
||||
事件驱动 1.0 在 相互关联访问时,会发生 死锁问题, 导致一个事件执行周期失败
|
||||
|
||||
### event 2.0 新特性
|
||||
- 异步事件支持
|
||||
- 挂起操作
|
||||
|
||||
|
||||
### event 2.0 设计图
|
||||
![](../../_icon/event.svg)
|
||||
|
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
_ "gitee.com/wheat-os/wheatCache/conf"
|
||||
wheatCodec "gitee.com/wheat-os/wheatCache/gateway/codec"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/endpoint"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/proxy"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/transport"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/logx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/util/server"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -56,13 +56,13 @@ func GetGatewayServer() *grpc.Server {
|
|||
logx.Debug("service target in %v", targets)
|
||||
|
||||
stream := proxy.GetDirectorByServiceHash()
|
||||
transport := transport.NewHashTransport(transport.HashReplicasDefault, nil, targets...)
|
||||
endpoint := endpoint.NewHashEndpoint(endpoint.HashReplicasDefault, nil, targets...)
|
||||
|
||||
opts := make([]grpc.ServerOption, 0)
|
||||
opts = append(
|
||||
opts,
|
||||
grpc.ForceServerCodec(wheatCodec.Codec()),
|
||||
grpc.UnknownServiceHandler(proxy.TransparentHandler(stream, transport)),
|
||||
grpc.UnknownServiceHandler(proxy.TransparentHandler(stream, endpoint)),
|
||||
)
|
||||
|
||||
return grpc.NewServer(opts...)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package transport
|
||||
package endpoint
|
||||
|
||||
type TransPortInterface interface {
|
||||
type EndpointInterface interface {
|
||||
GetTargetAddr(...string) (string, error)
|
||||
IsEmpty() bool
|
||||
AddTarget(targets ...string)
|
|
@ -1,4 +1,4 @@
|
|||
package transport
|
||||
package endpoint
|
||||
|
||||
import (
|
||||
"hash/crc32"
|
||||
|
@ -25,34 +25,34 @@ func (s UInt32Slice) Swap(i, j int) {
|
|||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
|
||||
type HashTransport struct {
|
||||
type HashEndpoint struct {
|
||||
hash HashFunc
|
||||
replicas int // 复制因子
|
||||
keys UInt32Slice
|
||||
hashMap map[uint32]string // taraget 隐射
|
||||
}
|
||||
|
||||
func NewHashTransport(replicas int, fn HashFunc, target ...string) TransPortInterface {
|
||||
transport := &HashTransport{
|
||||
func NewHashEndpoint(replicas int, fn HashFunc, target ...string) EndpointInterface {
|
||||
endpoint := &HashEndpoint{
|
||||
replicas: replicas,
|
||||
hash: fn,
|
||||
hashMap: make(map[uint32]string, len(target)),
|
||||
}
|
||||
|
||||
if transport.hash == nil {
|
||||
transport.hash = crc32.ChecksumIEEE // 默认使用 CRC32 算法
|
||||
if endpoint.hash == nil {
|
||||
endpoint.hash = crc32.ChecksumIEEE // 默认使用 CRC32 算法
|
||||
}
|
||||
|
||||
transport.AddTarget(target...)
|
||||
endpoint.AddTarget(target...)
|
||||
|
||||
return transport
|
||||
return endpoint
|
||||
}
|
||||
|
||||
func (h *HashTransport) IsEmpty() bool {
|
||||
func (h *HashEndpoint) IsEmpty() bool {
|
||||
return len(h.keys) == 0
|
||||
}
|
||||
|
||||
func (h *HashTransport) AddTarget(targets ...string) {
|
||||
func (h *HashEndpoint) AddTarget(targets ...string) {
|
||||
for _, tar := range targets {
|
||||
|
||||
for i := 0; i < h.replicas; i++ {
|
||||
|
@ -66,7 +66,7 @@ func (h *HashTransport) AddTarget(targets ...string) {
|
|||
sort.Sort(h.keys)
|
||||
}
|
||||
|
||||
func (h *HashTransport) GetTargetAddr(str ...string) (string, error) {
|
||||
func (h *HashEndpoint) GetTargetAddr(str ...string) (string, error) {
|
||||
if h.IsEmpty() {
|
||||
return "", errorx.New("gateway not register transport")
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package transport
|
||||
package endpoint
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
func TestHashTransport_GetTargetAddr(t *testing.T) {
|
||||
tran := NewHashTransport(3, nil, "127.0.0.1:5581", "127.0.0.1:5582", "127.0.0.1:5583")
|
||||
tran := NewHashEndpoint(3, nil, "127.0.0.1:5581", "127.0.0.1:5582", "127.0.0.1:5583")
|
||||
|
||||
key := "test"
|
||||
|
|
@ -3,11 +3,11 @@ package proxy
|
|||
import (
|
||||
"context"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/gateway/transport"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/endpoint"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type StreamDirector func(ctx context.Context, fullMethodName string, transport transport.TransPortInterface) (context.Context, *grpc.ClientConn, error)
|
||||
type StreamDirector func(ctx context.Context, fullMethodName string, endpoint endpoint.EndpointInterface) (context.Context, *grpc.ClientConn, error)
|
||||
|
||||
var (
|
||||
clientStreamDescForProxying = &grpc.StreamDesc{
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/gateway/codec"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/transport"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/endpoint"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func GetDirectorByServiceHash() StreamDirector {
|
||||
return func(ctx context.Context, fullMethodName string, transport transport.TransPortInterface) (context.Context, *grpc.ClientConn, error) {
|
||||
return func(ctx context.Context, fullMethodName string, endpoint endpoint.EndpointInterface) (context.Context, *grpc.ClientConn, error) {
|
||||
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok {
|
||||
|
@ -26,7 +26,7 @@ func GetDirectorByServiceHash() StreamDirector {
|
|||
"grpc header is not found %s, please check the client interceptor", proto.BaseKeyMethodKey)
|
||||
}
|
||||
|
||||
target, err := transport.GetTargetAddr(baseKey...)
|
||||
target, err := endpoint.GetTargetAddr(baseKey...)
|
||||
if err != nil {
|
||||
return nil, nil, status.Errorf(codes.Unknown, "get transport err, err:%v", err)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"io"
|
||||
|
||||
wheatCodec "gitee.com/wheat-os/wheatCache/gateway/codec"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/transport"
|
||||
"gitee.com/wheat-os/wheatCache/gateway/endpoint"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
@ -16,17 +16,17 @@ import (
|
|||
// backends. It should be used as a `grpc.UnknownServiceHandler`.
|
||||
//
|
||||
// This can *only* be used if the `server` also uses grpcproxy.CodecForServer() ServerOption.
|
||||
func TransparentHandler(director StreamDirector, tranport transport.TransPortInterface) grpc.StreamHandler {
|
||||
func TransparentHandler(director StreamDirector, endpoint endpoint.EndpointInterface) grpc.StreamHandler {
|
||||
streamer := &handler{
|
||||
director,
|
||||
tranport,
|
||||
endpoint,
|
||||
}
|
||||
return streamer.handler
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
director StreamDirector
|
||||
transport transport.TransPortInterface
|
||||
endpoint endpoint.EndpointInterface
|
||||
}
|
||||
|
||||
// handler is where the real magic of proxying happens.
|
||||
|
@ -38,7 +38,7 @@ func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error
|
|||
return status.Errorf(codes.Internal, "lowLevelServerStream not exists in context")
|
||||
}
|
||||
|
||||
outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName, s.transport)
|
||||
outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName, s.endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package errorx
|
||||
|
||||
func EventRecoveryErr() error {
|
||||
return New("this event has been recycled")
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package event2
|
||||
|
||||
import "context"
|
||||
|
||||
type Consumer struct {
|
||||
driver DriverInterface
|
||||
}
|
||||
|
||||
func (c *Consumer) Receive(ctx context.Context) *event {
|
||||
return c.driver.Get()
|
||||
}
|
||||
|
||||
func (c *Consumer) NewEvent(name string) *event {
|
||||
return c.driver.NewEvent(name)
|
||||
}
|
||||
|
||||
func NewConsumer(driver DriverInterface) ConsumerInterface {
|
||||
return &Consumer{
|
||||
driver: driver,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package event2
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const (
|
||||
initEventState = int32(iota) // 初始化状态
|
||||
waitEventState // 等待状态
|
||||
workEventState // 工作状态
|
||||
closeEventState // 事件关闭状态
|
||||
recoveryEventState // 事件回收状态
|
||||
)
|
||||
|
||||
const (
|
||||
awaitThread = 3
|
||||
)
|
||||
|
||||
const (
|
||||
WorkFuncEventKey = "workFunc"
|
||||
)
|
||||
|
||||
// 线程安全
|
||||
type EventWorkFunc func() (interface{}, error)
|
||||
|
||||
// 挂起事件, 线程不安全
|
||||
type EventAwaitFunc func() (interface{}, error)
|
||||
|
||||
// 实际操作
|
||||
type awaitFunc func() (*event, interface{}, error)
|
||||
|
||||
type DriverInterface interface {
|
||||
Get() *event
|
||||
Put(*event)
|
||||
GetLength() int
|
||||
NewEvent(string) *event
|
||||
|
||||
await(awaitFunc)
|
||||
recovery(e *event)
|
||||
}
|
||||
|
||||
type ProduceInterface interface {
|
||||
Call(context.Context, *event)
|
||||
NewEvent(string) *event
|
||||
}
|
||||
|
||||
type ConsumerInterface interface {
|
||||
Receive(ctx context.Context) *event
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
package event2
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/errorx"
|
||||
)
|
||||
|
||||
type event struct {
|
||||
msgCtx map[string]interface{}
|
||||
eventName string
|
||||
msg map[string]string // 消息
|
||||
waitResult chan interface{} // 等待返回
|
||||
err error
|
||||
eventStatus int32
|
||||
ttlManage *time.Timer
|
||||
parentDriver DriverInterface
|
||||
}
|
||||
|
||||
func (e *event) reset() {
|
||||
if e.ttlManage != nil {
|
||||
e.ttlManage.Stop()
|
||||
|
||||
if len(e.ttlManage.C) > 0 {
|
||||
<-e.ttlManage.C
|
||||
}
|
||||
}
|
||||
|
||||
e.err = nil
|
||||
|
||||
// 清空结果
|
||||
if len(e.waitResult) != 0 {
|
||||
<-e.waitResult
|
||||
}
|
||||
}
|
||||
|
||||
func (e *event) Recovery() {
|
||||
e.parentDriver.recovery(e)
|
||||
}
|
||||
|
||||
func (e *event) SetMsg(key string, val string) {
|
||||
if e.msg == nil {
|
||||
e.msg = make(map[string]string)
|
||||
}
|
||||
e.msg[key] = val
|
||||
}
|
||||
|
||||
func (e *event) GetMsg(key string) string {
|
||||
if e.msg == nil {
|
||||
return ""
|
||||
}
|
||||
return e.msg[key]
|
||||
}
|
||||
|
||||
func (e *event) GetEventName() string {
|
||||
return e.eventName
|
||||
}
|
||||
|
||||
// SetValue 写入 ctx 传递用参数
|
||||
func (e *event) SetValue(key string, value interface{}) {
|
||||
if e.msgCtx == nil {
|
||||
e.msgCtx = make(map[string]interface{})
|
||||
}
|
||||
e.msgCtx[key] = value
|
||||
}
|
||||
|
||||
func (e *event) GetValue(key string) (interface{}, bool) {
|
||||
if e.msgCtx == nil {
|
||||
return nil, false
|
||||
}
|
||||
val, ok := e.msgCtx[key]
|
||||
return val, ok
|
||||
}
|
||||
|
||||
func (e *event) InitWaitEvent() {
|
||||
e.reset()
|
||||
if e.waitResult == nil {
|
||||
e.waitResult = make(chan interface{})
|
||||
}
|
||||
|
||||
atomic.SwapInt32(&e.eventStatus, waitEventState)
|
||||
}
|
||||
|
||||
func (e *event) SetResultErr(err error) {
|
||||
if !atomic.CompareAndSwapInt32(&e.eventStatus, waitEventState, workEventState) {
|
||||
return
|
||||
}
|
||||
|
||||
e.err = err
|
||||
e.waitResult <- nil
|
||||
}
|
||||
|
||||
// StartWaitEvent 开始一个等待任务
|
||||
func (e *event) StartWaitEvent(ttl time.Duration) (interface{}, error) {
|
||||
if e.ttlManage == nil {
|
||||
e.ttlManage = time.NewTimer(ttl)
|
||||
} else {
|
||||
e.ttlManage.Reset(ttl)
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-e.ttlManage.C:
|
||||
if atomic.CompareAndSwapInt32(&e.eventStatus, waitEventState, closeEventState) {
|
||||
return nil, errorx.TimeOutErr()
|
||||
}
|
||||
continue
|
||||
|
||||
case result := <-e.waitResult:
|
||||
atomic.SwapInt32(&e.eventStatus, closeEventState)
|
||||
return result, e.err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 实际执行推送
|
||||
func (e *event) execWorker(res interface{}, err error) {
|
||||
switch work := res.(type) {
|
||||
case EventAwaitFunc:
|
||||
await := func() (*event, interface{}, error) {
|
||||
result, err := work()
|
||||
return e, result, err
|
||||
}
|
||||
e.parentDriver.await(await)
|
||||
|
||||
case EventWorkFunc:
|
||||
e.InitWaitEvent()
|
||||
e.SetValue(WorkFuncEventKey, work)
|
||||
e.parentDriver.Put(e)
|
||||
|
||||
default:
|
||||
e.err = err
|
||||
e.waitResult <- res
|
||||
}
|
||||
}
|
||||
|
||||
func (e *event) ExecWorkAndSendResult(work EventWorkFunc) (interface{}, error) {
|
||||
if !atomic.CompareAndSwapInt32(&e.eventStatus, waitEventState, workEventState) {
|
||||
return nil, errorx.New("not wait status, exec err")
|
||||
}
|
||||
|
||||
res, err := work()
|
||||
e.execWorker(res, err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
type driver struct {
|
||||
waitQueue chan awaitFunc
|
||||
eventQueue chan *event
|
||||
levelQueue chan *event
|
||||
|
||||
// event 池的实现
|
||||
poll chan *event
|
||||
maxPoolSize int32
|
||||
nowPoolSize int32
|
||||
}
|
||||
|
||||
func NewDriver(maxSize int) DriverInterface {
|
||||
d := &driver{
|
||||
// pool
|
||||
maxPoolSize: int32(maxSize),
|
||||
nowPoolSize: 0,
|
||||
poll: make(chan *event, maxSize),
|
||||
|
||||
// waitQueue 1/3 的挂起指标
|
||||
waitQueue: make(chan awaitFunc, maxSize/3),
|
||||
levelQueue: make(chan *event, maxSize/3),
|
||||
eventQueue: make(chan *event, maxSize),
|
||||
}
|
||||
d.awaitWorker()
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *driver) NewEvent(name string) *event {
|
||||
|
||||
issSize := atomic.LoadInt32(&d.nowPoolSize)
|
||||
if issSize < d.maxPoolSize {
|
||||
atomic.AddInt32(&d.nowPoolSize, 1)
|
||||
return d.newEvent(name)
|
||||
}
|
||||
e := <-d.poll
|
||||
e.eventName = name
|
||||
return e
|
||||
}
|
||||
|
||||
func (d *driver) newEvent(name string) *event {
|
||||
status := initEventState
|
||||
return &event{
|
||||
eventStatus: status,
|
||||
parentDriver: d,
|
||||
eventName: name,
|
||||
}
|
||||
}
|
||||
|
||||
// 先尝试 level
|
||||
func (d *driver) Get() *event {
|
||||
if len(d.levelQueue) > 0 {
|
||||
return <-d.levelQueue
|
||||
}
|
||||
return <-d.eventQueue
|
||||
}
|
||||
|
||||
func (d *driver) Put(e *event) {
|
||||
d.eventQueue <- e
|
||||
}
|
||||
|
||||
func (d *driver) GetLength() int {
|
||||
return len(d.eventQueue) + len(d.levelQueue)
|
||||
}
|
||||
|
||||
func (d *driver) recovery(e *event) {
|
||||
atomic.SwapInt32(&e.eventStatus, recoveryEventState)
|
||||
e.reset()
|
||||
d.poll <- e
|
||||
}
|
||||
|
||||
// 挂起操作相关
|
||||
func (d *driver) await(a awaitFunc) {
|
||||
d.waitQueue <- a
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
package event2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const testEvent = "1001"
|
||||
const waitTestEvent = "1002"
|
||||
|
||||
// 简单的 单向 event 使用
|
||||
func Test_EventDriver(t *testing.T) {
|
||||
driver := NewDriver(2000)
|
||||
produce := NewProduce(driver)
|
||||
consumer := NewConsumer(driver)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
wait := sync.WaitGroup{}
|
||||
wait.Add(30000)
|
||||
|
||||
go func() {
|
||||
for i := 0; i < 30000; i++ {
|
||||
event := produce.NewEvent(testEvent)
|
||||
event.SetMsg("k", strconv.Itoa(i))
|
||||
produce.Call(ctx, event)
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for {
|
||||
event := consumer.Receive(ctx)
|
||||
fmt.Println(event.GetMsg("k"))
|
||||
event.Recovery()
|
||||
wait.Done()
|
||||
}
|
||||
}()
|
||||
|
||||
wait.Wait()
|
||||
|
||||
}
|
||||
|
||||
// 双向 event
|
||||
func Test_EventDriver_Tow_way(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
driver := NewDriver(2000)
|
||||
produce := NewProduce(driver)
|
||||
consumer := NewConsumer(driver)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
event := consumer.Receive(ctx)
|
||||
work, ok := event.GetValue(WorkFuncEventKey)
|
||||
if !ok {
|
||||
panic("get work key err")
|
||||
}
|
||||
workFunc, ok := work.(EventWorkFunc)
|
||||
if !ok {
|
||||
panic("work func err")
|
||||
}
|
||||
_, err := event.ExecWorkAndSendResult(workFunc)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}()
|
||||
|
||||
// 一般的 two-way 模式
|
||||
for i := 0; i < 10000; i++ {
|
||||
event := produce.NewEvent(waitTestEvent)
|
||||
event.InitWaitEvent()
|
||||
event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) {
|
||||
return i + 1, nil
|
||||
}))
|
||||
produce.Call(ctx, event)
|
||||
res, err := event.StartWaitEvent(2 * time.Second)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res, i+1)
|
||||
event.Recovery()
|
||||
}
|
||||
|
||||
// 挂起模式,2 秒左右的执行时间
|
||||
group := sync.WaitGroup{}
|
||||
group.Add(5)
|
||||
for i := 0; i < 5; i++ {
|
||||
go func(i int) {
|
||||
event := produce.NewEvent(waitTestEvent)
|
||||
event.InitWaitEvent()
|
||||
event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) {
|
||||
// 访问 await Work 来发起一个 异步请求操作
|
||||
return EventAwaitFunc(func() (interface{}, error) {
|
||||
time.Sleep(time.Second)
|
||||
return i + 1, nil
|
||||
}), nil
|
||||
}))
|
||||
produce.Call(ctx, event)
|
||||
res, err := event.StartWaitEvent(2 * time.Second)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res, i+1)
|
||||
event.Recovery()
|
||||
group.Done()
|
||||
}(i)
|
||||
}
|
||||
|
||||
// 挂起成功不发生超时
|
||||
for i := 0; i < 10000; i++ {
|
||||
event := produce.NewEvent(waitTestEvent)
|
||||
event.InitWaitEvent()
|
||||
event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) {
|
||||
return i + 1, nil
|
||||
}))
|
||||
produce.Call(ctx, event)
|
||||
res, err := event.StartWaitEvent(500 * time.Millisecond)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res, i+1)
|
||||
event.Recovery()
|
||||
}
|
||||
|
||||
group.Wait()
|
||||
|
||||
// 挂起一个高延迟操作, 保证局部操作还在事件中
|
||||
group = sync.WaitGroup{}
|
||||
group.Add(5)
|
||||
for i := 0; i < 5; i++ {
|
||||
event := produce.NewEvent(waitTestEvent)
|
||||
event.InitWaitEvent()
|
||||
event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) {
|
||||
return EventAwaitFunc(func() (interface{}, error) {
|
||||
// 返回值为 EventWorkFunc 时, 会重新加入末端队列
|
||||
return EventWorkFunc(func() (interface{}, error) {
|
||||
return i + 1, nil
|
||||
}), nil
|
||||
|
||||
}), nil
|
||||
}))
|
||||
produce.Call(ctx, event)
|
||||
res, err := event.StartWaitEvent(2 * time.Second)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res, i+1)
|
||||
event.Recovery()
|
||||
group.Done()
|
||||
fmt.Println(i)
|
||||
}
|
||||
group.Wait()
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package event2
|
||||
|
||||
import "context"
|
||||
|
||||
type Produce struct {
|
||||
driver DriverInterface
|
||||
}
|
||||
|
||||
func (p *Produce) NewEvent(name string) *event {
|
||||
return p.driver.NewEvent(name)
|
||||
}
|
||||
|
||||
func (p *Produce) Call(ctx context.Context, e *event) {
|
||||
p.driver.Put(e)
|
||||
}
|
||||
|
||||
func NewProduce(driver DriverInterface) ProduceInterface {
|
||||
return &Produce{
|
||||
driver: driver,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package event2
|
||||
|
||||
func (d *driver) awaitWorker() {
|
||||
for i := 0; i < awaitThread; i++ {
|
||||
go func() {
|
||||
for {
|
||||
awaitFunc := <-d.waitQueue
|
||||
e, res, err := awaitFunc()
|
||||
e.execWorker(res, err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ const (
|
|||
OptionEventName = "operateEvent"
|
||||
CleanEventName = "clearEvent"
|
||||
TtlEventName = "ttlEvent"
|
||||
WorkFuncEventKey = "workFunc"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
_ "gitee.com/wheat-os/wheatCache/conf"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/errorx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/middle"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/structure"
|
||||
|
@ -29,9 +30,9 @@ type SingleCache struct {
|
|||
lruMaxDiverSize int
|
||||
lruTtlManage *lruTTl // 定时清理器
|
||||
|
||||
lruDriver event.DriverInterface
|
||||
lruConsumer event.ConsumerInterface
|
||||
lruCleanProduce event.ProduceInterface // 发送清理事件
|
||||
lruDriver event2.DriverInterface
|
||||
lruConsumer event2.ConsumerInterface
|
||||
lruCleanProduce event2.ProduceInterface // 发送清理事件
|
||||
|
||||
middleProduce event.ProduceInterface // 中间件驱动
|
||||
}
|
||||
|
@ -76,7 +77,7 @@ func cacheInit() (int64, int64, int, int) {
|
|||
// NewLRUCache lru初始化
|
||||
func NewLRUCache() *SingleCache {
|
||||
maxSize, clearSize, maxDriverSize, detachNum := cacheInit()
|
||||
lruDriver := event.NewDriver(maxDriverSize)
|
||||
lruDriver := event2.NewDriver(maxDriverSize)
|
||||
lruCacheOnce.Do(func() {
|
||||
lru := &SingleCache{
|
||||
maxsize: maxSize,
|
||||
|
@ -86,8 +87,8 @@ func NewLRUCache() *SingleCache {
|
|||
lruMap: make(map[string]*list.Element),
|
||||
lruMaxDiverSize: maxDriverSize,
|
||||
lruDriver: lruDriver,
|
||||
lruConsumer: event.NewConsumer(lruDriver),
|
||||
lruCleanProduce: event.NewProduce(lruDriver),
|
||||
lruConsumer: event2.NewConsumer(lruDriver),
|
||||
lruCleanProduce: event2.NewProduce(lruDriver),
|
||||
middleProduce: event.NewProduce(middle.NewMiddleWare().GetEventDriver()),
|
||||
lruTtlManage: newLruTTl(detachNum),
|
||||
}
|
||||
|
@ -103,7 +104,7 @@ func NewLRUCache() *SingleCache {
|
|||
}
|
||||
|
||||
// GetDriver 获取驱动
|
||||
func (lru *SingleCache) GetDriver() event.DriverInterface {
|
||||
func (lru *SingleCache) GetDriver() event2.DriverInterface {
|
||||
return lru.lruDriver
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/logx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/structure/stringx"
|
||||
|
@ -15,9 +15,9 @@ import (
|
|||
func TestWorker(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
lru := NewLRUCache()
|
||||
produce := event.NewProduce(lru.GetDriver())
|
||||
produce := event2.NewProduce(lru.GetDriver())
|
||||
workEvent := produce.NewEvent(OptionEventName)
|
||||
workEvent.SetValue(WorkFuncEventKey, event.EventWorkFunc(func() (interface{}, error) {
|
||||
workEvent.SetValue(event2.WorkFuncEventKey, event2.EventWorkFunc(func() (interface{}, error) {
|
||||
v1 := stringx.NewStringSingle()
|
||||
key := proto.BaseKey{
|
||||
Key: "v1",
|
||||
|
@ -36,11 +36,11 @@ func TestWorker(t *testing.T) {
|
|||
func TestSingleCache_DelToClearSize(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
lru := NewLRUCache()
|
||||
produce := event.NewProduce(lru.GetDriver())
|
||||
produce := event2.NewProduce(lru.GetDriver())
|
||||
|
||||
for i := int32(20000); i > 0; i-- {
|
||||
workEvent := produce.NewEvent(OptionEventName)
|
||||
workEvent.SetValue(WorkFuncEventKey, event.EventWorkFunc(func() (interface{}, error) {
|
||||
workEvent.SetValue(event2.WorkFuncEventKey, event2.EventWorkFunc(func() (interface{}, error) {
|
||||
v1 := stringx.NewStringSingle()
|
||||
key := proto.BaseKey{
|
||||
Key: string(i),
|
||||
|
@ -53,7 +53,7 @@ func TestSingleCache_DelToClearSize(t *testing.T) {
|
|||
workEvent.InitWaitEvent()
|
||||
produce.Call(ctx, workEvent)
|
||||
workEvent.StartWaitEvent(2 * time.Second)
|
||||
produce.Recovery(workEvent)
|
||||
workEvent.Recovery()
|
||||
}
|
||||
|
||||
logx.Info("start size is %d", lru.nowSize)
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/errorx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/logx"
|
||||
mMsg "gitee.com/wheat-os/wheatCache/pkg/middle-msg"
|
||||
)
|
||||
|
@ -14,7 +15,7 @@ func (lru *SingleCache) lruSingleWork() {
|
|||
ctx := context.Background()
|
||||
for {
|
||||
workEvent := lru.lruConsumer.Receive(ctx)
|
||||
workFunc, ok := workEvent.GetValue(WorkFuncEventKey)
|
||||
workFunc, ok := workEvent.GetValue(event2.WorkFuncEventKey)
|
||||
if !ok {
|
||||
workEvent.SetResultErr(errorx.LruNotWorkFuncEventErr())
|
||||
continue
|
||||
|
@ -22,7 +23,7 @@ func (lru *SingleCache) lruSingleWork() {
|
|||
|
||||
switch workEvent.GetEventName() {
|
||||
case OptionEventName:
|
||||
if work, ok := workFunc.(event.EventWorkFunc); ok {
|
||||
if work, ok := workFunc.(event2.EventWorkFunc); ok {
|
||||
workEvent.ExecWorkAndSendResult(work)
|
||||
}
|
||||
|
||||
|
@ -33,12 +34,12 @@ func (lru *SingleCache) lruSingleWork() {
|
|||
lru.lruCleanProduce.Call(ctx, workEvent)
|
||||
continue
|
||||
}
|
||||
if work, ok := workFunc.(event.EventWorkFunc); ok {
|
||||
if work, ok := workFunc.(event2.EventWorkFunc); ok {
|
||||
workEvent.ExecWorkAndSendResult(work)
|
||||
}
|
||||
|
||||
case TtlEventName:
|
||||
if work, ok := workFunc.(event.EventWorkFunc); ok {
|
||||
if work, ok := workFunc.(event2.EventWorkFunc); ok {
|
||||
workEvent.ExecWorkAndSendResult(work)
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +53,7 @@ func (lru *SingleCache) lruTtlWork() {
|
|||
|
||||
// 清理事件
|
||||
go func() {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
|
||||
beforeTime := time.Now().Unix()
|
||||
cle := lru.lruTtlManage.detachNum
|
||||
|
@ -80,12 +81,12 @@ func (lru *SingleCache) lruTtlWork() {
|
|||
}
|
||||
|
||||
ttlEvent := lru.lruCleanProduce.NewEvent(TtlEventName)
|
||||
ttlEvent.SetValue(WorkFuncEventKey, work)
|
||||
ttlEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
ttlEvent.InitWaitEvent()
|
||||
|
||||
lru.lruCleanProduce.Call(ctx, ttlEvent)
|
||||
keys, err := ttlEvent.StartWaitEvent(time.Second * 2)
|
||||
lru.lruCleanProduce.Recovery(ttlEvent)
|
||||
ttlEvent.Recovery()
|
||||
|
||||
mMsg.SendMiddleMsg(ctx, lru.middleProduce, mMsg.LruTTlContext{
|
||||
Keys: keys.([]string),
|
||||
|
@ -118,7 +119,7 @@ func (lru *SingleCache) cleanWork() {
|
|||
time.Sleep(2 * time.Second)
|
||||
if lru.clearSize < lru.nowSize {
|
||||
lruCleanEvent := lru.lruCleanProduce.NewEvent(CleanEventName)
|
||||
lruCleanEvent.SetValue(WorkFuncEventKey, work)
|
||||
lruCleanEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
|
||||
lruCleanEvent.InitWaitEvent()
|
||||
lru.lruCleanProduce.Call(cxt, lruCleanEvent)
|
||||
|
@ -128,7 +129,7 @@ func (lru *SingleCache) cleanWork() {
|
|||
}
|
||||
|
||||
// 归还
|
||||
lru.lruCleanProduce.Recovery(lruCleanEvent)
|
||||
lruCleanEvent.Recovery()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,44 @@ func (x *BaseKey) GetExpire() *timestamppb.Timestamp {
|
|||
return nil
|
||||
}
|
||||
|
||||
type External struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *External) Reset() {
|
||||
*x = External{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_base_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *External) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*External) ProtoMessage() {}
|
||||
|
||||
func (x *External) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_base_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use External.ProtoReflect.Descriptor instead.
|
||||
func (*External) Descriptor() ([]byte, []int) {
|
||||
return file_base_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
var File_base_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_base_proto_rawDesc = []byte{
|
||||
|
@ -96,8 +134,9 @@ var file_base_proto_rawDesc = []byte{
|
|||
0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65,
|
||||
0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x22, 0x0a, 0x0a, 0x08, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x42, 0x0b, 0x5a, 0x09,
|
||||
0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -112,13 +151,14 @@ func file_base_proto_rawDescGZIP() []byte {
|
|||
return file_base_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_base_proto_goTypes = []interface{}{
|
||||
(*BaseKey)(nil), // 0: BaseKey
|
||||
(*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp
|
||||
(*External)(nil), // 1: External
|
||||
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
|
||||
}
|
||||
var file_base_proto_depIdxs = []int32{
|
||||
1, // 0: BaseKey.expire:type_name -> google.protobuf.Timestamp
|
||||
2, // 0: BaseKey.expire:type_name -> google.protobuf.Timestamp
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
|
@ -144,6 +184,18 @@ func file_base_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_base_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*External); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -151,7 +203,7 @@ func file_base_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_base_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,85 +32,122 @@ var file_storage_proto_rawDesc = []byte{
|
|||
0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b,
|
||||
0x6c, 0x69, 0x73, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x68, 0x61, 0x73,
|
||||
0x68, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xed, 0x09, 0x0a, 0x0a, 0x43, 0x6f, 0x6d,
|
||||
0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x0b,
|
||||
0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x65,
|
||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x47, 0x65, 0x74,
|
||||
0x12, 0x0b, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x41,
|
||||
0x64, 0x64, 0x12, 0x0b, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x0c, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a,
|
||||
0x06, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x12, 0x0e, 0x2e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, 0x65, 0x74, 0x42,
|
||||
0x69, 0x74, 0x12, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x12, 0x0e, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f,
|
||||
0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74,
|
||||
0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x53,
|
||||
0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x53,
|
||||
0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, 0x74,
|
||||
0x72, 0x4c, 0x65, 0x6e, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x12, 0x0d,
|
||||
0x2e, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e,
|
||||
0x53, 0x65, 0x74, 0x6e, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a,
|
||||
0x06, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x0e, 0x2e, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x4c, 0x65, 0x6e,
|
||||
0x12, 0x0c, 0x2e, 0x4c, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d,
|
||||
0x2e, 0x4c, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a,
|
||||
0x04, 0x4c, 0x50, 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x4c, 0x50,
|
||||
0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x50, 0x75,
|
||||
0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x50,
|
||||
0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12,
|
||||
0x0e, 0x2e, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x0f, 0x2e, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x23, 0x0a, 0x04, 0x4c, 0x52, 0x65, 0x6d, 0x12, 0x0c, 0x2e, 0x4c, 0x52, 0x65, 0x6d, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x53, 0x65, 0x74, 0x12, 0x0c, 0x2e,
|
||||
0x4c, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x53,
|
||||
0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x52, 0x50,
|
||||
0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x0d, 0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x26, 0x0a, 0x05, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x12, 0x0d, 0x2e, 0x4c, 0x54, 0x72, 0x69, 0x6d,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x52, 0x50, 0x75, 0x73, 0x68,
|
||||
0x12, 0x0d, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x0e, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x29, 0x0a, 0x06, 0x52, 0x50, 0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x52, 0x50, 0x75, 0x73,
|
||||
0x68, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x50, 0x75, 0x73,
|
||||
0x68, 0x58, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x44,
|
||||
0x65, 0x6c, 0x12, 0x0c, 0x2e, 0x48, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x0d, 0x2e, 0x48, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x2c, 0x0a, 0x07, 0x48, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x0f, 0x2e, 0x48, 0x45, 0x78,
|
||||
0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48, 0x45,
|
||||
0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a,
|
||||
0x04, 0x48, 0x47, 0x65, 0x74, 0x12, 0x0c, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x0f, 0x2e,
|
||||
0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10,
|
||||
0x2e, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x2c, 0x0a, 0x07, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x12, 0x0f, 0x2e, 0x48, 0x49,
|
||||
0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48,
|
||||
0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26,
|
||||
0x0a, 0x05, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x0d, 0x2e, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x4c, 0x65, 0x6e, 0x12, 0x0c,
|
||||
0x2e, 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x48,
|
||||
0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48,
|
||||
0x53, 0x65, 0x74, 0x12, 0x0c, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x0d, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x26, 0x0a, 0x05, 0x48, 0x53, 0x65, 0x74, 0x58, 0x12, 0x0d, 0x2e, 0x48, 0x53, 0x65, 0x74,
|
||||
0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58,
|
||||
0x68, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x73, 0x65, 0x74, 0x78, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x32, 0xb1, 0x0e, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x0b, 0x2e, 0x53, 0x65, 0x74,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x0b, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x47, 0x65, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x0b,
|
||||
0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x41, 0x64,
|
||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x52, 0x65, 0x64,
|
||||
0x75, 0x63, 0x65, 0x12, 0x0e, 0x2e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x12, 0x0e,
|
||||
0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f,
|
||||
0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x12, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x42,
|
||||
0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x42,
|
||||
0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x47, 0x65,
|
||||
0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x47,
|
||||
0x65, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e,
|
||||
0x12, 0x0e, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x0f, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x12, 0x0d, 0x2e, 0x53, 0x65, 0x74,
|
||||
0x6e, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x6e,
|
||||
0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x12, 0x0e, 0x2e, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x4c, 0x65, 0x6e, 0x12, 0x0c, 0x2e, 0x4c,
|
||||
0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x4c, 0x65,
|
||||
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x50, 0x6f,
|
||||
0x70, 0x12, 0x0c, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x0d, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26,
|
||||
0x0a, 0x05, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58,
|
||||
0x12, 0x0e, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x0f, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0e, 0x2e, 0x4c, 0x52,
|
||||
0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x52,
|
||||
0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04,
|
||||
0x4c, 0x52, 0x65, 0x6d, 0x12, 0x0c, 0x2e, 0x4c, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x53, 0x65, 0x74, 0x12, 0x0c, 0x2e, 0x4c, 0x53, 0x65, 0x74,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x53, 0x65, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x52, 0x50, 0x6f, 0x70, 0x12, 0x0c,
|
||||
0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x52,
|
||||
0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x4c,
|
||||
0x54, 0x72, 0x69, 0x6d, 0x12, 0x0d, 0x2e, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x52, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x52,
|
||||
0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x52, 0x50,
|
||||
0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x52,
|
||||
0x50, 0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x44, 0x65, 0x6c, 0x12, 0x0c,
|
||||
0x2e, 0x48, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x48,
|
||||
0x44, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x48,
|
||||
0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x0f, 0x2e, 0x48, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48, 0x45, 0x78, 0x69, 0x73, 0x74,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x47, 0x65,
|
||||
0x74, 0x12, 0x0c, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x0d, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c,
|
||||
0x0a, 0x07, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x0f, 0x2e, 0x48, 0x47, 0x65, 0x74,
|
||||
0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48, 0x47, 0x65,
|
||||
0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07,
|
||||
0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x12, 0x0f, 0x2e, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42,
|
||||
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48, 0x49, 0x6e, 0x63, 0x72,
|
||||
0x42, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x48, 0x4b,
|
||||
0x65, 0x79, 0x73, 0x12, 0x0d, 0x2e, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x4c, 0x65, 0x6e, 0x12, 0x0c, 0x2e, 0x48, 0x4c, 0x65,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x48, 0x4c, 0x65, 0x6e, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x53, 0x65, 0x74, 0x12,
|
||||
0x0c, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e,
|
||||
0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05,
|
||||
0x48, 0x53, 0x65, 0x74, 0x58, 0x12, 0x0d, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x53, 0x41, 0x64, 0x64, 0x12, 0x0c, 0x2e, 0x53,
|
||||
0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x53, 0x41, 0x64,
|
||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x43, 0x61,
|
||||
0x72, 0x64, 0x12, 0x0d, 0x2e, 0x53, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x44, 0x69, 0x66, 0x66, 0x12, 0x0d, 0x2e, 0x53, 0x44, 0x69,
|
||||
0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x44, 0x69, 0x66,
|
||||
0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x0a, 0x53, 0x44, 0x69,
|
||||
0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x12, 0x2e, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53,
|
||||
0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x53, 0x44,
|
||||
0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x29, 0x0a, 0x06, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x53, 0x49, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x49, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x53,
|
||||
0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x53, 0x49, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x14, 0x2e, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x12, 0x11, 0x2e, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65,
|
||||
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x4d, 0x6f,
|
||||
0x76, 0x65, 0x12, 0x0d, 0x2e, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x23, 0x0a, 0x04, 0x53, 0x50, 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x53, 0x50, 0x6f, 0x70,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x53, 0x50, 0x6f, 0x70, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x53, 0x52, 0x65, 0x6d, 0x12, 0x0c,
|
||||
0x2e, 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x53,
|
||||
0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53,
|
||||
0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x2e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e,
|
||||
0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74,
|
||||
0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x55, 0x6e,
|
||||
0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x26, 0x0a, 0x05, 0x53, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x0d, 0x2e, 0x53, 0x53, 0x63, 0x61,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x53, 0x63, 0x61, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
@ -147,37 +184,63 @@ var file_storage_proto_goTypes = []interface{}{
|
|||
(*HLenRequest)(nil), // 28: HLenRequest
|
||||
(*HSetRequest)(nil), // 29: HSetRequest
|
||||
(*HSetXRequest)(nil), // 30: HSetXRequest
|
||||
(*SetResponse)(nil), // 31: SetResponse
|
||||
(*GetResponse)(nil), // 32: GetResponse
|
||||
(*AddResponse)(nil), // 33: AddResponse
|
||||
(*ReduceResponse)(nil), // 34: ReduceResponse
|
||||
(*SetBitResponse)(nil), // 35: SetBitResponse
|
||||
(*GetBitResponse)(nil), // 36: GetBitResponse
|
||||
(*GetRangeResponse)(nil), // 37: GetRangeResponse
|
||||
(*GetSetResponse)(nil), // 38: GetSetResponse
|
||||
(*StrLenResponse)(nil), // 39: StrLenResponse
|
||||
(*SetnxResponse)(nil), // 40: SetnxResponse
|
||||
(*LIndexResponse)(nil), // 41: LIndexResponse
|
||||
(*LLenResponse)(nil), // 42: LLenResponse
|
||||
(*LPopResponse)(nil), // 43: LPopResponse
|
||||
(*LPushResponse)(nil), // 44: LPushResponse
|
||||
(*LPushXResponse)(nil), // 45: LPushXResponse
|
||||
(*LRangeResponse)(nil), // 46: LRangeResponse
|
||||
(*LRemResponse)(nil), // 47: LRemResponse
|
||||
(*LSetResponse)(nil), // 48: LSetResponse
|
||||
(*RPopResponse)(nil), // 49: RPopResponse
|
||||
(*LTrimResponse)(nil), // 50: LTrimResponse
|
||||
(*RPushResponse)(nil), // 51: RPushResponse
|
||||
(*RPushXResponse)(nil), // 52: RPushXResponse
|
||||
(*HDelResponse)(nil), // 53: HDelResponse
|
||||
(*HExistsResponse)(nil), // 54: HExistsResponse
|
||||
(*HGetResponse)(nil), // 55: HGetResponse
|
||||
(*HGetAllResponse)(nil), // 56: HGetAllResponse
|
||||
(*HIncrByResponse)(nil), // 57: HIncrByResponse
|
||||
(*HKeysResponse)(nil), // 58: HKeysResponse
|
||||
(*HLenResponse)(nil), // 59: HLenResponse
|
||||
(*HSetResponse)(nil), // 60: HSetResponse
|
||||
(*HSetXResponse)(nil), // 61: HSetXResponse
|
||||
(*SAddRequest)(nil), // 31: SAddRequest
|
||||
(*SCardRequest)(nil), // 32: SCardRequest
|
||||
(*SDiffRequest)(nil), // 33: SDiffRequest
|
||||
(*SDiffStoreRequest)(nil), // 34: SDiffStoreRequest
|
||||
(*SInterRequest)(nil), // 35: SInterRequest
|
||||
(*SInterStoreRequest)(nil), // 36: SInterStoreRequest
|
||||
(*SIsMemberRequest)(nil), // 37: SIsMemberRequest
|
||||
(*SMoveRequest)(nil), // 38: SMoveRequest
|
||||
(*SPopRequest)(nil), // 39: SPopRequest
|
||||
(*SRemRequest)(nil), // 40: SRemRequest
|
||||
(*SUnionRequest)(nil), // 41: SUnionRequest
|
||||
(*SUnionStoreRequest)(nil), // 42: SUnionStoreRequest
|
||||
(*SScanRequest)(nil), // 43: SScanRequest
|
||||
(*SetResponse)(nil), // 44: SetResponse
|
||||
(*GetResponse)(nil), // 45: GetResponse
|
||||
(*AddResponse)(nil), // 46: AddResponse
|
||||
(*ReduceResponse)(nil), // 47: ReduceResponse
|
||||
(*SetBitResponse)(nil), // 48: SetBitResponse
|
||||
(*GetBitResponse)(nil), // 49: GetBitResponse
|
||||
(*GetRangeResponse)(nil), // 50: GetRangeResponse
|
||||
(*GetSetResponse)(nil), // 51: GetSetResponse
|
||||
(*StrLenResponse)(nil), // 52: StrLenResponse
|
||||
(*SetnxResponse)(nil), // 53: SetnxResponse
|
||||
(*LIndexResponse)(nil), // 54: LIndexResponse
|
||||
(*LLenResponse)(nil), // 55: LLenResponse
|
||||
(*LPopResponse)(nil), // 56: LPopResponse
|
||||
(*LPushResponse)(nil), // 57: LPushResponse
|
||||
(*LPushXResponse)(nil), // 58: LPushXResponse
|
||||
(*LRangeResponse)(nil), // 59: LRangeResponse
|
||||
(*LRemResponse)(nil), // 60: LRemResponse
|
||||
(*LSetResponse)(nil), // 61: LSetResponse
|
||||
(*RPopResponse)(nil), // 62: RPopResponse
|
||||
(*LTrimResponse)(nil), // 63: LTrimResponse
|
||||
(*RPushResponse)(nil), // 64: RPushResponse
|
||||
(*RPushXResponse)(nil), // 65: RPushXResponse
|
||||
(*HDelResponse)(nil), // 66: HDelResponse
|
||||
(*HExistsResponse)(nil), // 67: HExistsResponse
|
||||
(*HGetResponse)(nil), // 68: HGetResponse
|
||||
(*HGetAllResponse)(nil), // 69: HGetAllResponse
|
||||
(*HIncrByResponse)(nil), // 70: HIncrByResponse
|
||||
(*HKeysResponse)(nil), // 71: HKeysResponse
|
||||
(*HLenResponse)(nil), // 72: HLenResponse
|
||||
(*HSetResponse)(nil), // 73: HSetResponse
|
||||
(*HSetXResponse)(nil), // 74: HSetXResponse
|
||||
(*SAddResponse)(nil), // 75: SAddResponse
|
||||
(*SCardResponse)(nil), // 76: SCardResponse
|
||||
(*SDiffResponse)(nil), // 77: SDiffResponse
|
||||
(*SDiffStoreResponse)(nil), // 78: SDiffStoreResponse
|
||||
(*SInterResponse)(nil), // 79: SInterResponse
|
||||
(*SInterStoreResponse)(nil), // 80: SInterStoreResponse
|
||||
(*SIsMemberResponse)(nil), // 81: SIsMemberResponse
|
||||
(*SMoveResponse)(nil), // 82: SMoveResponse
|
||||
(*SPopResponse)(nil), // 83: SPopResponse
|
||||
(*SRemResponse)(nil), // 84: SRemResponse
|
||||
(*SUnionResponse)(nil), // 85: SUnionResponse
|
||||
(*SUnionStoreResponse)(nil), // 86: SUnionStoreResponse
|
||||
(*SScanResponse)(nil), // 87: SScanResponse
|
||||
}
|
||||
var file_storage_proto_depIdxs = []int32{
|
||||
0, // 0: CommServer.Set:input_type -> SetRequest
|
||||
|
@ -211,39 +274,65 @@ var file_storage_proto_depIdxs = []int32{
|
|||
28, // 28: CommServer.HLen:input_type -> HLenRequest
|
||||
29, // 29: CommServer.HSet:input_type -> HSetRequest
|
||||
30, // 30: CommServer.HSetX:input_type -> HSetXRequest
|
||||
31, // 31: CommServer.Set:output_type -> SetResponse
|
||||
32, // 32: CommServer.Get:output_type -> GetResponse
|
||||
33, // 33: CommServer.Add:output_type -> AddResponse
|
||||
34, // 34: CommServer.Reduce:output_type -> ReduceResponse
|
||||
35, // 35: CommServer.SetBit:output_type -> SetBitResponse
|
||||
36, // 36: CommServer.GetBit:output_type -> GetBitResponse
|
||||
37, // 37: CommServer.GetRange:output_type -> GetRangeResponse
|
||||
38, // 38: CommServer.GetSet:output_type -> GetSetResponse
|
||||
39, // 39: CommServer.StrLen:output_type -> StrLenResponse
|
||||
40, // 40: CommServer.Setnx:output_type -> SetnxResponse
|
||||
41, // 41: CommServer.LIndex:output_type -> LIndexResponse
|
||||
42, // 42: CommServer.LLen:output_type -> LLenResponse
|
||||
43, // 43: CommServer.LPop:output_type -> LPopResponse
|
||||
44, // 44: CommServer.LPush:output_type -> LPushResponse
|
||||
45, // 45: CommServer.LPushX:output_type -> LPushXResponse
|
||||
46, // 46: CommServer.LRange:output_type -> LRangeResponse
|
||||
47, // 47: CommServer.LRem:output_type -> LRemResponse
|
||||
48, // 48: CommServer.LSet:output_type -> LSetResponse
|
||||
49, // 49: CommServer.RPop:output_type -> RPopResponse
|
||||
50, // 50: CommServer.LTrim:output_type -> LTrimResponse
|
||||
51, // 51: CommServer.RPush:output_type -> RPushResponse
|
||||
52, // 52: CommServer.RPushX:output_type -> RPushXResponse
|
||||
53, // 53: CommServer.HDel:output_type -> HDelResponse
|
||||
54, // 54: CommServer.HExists:output_type -> HExistsResponse
|
||||
55, // 55: CommServer.HGet:output_type -> HGetResponse
|
||||
56, // 56: CommServer.HGetAll:output_type -> HGetAllResponse
|
||||
57, // 57: CommServer.HIncrBy:output_type -> HIncrByResponse
|
||||
58, // 58: CommServer.HKeys:output_type -> HKeysResponse
|
||||
59, // 59: CommServer.HLen:output_type -> HLenResponse
|
||||
60, // 60: CommServer.HSet:output_type -> HSetResponse
|
||||
61, // 61: CommServer.HSetX:output_type -> HSetXResponse
|
||||
31, // [31:62] is the sub-list for method output_type
|
||||
0, // [0:31] is the sub-list for method input_type
|
||||
31, // 31: CommServer.SAdd:input_type -> SAddRequest
|
||||
32, // 32: CommServer.SCard:input_type -> SCardRequest
|
||||
33, // 33: CommServer.SDiff:input_type -> SDiffRequest
|
||||
34, // 34: CommServer.SDiffStore:input_type -> SDiffStoreRequest
|
||||
35, // 35: CommServer.SInter:input_type -> SInterRequest
|
||||
36, // 36: CommServer.SInterStore:input_type -> SInterStoreRequest
|
||||
37, // 37: CommServer.SIsMember:input_type -> SIsMemberRequest
|
||||
38, // 38: CommServer.SMove:input_type -> SMoveRequest
|
||||
39, // 39: CommServer.SPop:input_type -> SPopRequest
|
||||
40, // 40: CommServer.SRem:input_type -> SRemRequest
|
||||
41, // 41: CommServer.SUnion:input_type -> SUnionRequest
|
||||
42, // 42: CommServer.SUnionStore:input_type -> SUnionStoreRequest
|
||||
43, // 43: CommServer.SScan:input_type -> SScanRequest
|
||||
44, // 44: CommServer.Set:output_type -> SetResponse
|
||||
45, // 45: CommServer.Get:output_type -> GetResponse
|
||||
46, // 46: CommServer.Add:output_type -> AddResponse
|
||||
47, // 47: CommServer.Reduce:output_type -> ReduceResponse
|
||||
48, // 48: CommServer.SetBit:output_type -> SetBitResponse
|
||||
49, // 49: CommServer.GetBit:output_type -> GetBitResponse
|
||||
50, // 50: CommServer.GetRange:output_type -> GetRangeResponse
|
||||
51, // 51: CommServer.GetSet:output_type -> GetSetResponse
|
||||
52, // 52: CommServer.StrLen:output_type -> StrLenResponse
|
||||
53, // 53: CommServer.Setnx:output_type -> SetnxResponse
|
||||
54, // 54: CommServer.LIndex:output_type -> LIndexResponse
|
||||
55, // 55: CommServer.LLen:output_type -> LLenResponse
|
||||
56, // 56: CommServer.LPop:output_type -> LPopResponse
|
||||
57, // 57: CommServer.LPush:output_type -> LPushResponse
|
||||
58, // 58: CommServer.LPushX:output_type -> LPushXResponse
|
||||
59, // 59: CommServer.LRange:output_type -> LRangeResponse
|
||||
60, // 60: CommServer.LRem:output_type -> LRemResponse
|
||||
61, // 61: CommServer.LSet:output_type -> LSetResponse
|
||||
62, // 62: CommServer.RPop:output_type -> RPopResponse
|
||||
63, // 63: CommServer.LTrim:output_type -> LTrimResponse
|
||||
64, // 64: CommServer.RPush:output_type -> RPushResponse
|
||||
65, // 65: CommServer.RPushX:output_type -> RPushXResponse
|
||||
66, // 66: CommServer.HDel:output_type -> HDelResponse
|
||||
67, // 67: CommServer.HExists:output_type -> HExistsResponse
|
||||
68, // 68: CommServer.HGet:output_type -> HGetResponse
|
||||
69, // 69: CommServer.HGetAll:output_type -> HGetAllResponse
|
||||
70, // 70: CommServer.HIncrBy:output_type -> HIncrByResponse
|
||||
71, // 71: CommServer.HKeys:output_type -> HKeysResponse
|
||||
72, // 72: CommServer.HLen:output_type -> HLenResponse
|
||||
73, // 73: CommServer.HSet:output_type -> HSetResponse
|
||||
74, // 74: CommServer.HSetX:output_type -> HSetXResponse
|
||||
75, // 75: CommServer.SAdd:output_type -> SAddResponse
|
||||
76, // 76: CommServer.SCard:output_type -> SCardResponse
|
||||
77, // 77: CommServer.SDiff:output_type -> SDiffResponse
|
||||
78, // 78: CommServer.SDiffStore:output_type -> SDiffStoreResponse
|
||||
79, // 79: CommServer.SInter:output_type -> SInterResponse
|
||||
80, // 80: CommServer.SInterStore:output_type -> SInterStoreResponse
|
||||
81, // 81: CommServer.SIsMember:output_type -> SIsMemberResponse
|
||||
82, // 82: CommServer.SMove:output_type -> SMoveResponse
|
||||
83, // 83: CommServer.SPop:output_type -> SPopResponse
|
||||
84, // 84: CommServer.SRem:output_type -> SRemResponse
|
||||
85, // 85: CommServer.SUnion:output_type -> SUnionResponse
|
||||
86, // 86: CommServer.SUnionStore:output_type -> SUnionStoreResponse
|
||||
87, // 87: CommServer.SScan:output_type -> SScanResponse
|
||||
44, // [44:88] is the sub-list for method output_type
|
||||
0, // [0:44] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
|
@ -257,6 +346,7 @@ func file_storage_proto_init() {
|
|||
file_stringx_proto_init()
|
||||
file_listx_proto_init()
|
||||
file_hashx_proto_init()
|
||||
file_setx_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
|
@ -319,6 +409,19 @@ type CommServerClient interface {
|
|||
HLen(ctx context.Context, in *HLenRequest, opts ...grpc.CallOption) (*HLenResponse, error)
|
||||
HSet(ctx context.Context, in *HSetRequest, opts ...grpc.CallOption) (*HSetResponse, error)
|
||||
HSetX(ctx context.Context, in *HSetXRequest, opts ...grpc.CallOption) (*HSetXResponse, error)
|
||||
SAdd(ctx context.Context, in *SAddRequest, opts ...grpc.CallOption) (*SAddResponse, error)
|
||||
SCard(ctx context.Context, in *SCardRequest, opts ...grpc.CallOption) (*SCardResponse, error)
|
||||
SDiff(ctx context.Context, in *SDiffRequest, opts ...grpc.CallOption) (*SDiffResponse, error)
|
||||
SDiffStore(ctx context.Context, in *SDiffStoreRequest, opts ...grpc.CallOption) (*SDiffStoreResponse, error)
|
||||
SInter(ctx context.Context, in *SInterRequest, opts ...grpc.CallOption) (*SInterResponse, error)
|
||||
SInterStore(ctx context.Context, in *SInterStoreRequest, opts ...grpc.CallOption) (*SInterStoreResponse, error)
|
||||
SIsMember(ctx context.Context, in *SIsMemberRequest, opts ...grpc.CallOption) (*SIsMemberResponse, error)
|
||||
SMove(ctx context.Context, in *SMoveRequest, opts ...grpc.CallOption) (*SMoveResponse, error)
|
||||
SPop(ctx context.Context, in *SPopRequest, opts ...grpc.CallOption) (*SPopResponse, error)
|
||||
SRem(ctx context.Context, in *SRemRequest, opts ...grpc.CallOption) (*SRemResponse, error)
|
||||
SUnion(ctx context.Context, in *SUnionRequest, opts ...grpc.CallOption) (*SUnionResponse, error)
|
||||
SUnionStore(ctx context.Context, in *SUnionStoreRequest, opts ...grpc.CallOption) (*SUnionStoreResponse, error)
|
||||
SScan(ctx context.Context, in *SScanRequest, opts ...grpc.CallOption) (*SScanResponse, error)
|
||||
}
|
||||
|
||||
type commServerClient struct {
|
||||
|
@ -608,6 +711,123 @@ func (c *commServerClient) HSetX(ctx context.Context, in *HSetXRequest, opts ...
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SAdd(ctx context.Context, in *SAddRequest, opts ...grpc.CallOption) (*SAddResponse, error) {
|
||||
out := new(SAddResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SAdd", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SCard(ctx context.Context, in *SCardRequest, opts ...grpc.CallOption) (*SCardResponse, error) {
|
||||
out := new(SCardResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SCard", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SDiff(ctx context.Context, in *SDiffRequest, opts ...grpc.CallOption) (*SDiffResponse, error) {
|
||||
out := new(SDiffResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SDiff", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SDiffStore(ctx context.Context, in *SDiffStoreRequest, opts ...grpc.CallOption) (*SDiffStoreResponse, error) {
|
||||
out := new(SDiffStoreResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SDiffStore", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SInter(ctx context.Context, in *SInterRequest, opts ...grpc.CallOption) (*SInterResponse, error) {
|
||||
out := new(SInterResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SInter", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SInterStore(ctx context.Context, in *SInterStoreRequest, opts ...grpc.CallOption) (*SInterStoreResponse, error) {
|
||||
out := new(SInterStoreResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SInterStore", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SIsMember(ctx context.Context, in *SIsMemberRequest, opts ...grpc.CallOption) (*SIsMemberResponse, error) {
|
||||
out := new(SIsMemberResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SIsMember", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SMove(ctx context.Context, in *SMoveRequest, opts ...grpc.CallOption) (*SMoveResponse, error) {
|
||||
out := new(SMoveResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SMove", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SPop(ctx context.Context, in *SPopRequest, opts ...grpc.CallOption) (*SPopResponse, error) {
|
||||
out := new(SPopResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SPop", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SRem(ctx context.Context, in *SRemRequest, opts ...grpc.CallOption) (*SRemResponse, error) {
|
||||
out := new(SRemResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SRem", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SUnion(ctx context.Context, in *SUnionRequest, opts ...grpc.CallOption) (*SUnionResponse, error) {
|
||||
out := new(SUnionResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SUnion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SUnionStore(ctx context.Context, in *SUnionStoreRequest, opts ...grpc.CallOption) (*SUnionStoreResponse, error) {
|
||||
out := new(SUnionStoreResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SUnionStore", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) SScan(ctx context.Context, in *SScanRequest, opts ...grpc.CallOption) (*SScanResponse, error) {
|
||||
out := new(SScanResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/SScan", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CommServerServer is the server API for CommServer service.
|
||||
type CommServerServer interface {
|
||||
Set(context.Context, *SetRequest) (*SetResponse, error)
|
||||
|
@ -641,6 +861,19 @@ type CommServerServer interface {
|
|||
HLen(context.Context, *HLenRequest) (*HLenResponse, error)
|
||||
HSet(context.Context, *HSetRequest) (*HSetResponse, error)
|
||||
HSetX(context.Context, *HSetXRequest) (*HSetXResponse, error)
|
||||
SAdd(context.Context, *SAddRequest) (*SAddResponse, error)
|
||||
SCard(context.Context, *SCardRequest) (*SCardResponse, error)
|
||||
SDiff(context.Context, *SDiffRequest) (*SDiffResponse, error)
|
||||
SDiffStore(context.Context, *SDiffStoreRequest) (*SDiffStoreResponse, error)
|
||||
SInter(context.Context, *SInterRequest) (*SInterResponse, error)
|
||||
SInterStore(context.Context, *SInterStoreRequest) (*SInterStoreResponse, error)
|
||||
SIsMember(context.Context, *SIsMemberRequest) (*SIsMemberResponse, error)
|
||||
SMove(context.Context, *SMoveRequest) (*SMoveResponse, error)
|
||||
SPop(context.Context, *SPopRequest) (*SPopResponse, error)
|
||||
SRem(context.Context, *SRemRequest) (*SRemResponse, error)
|
||||
SUnion(context.Context, *SUnionRequest) (*SUnionResponse, error)
|
||||
SUnionStore(context.Context, *SUnionStoreRequest) (*SUnionStoreResponse, error)
|
||||
SScan(context.Context, *SScanRequest) (*SScanResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedCommServerServer can be embedded to have forward compatible implementations.
|
||||
|
@ -740,6 +973,45 @@ func (*UnimplementedCommServerServer) HSet(context.Context, *HSetRequest) (*HSet
|
|||
func (*UnimplementedCommServerServer) HSetX(context.Context, *HSetXRequest) (*HSetXResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method HSetX not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SAdd(context.Context, *SAddRequest) (*SAddResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SAdd not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SCard(context.Context, *SCardRequest) (*SCardResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SCard not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SDiff(context.Context, *SDiffRequest) (*SDiffResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SDiff not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SDiffStore(context.Context, *SDiffStoreRequest) (*SDiffStoreResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SDiffStore not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SInter(context.Context, *SInterRequest) (*SInterResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SInter not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SInterStore(context.Context, *SInterStoreRequest) (*SInterStoreResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SInterStore not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SIsMember(context.Context, *SIsMemberRequest) (*SIsMemberResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SIsMember not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SMove(context.Context, *SMoveRequest) (*SMoveResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SMove not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SPop(context.Context, *SPopRequest) (*SPopResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SPop not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SRem(context.Context, *SRemRequest) (*SRemResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SRem not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SUnion(context.Context, *SUnionRequest) (*SUnionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SUnion not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SUnionStore(context.Context, *SUnionStoreRequest) (*SUnionStoreResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SUnionStore not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) SScan(context.Context, *SScanRequest) (*SScanResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SScan not implemented")
|
||||
}
|
||||
|
||||
func RegisterCommServerServer(s *grpc.Server, srv CommServerServer) {
|
||||
s.RegisterService(&_CommServer_serviceDesc, srv)
|
||||
|
@ -1303,6 +1575,240 @@ func _CommServer_HSetX_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SAddRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SAdd(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SAdd",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SAdd(ctx, req.(*SAddRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SCardRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SCard(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SCard",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SCard(ctx, req.(*SCardRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SDiff_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SDiffRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SDiff(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SDiff",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SDiff(ctx, req.(*SDiffRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SDiffStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SDiffStoreRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SDiffStore(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SDiffStore",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SDiffStore(ctx, req.(*SDiffStoreRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SInter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SInterRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SInter(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SInter",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SInter(ctx, req.(*SInterRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SInterStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SInterStoreRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SInterStore(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SInterStore",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SInterStore(ctx, req.(*SInterStoreRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SIsMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SIsMemberRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SIsMember(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SIsMember",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SIsMember(ctx, req.(*SIsMemberRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SMove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SMoveRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SMove(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SMove",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SMove(ctx, req.(*SMoveRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SPop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SPopRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SPop(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SPop",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SPop(ctx, req.(*SPopRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SRem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SRemRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SRem(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SRem",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SRem(ctx, req.(*SRemRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SUnion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SUnionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SUnion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SUnion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SUnion(ctx, req.(*SUnionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SUnionStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SUnionStoreRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SUnionStore(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SUnionStore",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SUnionStore(ctx, req.(*SUnionStoreRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_SScan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SScanRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).SScan(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/SScan",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).SScan(ctx, req.(*SScanRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _CommServer_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "CommServer",
|
||||
HandlerType: (*CommServerServer)(nil),
|
||||
|
@ -1431,6 +1937,58 @@ var _CommServer_serviceDesc = grpc.ServiceDesc{
|
|||
MethodName: "HSetX",
|
||||
Handler: _CommServer_HSetX_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SAdd",
|
||||
Handler: _CommServer_SAdd_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SCard",
|
||||
Handler: _CommServer_SCard_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SDiff",
|
||||
Handler: _CommServer_SDiff_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SDiffStore",
|
||||
Handler: _CommServer_SDiffStore_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SInter",
|
||||
Handler: _CommServer_SInter_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SInterStore",
|
||||
Handler: _CommServer_SInterStore_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SIsMember",
|
||||
Handler: _CommServer_SIsMember_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SMove",
|
||||
Handler: _CommServer_SMove_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SPop",
|
||||
Handler: _CommServer_SPop_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SRem",
|
||||
Handler: _CommServer_SRem_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SUnion",
|
||||
Handler: _CommServer_SUnion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SUnionStore",
|
||||
Handler: _CommServer_SUnionStore_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SScan",
|
||||
Handler: _CommServer_SScan_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "storage.proto",
|
||||
|
|
|
@ -65,4 +65,5 @@ type HashXInterface interface {
|
|||
Add(renewal int, key ...string) (int, []string, error) // 访问影响成功的结果
|
||||
SetX(key string, val string) (bool, UpdateLength) // 不存在才插入
|
||||
Length() int
|
||||
Range(consur, count int, regex string) []string
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package hashx
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/errorx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/structure"
|
||||
)
|
||||
|
@ -118,3 +120,38 @@ func (h HashX) SetX(key string, val string) (bool, structure.UpdateLength) {
|
|||
func (h HashX) Length() int {
|
||||
return len(h)
|
||||
}
|
||||
|
||||
func (h HashX) Range(consur, count int, regex string) []string {
|
||||
|
||||
var reComp *regexp.Regexp
|
||||
if regex == "" {
|
||||
reComp = nil
|
||||
} else {
|
||||
reComp = regexp.MustCompile(regex)
|
||||
}
|
||||
|
||||
result := make([]string, 0)
|
||||
for _, val := range h {
|
||||
if consur > 0 {
|
||||
consur--
|
||||
continue
|
||||
}
|
||||
|
||||
if count == 0 && count != -1 {
|
||||
break
|
||||
}
|
||||
|
||||
s := val.ToString()
|
||||
if reComp == nil {
|
||||
count--
|
||||
result = append(result, s)
|
||||
continue
|
||||
}
|
||||
if reComp.MatchString(s) {
|
||||
count--
|
||||
result = append(result, s)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package hashx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"testing"
|
||||
"unsafe"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -60,3 +64,50 @@ func TestHashX_Add(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, s, "2")
|
||||
}
|
||||
|
||||
func Test_Pointer(t *testing.T) {
|
||||
s := make([]int, 9, 20)
|
||||
lens := *(*int)(unsafe.Pointer(uintptr(unsafe.Pointer(&s)) + uintptr(8)))
|
||||
fmt.Println(lens, len(s))
|
||||
|
||||
mp := make(map[string]int)
|
||||
mp["qcrao"] = 100
|
||||
mp["stefno"] = 18
|
||||
|
||||
count := **(**uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&mp)) + uintptr(16)))
|
||||
fmt.Println(count, len(mp)) // 2
|
||||
}
|
||||
|
||||
func string2bytes(s string) []byte {
|
||||
stringHeader := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
||||
|
||||
result := reflect.SliceHeader{
|
||||
Data: stringHeader.Data,
|
||||
Len: stringHeader.Len,
|
||||
Cap: stringHeader.Len,
|
||||
}
|
||||
return *(*[]byte)(unsafe.Pointer(&result))
|
||||
}
|
||||
|
||||
func TestHashX_Range(t *testing.T) {
|
||||
|
||||
reComp := regexp.MustCompile("a.+")
|
||||
require.True(t, reComp.MatchString("abbs"))
|
||||
|
||||
h := NewHashXSingle()
|
||||
h.Set("abbs", "abbs")
|
||||
h.Set("ppp", "ppp")
|
||||
h.Set("accs", "accs")
|
||||
|
||||
result := h.Range(0, 3, "")
|
||||
require.Len(t, result, 3)
|
||||
|
||||
result = h.Range(0, -1, "")
|
||||
require.Len(t, result, 3)
|
||||
|
||||
result = h.Range(0, -1, "a.+")
|
||||
require.Len(t, result, 2)
|
||||
|
||||
result = h.Range(1, -1, "a.+")
|
||||
require.Len(t, result, 1)
|
||||
}
|
||||
|
|
|
@ -8,3 +8,7 @@ message BaseKey {
|
|||
int64 ttl = 2;
|
||||
google.protobuf.Timestamp expire = 3;
|
||||
}
|
||||
|
||||
message External {
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
syntax = "proto3";
|
||||
import "base.proto";
|
||||
option go_package = "pkg/proto";
|
||||
|
||||
message SAddRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string member = 2;
|
||||
}
|
||||
|
||||
message SAddResponse {
|
||||
}
|
||||
|
||||
message SCardRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
||||
|
||||
message SCardResponse {
|
||||
int32 length = 1;
|
||||
}
|
||||
|
||||
message SDiffRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string s_keys = 2;
|
||||
}
|
||||
|
||||
message SDiffResponse {
|
||||
External e = 1;
|
||||
repeated string result = 2;
|
||||
}
|
||||
|
||||
message SDiffStoreRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string s_keys = 2;
|
||||
string save_key = 3;
|
||||
}
|
||||
|
||||
message SDiffStoreResponse {
|
||||
External e = 1; //加上 External 表示这个接口的返回值会对外调用
|
||||
}
|
||||
|
||||
message SInterRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string s_keys = 2;
|
||||
}
|
||||
|
||||
message SInterResponse {
|
||||
External e = 1;
|
||||
repeated string result = 2;
|
||||
}
|
||||
|
||||
message SInterStoreRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string s_keys = 2;
|
||||
string save_key = 3;
|
||||
}
|
||||
|
||||
message SInterStoreResponse {
|
||||
External e = 1;
|
||||
}
|
||||
|
||||
message SIsMemberRequest {
|
||||
BaseKey key = 1;
|
||||
string member = 2;
|
||||
}
|
||||
|
||||
message SIsMemberResponse {
|
||||
bool exist = 1;
|
||||
}
|
||||
|
||||
message SMoveRequest {
|
||||
BaseKey key = 1;
|
||||
string move_key = 2;
|
||||
repeated string members = 3;
|
||||
}
|
||||
|
||||
message SMoveResponse {
|
||||
External e = 1;
|
||||
}
|
||||
|
||||
message SPopRequest {
|
||||
BaseKey key = 1;
|
||||
int32 count = 2;
|
||||
}
|
||||
|
||||
message SPopResponse {
|
||||
repeated string members = 1;
|
||||
}
|
||||
|
||||
message SRemRequest {
|
||||
BaseKey key = 1;
|
||||
int32 count = 2;
|
||||
}
|
||||
|
||||
message SRemResponse {
|
||||
}
|
||||
|
||||
message SUnionRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string s_keys = 2;
|
||||
}
|
||||
|
||||
message SUnionResponse {
|
||||
External e = 1;
|
||||
repeated string result = 2;
|
||||
}
|
||||
|
||||
message SUnionStoreRequest {
|
||||
BaseKey key = 1;
|
||||
repeated string s_keys = 2;
|
||||
string save_key = 3;
|
||||
}
|
||||
|
||||
message SUnionStoreResponse {
|
||||
External e = 1;
|
||||
}
|
||||
|
||||
message SScanRequest {
|
||||
BaseKey key = 1;
|
||||
int32 cursor = 2;
|
||||
string regexp = 3;
|
||||
int32 count = 4;
|
||||
}
|
||||
|
||||
message SScanResponse {
|
||||
repeated string results = 1;
|
||||
}
|
|
@ -8,6 +8,7 @@ option go_package = "pkg/proto";
|
|||
import "stringx.proto";
|
||||
import "listx.proto";
|
||||
import "hashx.proto";
|
||||
import "setx.proto";
|
||||
|
||||
|
||||
service CommServer {
|
||||
|
@ -42,4 +43,17 @@ service CommServer {
|
|||
rpc HLen (HLenRequest) returns (HLenResponse);
|
||||
rpc HSet (HSetRequest) returns (HSetResponse);
|
||||
rpc HSetX (HSetXRequest) returns (HSetXResponse);
|
||||
rpc SAdd (SAddRequest) returns (SAddResponse);
|
||||
rpc SCard (SCardRequest) returns (SCardResponse);
|
||||
rpc SDiff (SDiffRequest) returns (SDiffResponse);
|
||||
rpc SDiffStore (SDiffStoreRequest) returns (SDiffStoreResponse);
|
||||
rpc SInter (SInterRequest) returns (SInterResponse);
|
||||
rpc SInterStore (SInterStoreRequest) returns (SInterStoreResponse);
|
||||
rpc SIsMember (SIsMemberRequest) returns (SIsMemberResponse);
|
||||
rpc SMove (SMoveRequest) returns (SMoveResponse);
|
||||
rpc SPop (SPopRequest) returns (SPopResponse);
|
||||
rpc SRem (SRemRequest) returns (SRemResponse);
|
||||
rpc SUnion (SUnionRequest) returns (SUnionResponse);
|
||||
rpc SUnionStore (SUnionStoreRequest) returns (SUnionStoreResponse);
|
||||
rpc SScan (SScanRequest) returns (SScanResponse);
|
||||
}
|
|
@ -17,6 +17,7 @@ class ProtoOption(object):
|
|||
self.method = method
|
||||
self.option = []
|
||||
self.ret = []
|
||||
self.external = False
|
||||
|
||||
def add_option(self, opt: List[str]):
|
||||
self.option.extend(opt)
|
||||
|
@ -38,10 +39,11 @@ def dist_to_ProOpt(req, resp) -> List[ProtoOption]:
|
|||
def parse_type(l: str) -> List[str]:
|
||||
l = l.strip()
|
||||
if l == "":
|
||||
return []
|
||||
return [], False
|
||||
|
||||
opt = l.split(";")
|
||||
result = []
|
||||
f = False
|
||||
for l_opt in opt:
|
||||
l_opt = l_opt.strip()
|
||||
l_list = l_opt.split()
|
||||
|
@ -62,15 +64,23 @@ def dist_to_ProOpt(req, resp) -> List[ProtoOption]:
|
|||
if len(resMap[0]) == 3:
|
||||
mapKey, mapVal, var = resMap[0]
|
||||
result.append([to_camel(var), f"map[{mapKey}]{mapVal}"])
|
||||
|
||||
elif "External" in val:
|
||||
f = True
|
||||
|
||||
else:
|
||||
result.append([to_camel(l_list[1]), val])
|
||||
return result
|
||||
return result, f
|
||||
|
||||
lists = []
|
||||
for key, value in req.items():
|
||||
p = ProtoOption(method=key)
|
||||
p.add_option(parse_type(value))
|
||||
p.add_ret(parse_type(resp.get(key, "")))
|
||||
p.add_option(parse_type(value)[0])
|
||||
|
||||
ret, e = parse_type(resp.get(key, ""))
|
||||
if e:
|
||||
p.external = True
|
||||
p.add_ret(ret)
|
||||
lists.append(p)
|
||||
return lists
|
||||
|
||||
|
|
|
@ -116,6 +116,45 @@ func (d *Dao) ExecMessage(message protobuf.Message) error {
|
|||
case *proto.StrLenRequest:
|
||||
_, err := d.StrLen(req.Key)
|
||||
return err
|
||||
case *proto.SAddRequest:
|
||||
_, err := d.SAdd(req.Key, req.Member)
|
||||
return err
|
||||
case *proto.SCardRequest:
|
||||
_, err := d.SCard(req.Key)
|
||||
return err
|
||||
case *proto.SDiffRequest:
|
||||
_, err := d.SDiff(req.Key, req.SKeys)
|
||||
return err
|
||||
case *proto.SDiffStoreRequest:
|
||||
_, err := d.SDiffStore(req.Key, req.SKeys, req.SaveKey)
|
||||
return err
|
||||
case *proto.SInterRequest:
|
||||
_, err := d.SInter(req.Key, req.SKeys)
|
||||
return err
|
||||
case *proto.SInterStoreRequest:
|
||||
_, err := d.SInterStore(req.Key, req.SKeys, req.SaveKey)
|
||||
return err
|
||||
case *proto.SIsMemberRequest:
|
||||
_, err := d.SIsMember(req.Key, req.Member)
|
||||
return err
|
||||
case *proto.SMoveRequest:
|
||||
_, err := d.SMove(req.Key, req.MoveKey, req.Members)
|
||||
return err
|
||||
case *proto.SPopRequest:
|
||||
_, err := d.SPop(req.Key, req.Count)
|
||||
return err
|
||||
case *proto.SRemRequest:
|
||||
_, err := d.SRem(req.Key, req.Count)
|
||||
return err
|
||||
case *proto.SUnionRequest:
|
||||
_, err := d.SUnion(req.Key, req.SKeys)
|
||||
return err
|
||||
case *proto.SUnionStoreRequest:
|
||||
_, err := d.SUnionStore(req.Key, req.SKeys, req.SaveKey)
|
||||
return err
|
||||
case *proto.SScanRequest:
|
||||
_, err := d.SScan(req.Key, req.Cursor, req.Regexp, req.Count)
|
||||
return err
|
||||
default:
|
||||
return errorx.New("The type that is not registered exec err")
|
||||
}
|
||||
|
|
|
@ -40,5 +40,18 @@ type Interface interface {
|
|||
GetRange(*proto.BaseKey, int32, int32) (*proto.GetRangeResponse, error)
|
||||
GetSet(*proto.BaseKey, string) (*proto.GetSetResponse, error)
|
||||
StrLen(*proto.BaseKey) (*proto.StrLenResponse, error)
|
||||
SAdd(*proto.BaseKey, []string) (*proto.SAddResponse, error)
|
||||
SCard(*proto.BaseKey) (*proto.SCardResponse, error)
|
||||
SDiff(*proto.BaseKey, []string) (interface{}, error)
|
||||
SDiffStore(*proto.BaseKey, []string, string) (interface{}, error)
|
||||
SInter(*proto.BaseKey, []string) (interface{}, error)
|
||||
SInterStore(*proto.BaseKey, []string, string) (interface{}, error)
|
||||
SIsMember(*proto.BaseKey, string) (*proto.SIsMemberResponse, error)
|
||||
SMove(*proto.BaseKey, string, []string) (interface{}, error)
|
||||
SPop(*proto.BaseKey, int32) (*proto.SPopResponse, error)
|
||||
SRem(*proto.BaseKey, int32) (*proto.SRemResponse, error)
|
||||
SUnion(*proto.BaseKey, []string) (interface{}, error)
|
||||
SUnionStore(*proto.BaseKey, []string, string) (interface{}, error)
|
||||
SScan(*proto.BaseKey, int32, string, int32) (*proto.SScanResponse, error)
|
||||
ExecMessage(message protobuf.Message) error
|
||||
}
|
||||
|
|
|
@ -0,0 +1,470 @@
|
|||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/errorx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/structure"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/structure/hashx"
|
||||
"gitee.com/wheat-os/wheatCache/storage/external"
|
||||
)
|
||||
|
||||
func (d *Dao) SAdd(key *proto.BaseKey, setVal []string) (*proto.SAddResponse, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
hashVal := hashx.NewHashXSingle()
|
||||
for _, sv := range setVal {
|
||||
hashVal.SetX(sv, sv)
|
||||
}
|
||||
d.lru.Add(key, hashVal)
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
for _, sv := range setVal {
|
||||
b, up := hashVal.SetX(sv, sv)
|
||||
if b {
|
||||
d.lru.UpdateLruSize(up)
|
||||
}
|
||||
}
|
||||
|
||||
return &proto.SAddResponse{}, nil
|
||||
}
|
||||
|
||||
func (d *Dao) SCard(key *proto.BaseKey) (*proto.SCardResponse, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
return &proto.SCardResponse{Length: int32(hashVal.Length())}, nil
|
||||
}
|
||||
|
||||
func mathSDiff(masterItem []string, extKey []string) ([]string, error) {
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m := make(map[string]struct{})
|
||||
for _, bVal := range masterItem {
|
||||
m[bVal] = struct{}{}
|
||||
}
|
||||
|
||||
setItem := make([]string, 0, len(extKey))
|
||||
ctx := context.Background()
|
||||
for _, sKey := range extKey {
|
||||
baseKey := proto.NewBaseKey(sKey)
|
||||
resp, err := cli.SScan(ctx, &proto.SScanRequest{
|
||||
Key: baseKey,
|
||||
Count: -1,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, item := range resp.Results {
|
||||
if _, ok := m[item]; !ok {
|
||||
setItem = append(setItem, item)
|
||||
m[item] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setItem, nil
|
||||
}
|
||||
|
||||
func (d *Dao) SDiff(key *proto.BaseKey, setKey []string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
baseItem := hashVal.Key()
|
||||
|
||||
// await 挂起
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
setItem, err := mathSDiff(baseItem, setKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SDiffResponse{Result: setItem}, nil
|
||||
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (d *Dao) SDiffStore(key *proto.BaseKey, setKey []string, saveKey string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
baseItem := hashVal.Key()
|
||||
|
||||
// await 挂起
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
setItem, err := mathSDiff(baseItem, setKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
_, err = cli.SAdd(ctx, &proto.SAddRequest{
|
||||
Key: proto.NewBaseKey(saveKey),
|
||||
Member: setItem,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SDiffStoreResponse{}, nil
|
||||
|
||||
}), nil
|
||||
}
|
||||
|
||||
func mathSInter(masterItem []string, extKey []string) ([]string, error) {
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m := make(map[string]struct{})
|
||||
for _, bVal := range masterItem {
|
||||
m[bVal] = struct{}{}
|
||||
}
|
||||
|
||||
setItem := make([]string, 0, len(extKey))
|
||||
ctx := context.Background()
|
||||
for _, sKey := range extKey {
|
||||
|
||||
resp, err := cli.SScan(ctx, &proto.SScanRequest{
|
||||
Key: proto.NewBaseKey(sKey),
|
||||
Count: -1,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, item := range resp.Results {
|
||||
if _, ok := m[item]; ok {
|
||||
setItem = append(setItem, item)
|
||||
delete(m, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setItem, nil
|
||||
}
|
||||
|
||||
func (d *Dao) SInter(key *proto.BaseKey, setKey []string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
baseItem := hashVal.Key()
|
||||
|
||||
// await 挂起
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
setItem, err := mathSInter(baseItem, setKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SInterResponse{Result: setItem}, nil
|
||||
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (d *Dao) SInterStore(key *proto.BaseKey, setKey []string, saveKey string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
baseItem := hashVal.Key()
|
||||
|
||||
// await 挂起
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
setItem, err := mathSInter(baseItem, setKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
_, err = cli.SAdd(ctx, &proto.SAddRequest{
|
||||
Key: proto.NewBaseKey(saveKey),
|
||||
Member: setItem,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SInterStoreResponse{}, nil
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (d *Dao) SIsMember(key *proto.BaseKey, member string) (*proto.SIsMemberResponse, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
_, err := hashVal.Get(member)
|
||||
if err != nil {
|
||||
return &proto.SIsMemberResponse{Exist: false}, nil
|
||||
}
|
||||
|
||||
return &proto.SIsMemberResponse{Exist: true}, nil
|
||||
}
|
||||
|
||||
func (d *Dao) SMove(key *proto.BaseKey, moveKey string, members []string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
moveMembers := make([]string, 0, len(members))
|
||||
for _, member := range members {
|
||||
up, err := hashVal.Del(member)
|
||||
if err == nil {
|
||||
d.lru.UpdateLruSize(up)
|
||||
moveMembers = append(moveMembers, member)
|
||||
}
|
||||
}
|
||||
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
_, err = cli.SAdd(ctx, &proto.SAddRequest{
|
||||
Key: proto.NewBaseKey(moveKey),
|
||||
Member: moveMembers,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SMoveResponse{}, nil
|
||||
}), nil
|
||||
|
||||
}
|
||||
|
||||
func (d *Dao) SPop(key *proto.BaseKey, count int32) (*proto.SPopResponse, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
members := make([]string, 0, count)
|
||||
|
||||
result := hashVal.Range(0, int(count), "")
|
||||
for _, res := range result {
|
||||
up, err := hashVal.Del(res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d.lru.UpdateLruSize(up)
|
||||
members = append(members, res)
|
||||
}
|
||||
|
||||
return &proto.SPopResponse{Members: members}, nil
|
||||
}
|
||||
|
||||
func (d *Dao) SRem(key *proto.BaseKey, count int32) (*proto.SRemResponse, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
result := hashVal.Range(0, int(count), "")
|
||||
for _, res := range result {
|
||||
up, err := hashVal.Del(res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d.lru.UpdateLruSize(up)
|
||||
}
|
||||
|
||||
return &proto.SRemResponse{}, nil
|
||||
}
|
||||
|
||||
func mathSUnion(masterItem []string, extKey []string) ([]string, error) {
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m := make(map[string]struct{})
|
||||
for _, bVal := range masterItem {
|
||||
m[bVal] = struct{}{}
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
for _, sKey := range extKey {
|
||||
|
||||
resp, err := cli.SScan(ctx, &proto.SScanRequest{
|
||||
Key: proto.NewBaseKey(sKey),
|
||||
Count: -1,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, item := range resp.Results {
|
||||
if _, ok := m[item]; !ok {
|
||||
masterItem = append(masterItem, item)
|
||||
m[item] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return masterItem, nil
|
||||
}
|
||||
|
||||
func (d *Dao) SUnion(key *proto.BaseKey, setKey []string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
baseItem := hashVal.Key()
|
||||
|
||||
// await 挂起
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
setItem, err := mathSUnion(baseItem, setKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SUnionResponse{Result: setItem}, nil
|
||||
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (d *Dao) SUnionStore(key *proto.BaseKey, setKey []string, saveKey string) (interface{}, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
baseItem := hashVal.Key()
|
||||
|
||||
// await 挂起
|
||||
return event2.EventAwaitFunc(func() (interface{}, error) {
|
||||
setItem, err := mathSUnion(baseItem, setKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cli, err := external.NewGatewayClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
_, err = cli.SAdd(ctx, &proto.SAddRequest{
|
||||
Key: proto.NewBaseKey(saveKey),
|
||||
Member: setItem,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.SUnionStoreResponse{}, nil
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (d *Dao) SScan(key *proto.BaseKey, cursor int32, regex string, count int32) (*proto.SScanResponse, error) {
|
||||
value, ok := d.lru.Get(key)
|
||||
if !ok {
|
||||
return nil, errorx.KeyBaseIsNilErr()
|
||||
}
|
||||
|
||||
hashVal, ok := value.(structure.HashXInterface)
|
||||
if !ok {
|
||||
return nil, errorx.DaoTypeErr("setx")
|
||||
}
|
||||
|
||||
result := hashVal.Range(int(cursor), int(count), regex)
|
||||
return &proto.SScanResponse{Results: result}, nil
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package external
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
oneGatewayClient sync.Once
|
||||
gatewayClient proto.CommServerClient
|
||||
)
|
|
@ -0,0 +1,24 @@
|
|||
package external
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/client"
|
||||
"gitee.com/wheat-os/wheatCache/client/middle"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
)
|
||||
|
||||
func NewGatewayClient() (proto.CommServerClient, error) {
|
||||
oneGatewayClient.Do(func() {
|
||||
cli, err := client.NewWheatClient("127.0.0.1:5891", middle.WithUnaryColonyClient)
|
||||
if err == nil {
|
||||
gatewayClient = cli
|
||||
}
|
||||
})
|
||||
|
||||
if gatewayClient != nil {
|
||||
return gatewayClient, nil
|
||||
}
|
||||
|
||||
return nil, errors.New("get gateway err")
|
||||
}
|
|
@ -110,6 +110,32 @@ func decode(method string, buf []byte) (protobuf.Message, error) {
|
|||
return decodeGetSet(buf)
|
||||
case "StrLen":
|
||||
return decodeStrLen(buf)
|
||||
case "SAdd":
|
||||
return decodeSAdd(buf)
|
||||
case "SCard":
|
||||
return decodeSCard(buf)
|
||||
case "SDiff":
|
||||
return decodeSDiff(buf)
|
||||
case "SDiffStore":
|
||||
return decodeSDiffStore(buf)
|
||||
case "SInter":
|
||||
return decodeSInter(buf)
|
||||
case "SInterStore":
|
||||
return decodeSInterStore(buf)
|
||||
case "SIsMember":
|
||||
return decodeSIsMember(buf)
|
||||
case "SMove":
|
||||
return decodeSMove(buf)
|
||||
case "SPop":
|
||||
return decodeSPop(buf)
|
||||
case "SRem":
|
||||
return decodeSRem(buf)
|
||||
case "SUnion":
|
||||
return decodeSUnion(buf)
|
||||
case "SUnionStore":
|
||||
return decodeSUnionStore(buf)
|
||||
case "SScan":
|
||||
return decodeSScan(buf)
|
||||
|
||||
}
|
||||
|
||||
|
@ -394,3 +420,120 @@ func decodeStrLen(buf []byte) (*proto.StrLenRequest, error) {
|
|||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSAdd(buf []byte) (*proto.SAddRequest, error) {
|
||||
req := &proto.SAddRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSCard(buf []byte) (*proto.SCardRequest, error) {
|
||||
req := &proto.SCardRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSDiff(buf []byte) (*proto.SDiffRequest, error) {
|
||||
req := &proto.SDiffRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSDiffStore(buf []byte) (*proto.SDiffStoreRequest, error) {
|
||||
req := &proto.SDiffStoreRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSInter(buf []byte) (*proto.SInterRequest, error) {
|
||||
req := &proto.SInterRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSInterStore(buf []byte) (*proto.SInterStoreRequest, error) {
|
||||
req := &proto.SInterStoreRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSIsMember(buf []byte) (*proto.SIsMemberRequest, error) {
|
||||
req := &proto.SIsMemberRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSMove(buf []byte) (*proto.SMoveRequest, error) {
|
||||
req := &proto.SMoveRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSPop(buf []byte) (*proto.SPopRequest, error) {
|
||||
req := &proto.SPopRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSRem(buf []byte) (*proto.SRemRequest, error) {
|
||||
req := &proto.SRemRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSUnion(buf []byte) (*proto.SUnionRequest, error) {
|
||||
req := &proto.SUnionRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSUnionStore(buf []byte) (*proto.SUnionStoreRequest, error) {
|
||||
req := &proto.SUnionStoreRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func decodeSScan(buf []byte) (*proto.SScanRequest, error) {
|
||||
req := &proto.SScanRequest{}
|
||||
err := protobuf.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/logx"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/lru"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/middle"
|
||||
|
@ -18,7 +19,7 @@ import (
|
|||
|
||||
type singleService struct {
|
||||
middleProduce event.ProduceInterface
|
||||
lruProduce event.ProduceInterface
|
||||
lruProduce event2.ProduceInterface
|
||||
timeOut time.Duration
|
||||
lruCache *lru.SingleCache
|
||||
dao dao.Interface
|
||||
|
@ -100,7 +101,7 @@ func NewSingleServer() proto.CommServerServer {
|
|||
|
||||
ser := &singleService{
|
||||
lruCache: lruCache,
|
||||
lruProduce: event.NewProduce(lruCache.GetDriver()),
|
||||
lruProduce: event2.NewProduce(lruCache.GetDriver()),
|
||||
timeOut: time.Duration(timeOut) * time.Second,
|
||||
dao: dao,
|
||||
middleProduce: event.NewProduce(middle.NewMiddleWare().GetEventDriver()),
|
||||
|
|
|
@ -5,7 +5,7 @@ package service
|
|||
import (
|
||||
context "context"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/lru"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ func (s *singleService) LIndex(
|
|||
ctx context.Context,
|
||||
req *proto.LIndexRequest,
|
||||
) (*proto.LIndexResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LIndex(req.Key, req.Index)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -27,10 +27,10 @@ func (s *singleService) LIndex(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ func (s *singleService) LLen(
|
|||
ctx context.Context,
|
||||
req *proto.LLenRequest,
|
||||
) (*proto.LLenResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LLen(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -55,10 +55,10 @@ func (s *singleService) LLen(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ func (s *singleService) LPop(
|
|||
ctx context.Context,
|
||||
req *proto.LPopRequest,
|
||||
) (*proto.LPopResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LPop(req.Key, req.Count)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -83,10 +83,10 @@ func (s *singleService) LPop(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ func (s *singleService) LPush(
|
|||
ctx context.Context,
|
||||
req *proto.LPushRequest,
|
||||
) (*proto.LPushResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LPush(req.Key, req.Values)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -111,10 +111,10 @@ func (s *singleService) LPush(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func (s *singleService) LPushX(
|
|||
ctx context.Context,
|
||||
req *proto.LPushXRequest,
|
||||
) (*proto.LPushXResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LPushX(req.Key, req.Values)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -139,10 +139,10 @@ func (s *singleService) LPushX(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ func (s *singleService) LRange(
|
|||
ctx context.Context,
|
||||
req *proto.LRangeRequest,
|
||||
) (*proto.LRangeResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LRange(req.Key, req.Start, req.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -167,10 +167,10 @@ func (s *singleService) LRange(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ func (s *singleService) LRem(
|
|||
ctx context.Context,
|
||||
req *proto.LRemRequest,
|
||||
) (*proto.LRemResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LRem(req.Key, req.Count, req.Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -195,10 +195,10 @@ func (s *singleService) LRem(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ func (s *singleService) LSet(
|
|||
ctx context.Context,
|
||||
req *proto.LSetRequest,
|
||||
) (*proto.LSetResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LSet(req.Key, req.Index, req.Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -223,10 +223,10 @@ func (s *singleService) LSet(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ func (s *singleService) RPop(
|
|||
ctx context.Context,
|
||||
req *proto.RPopRequest,
|
||||
) (*proto.RPopResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.RPop(req.Key, req.Count)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -251,10 +251,10 @@ func (s *singleService) RPop(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ func (s *singleService) LTrim(
|
|||
ctx context.Context,
|
||||
req *proto.LTrimRequest,
|
||||
) (*proto.LTrimResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.LTrim(req.Key, req.Start, req.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -279,10 +279,10 @@ func (s *singleService) LTrim(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ func (s *singleService) RPush(
|
|||
ctx context.Context,
|
||||
req *proto.RPushRequest,
|
||||
) (*proto.RPushResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.RPush(req.Key, req.Values)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -307,10 +307,10 @@ func (s *singleService) RPush(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ func (s *singleService) RPushX(
|
|||
ctx context.Context,
|
||||
req *proto.RPushXRequest,
|
||||
) (*proto.RPushXResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.RPushX(req.Key, req.Values)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -335,10 +335,10 @@ func (s *singleService) RPushX(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ func (s *singleService) HDel(
|
|||
ctx context.Context,
|
||||
req *proto.HDelRequest,
|
||||
) (*proto.HDelResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HDel(req.Key, req.HKeys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -363,10 +363,10 @@ func (s *singleService) HDel(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ func (s *singleService) HExists(
|
|||
ctx context.Context,
|
||||
req *proto.HExistsRequest,
|
||||
) (*proto.HExistsResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HExists(req.Key, req.HKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -391,10 +391,10 @@ func (s *singleService) HExists(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ func (s *singleService) HGet(
|
|||
ctx context.Context,
|
||||
req *proto.HGetRequest,
|
||||
) (*proto.HGetResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HGet(req.Key, req.HKeys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -419,10 +419,10 @@ func (s *singleService) HGet(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ func (s *singleService) HGetAll(
|
|||
ctx context.Context,
|
||||
req *proto.HGetAllRequest,
|
||||
) (*proto.HGetAllResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HGetAll(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -447,10 +447,10 @@ func (s *singleService) HGetAll(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ func (s *singleService) HIncrBy(
|
|||
ctx context.Context,
|
||||
req *proto.HIncrByRequest,
|
||||
) (*proto.HIncrByResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HIncrBy(req.Key, req.HKeys, req.Renewal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -475,10 +475,10 @@ func (s *singleService) HIncrBy(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ func (s *singleService) HKeys(
|
|||
ctx context.Context,
|
||||
req *proto.HKeysRequest,
|
||||
) (*proto.HKeysResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HKeys(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -503,10 +503,10 @@ func (s *singleService) HKeys(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ func (s *singleService) HLen(
|
|||
ctx context.Context,
|
||||
req *proto.HLenRequest,
|
||||
) (*proto.HLenResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HLen(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -531,10 +531,10 @@ func (s *singleService) HLen(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ func (s *singleService) HSet(
|
|||
ctx context.Context,
|
||||
req *proto.HSetRequest,
|
||||
) (*proto.HSetResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HSet(req.Key, req.Items)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -559,10 +559,10 @@ func (s *singleService) HSet(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ func (s *singleService) HSetX(
|
|||
ctx context.Context,
|
||||
req *proto.HSetXRequest,
|
||||
) (*proto.HSetXResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.HSetX(req.Key, req.Items)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -587,10 +587,10 @@ func (s *singleService) HSetX(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ func (s *singleService) Set(
|
|||
ctx context.Context,
|
||||
req *proto.SetRequest,
|
||||
) (*proto.SetResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.Set(req.Key, req.Val)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -615,10 +615,10 @@ func (s *singleService) Set(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ func (s *singleService) Get(
|
|||
ctx context.Context,
|
||||
req *proto.GetRequest,
|
||||
) (*proto.GetResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.Get(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -643,10 +643,10 @@ func (s *singleService) Get(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ func (s *singleService) Add(
|
|||
ctx context.Context,
|
||||
req *proto.AddRequest,
|
||||
) (*proto.AddResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.Add(req.Key, req.Renewal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -671,10 +671,10 @@ func (s *singleService) Add(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ func (s *singleService) Reduce(
|
|||
ctx context.Context,
|
||||
req *proto.ReduceRequest,
|
||||
) (*proto.ReduceResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.Reduce(req.Key, req.Renewal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -699,10 +699,10 @@ func (s *singleService) Reduce(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ func (s *singleService) Setnx(
|
|||
ctx context.Context,
|
||||
req *proto.SetnxRequest,
|
||||
) (*proto.SetnxResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.Setnx(req.Key, req.Val)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -727,10 +727,10 @@ func (s *singleService) Setnx(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ func (s *singleService) SetBit(
|
|||
ctx context.Context,
|
||||
req *proto.SetBitRequest,
|
||||
) (*proto.SetBitResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SetBit(req.Key, req.Val, req.Offer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -755,10 +755,10 @@ func (s *singleService) SetBit(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ func (s *singleService) GetBit(
|
|||
ctx context.Context,
|
||||
req *proto.GetBitRequest,
|
||||
) (*proto.GetBitResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.GetBit(req.Key, req.Offer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -783,10 +783,10 @@ func (s *singleService) GetBit(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ func (s *singleService) GetRange(
|
|||
ctx context.Context,
|
||||
req *proto.GetRangeRequest,
|
||||
) (*proto.GetRangeResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.GetRange(req.Key, req.Start, req.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -811,10 +811,10 @@ func (s *singleService) GetRange(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ func (s *singleService) GetSet(
|
|||
ctx context.Context,
|
||||
req *proto.GetSetRequest,
|
||||
) (*proto.GetSetResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.GetSet(req.Key, req.Val)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -839,10 +839,10 @@ func (s *singleService) GetSet(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ func (s *singleService) StrLen(
|
|||
ctx context.Context,
|
||||
req *proto.StrLenRequest,
|
||||
) (*proto.StrLenResponse, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.StrLen(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -867,13 +867,377 @@ func (s *singleService) StrLen(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.StrLenResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SAdd(
|
||||
ctx context.Context,
|
||||
req *proto.SAddRequest,
|
||||
) (*proto.SAddResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SAdd(req.Key, req.Member)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SAdd", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SAddResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SCard(
|
||||
ctx context.Context,
|
||||
req *proto.SCardRequest,
|
||||
) (*proto.SCardResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SCard(req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SCard", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SCardResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SDiff(
|
||||
ctx context.Context,
|
||||
req *proto.SDiffRequest,
|
||||
) (*proto.SDiffResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SDiff(req.Key, req.SKeys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SDiff", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SDiffResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SDiffStore(
|
||||
ctx context.Context,
|
||||
req *proto.SDiffStoreRequest,
|
||||
) (*proto.SDiffStoreResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SDiffStore(req.Key, req.SKeys, req.SaveKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SDiffStore", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SDiffStoreResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SInter(
|
||||
ctx context.Context,
|
||||
req *proto.SInterRequest,
|
||||
) (*proto.SInterResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SInter(req.Key, req.SKeys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SInter", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SInterResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SInterStore(
|
||||
ctx context.Context,
|
||||
req *proto.SInterStoreRequest,
|
||||
) (*proto.SInterStoreResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SInterStore(req.Key, req.SKeys, req.SaveKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SInterStore", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SInterStoreResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SIsMember(
|
||||
ctx context.Context,
|
||||
req *proto.SIsMemberRequest,
|
||||
) (*proto.SIsMemberResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SIsMember(req.Key, req.Member)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SIsMember", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SIsMemberResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SMove(
|
||||
ctx context.Context,
|
||||
req *proto.SMoveRequest,
|
||||
) (*proto.SMoveResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SMove(req.Key, req.MoveKey, req.Members)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SMove", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SMoveResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SPop(
|
||||
ctx context.Context,
|
||||
req *proto.SPopRequest,
|
||||
) (*proto.SPopResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SPop(req.Key, req.Count)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SPop", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SPopResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SRem(
|
||||
ctx context.Context,
|
||||
req *proto.SRemRequest,
|
||||
) (*proto.SRemResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SRem(req.Key, req.Count)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SRem", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SRemResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SUnion(
|
||||
ctx context.Context,
|
||||
req *proto.SUnionRequest,
|
||||
) (*proto.SUnionResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SUnion(req.Key, req.SKeys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SUnion", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SUnionResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SUnionStore(
|
||||
ctx context.Context,
|
||||
req *proto.SUnionStoreRequest,
|
||||
) (*proto.SUnionStoreResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SUnionStore(req.Key, req.SKeys, req.SaveKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SUnionStore", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SUnionStoreResponse), nil
|
||||
}
|
||||
|
||||
func (s *singleService) SScan(
|
||||
ctx context.Context,
|
||||
req *proto.SScanRequest,
|
||||
) (*proto.SScanResponse, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.SScan(req.Key, req.Cursor, req.Regexp, req.Count)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.aof != nil {
|
||||
s.aof.SendRequest("SScan", req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*proto.SScanResponse), nil
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ const (
|
|||
STRING_X
|
||||
LIST_X
|
||||
HASH_X
|
||||
SET_X
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -44,6 +45,19 @@ const (
|
|||
HLen
|
||||
HSet
|
||||
HSetX
|
||||
SAdd
|
||||
SCard
|
||||
SDiff
|
||||
SDiffStore
|
||||
SInter
|
||||
SInterStore
|
||||
SIsMember
|
||||
SMove
|
||||
SPop
|
||||
SRem
|
||||
SUnion
|
||||
SUnionStore
|
||||
SScan
|
||||
)
|
||||
|
||||
var CommKeyString = map[string]int{
|
||||
|
@ -80,6 +94,20 @@ var CommKeyString = map[string]int{
|
|||
"HLen": HASH_X,
|
||||
"HSet": HASH_X,
|
||||
"HSetX": HASH_X,
|
||||
|
||||
"SAdd": SET_X,
|
||||
"SCard": SET_X,
|
||||
"SDiff": SET_X,
|
||||
"SDiffStore": SET_X,
|
||||
"SInter": SET_X,
|
||||
"SInterStore": SET_X,
|
||||
"SIsMember": SET_X,
|
||||
"SMove": SET_X,
|
||||
"SPop": SET_X,
|
||||
"SRem": SET_X,
|
||||
"SUnion": SET_X,
|
||||
"SUnionStore": SET_X,
|
||||
"SScan": SET_X,
|
||||
}
|
||||
|
||||
var CommKey = map[int]int{
|
||||
|
@ -116,4 +144,18 @@ var CommKey = map[int]int{
|
|||
HLen: HASH_X,
|
||||
HSet: HASH_X,
|
||||
HSetX: HASH_X,
|
||||
|
||||
SAdd: SET_X,
|
||||
SCard: SET_X,
|
||||
SDiff: SET_X,
|
||||
SDiffStore: SET_X,
|
||||
SInter: SET_X,
|
||||
SInterStore: SET_X,
|
||||
SIsMember: SET_X,
|
||||
SMove: SET_X,
|
||||
SPop: SET_X,
|
||||
SRem: SET_X,
|
||||
SUnion: SET_X,
|
||||
SUnionStore: SET_X,
|
||||
SScan: SET_X,
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
type Interface interface {
|
||||
{%for key in keys %}
|
||||
{{key.method}}({% for req in key.option %} {{req[1]}}, {% endfor %}) (*proto.{{key.method}}Response, error)
|
||||
{{key.method}}({% for req in key.option %} {{req[1]}}, {% endfor %}) ({% if key.external == False %} *proto.{{key.method}}Response {% else %} interface{} {% endif %}, error)
|
||||
{%- endfor %}
|
||||
ExecMessage(message protobuf.Message) error
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package service
|
|||
import (
|
||||
context "context"
|
||||
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/event2"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/lru"
|
||||
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ func (s *singleService) {{key.method}}(
|
|||
ctx context.Context,
|
||||
req *proto.{{key.method}}Request,
|
||||
) (*proto.{{key.method}}Response, error) {
|
||||
work := event.EventWorkFunc(func() (interface{}, error) {
|
||||
work := event2.EventWorkFunc(func() (interface{}, error) {
|
||||
resp, err := s.dao.{{key.method}}({% for opt in key.option %}req.{{opt[0]}}, {% endfor %})
|
||||
if err != nil{
|
||||
return nil, err
|
||||
|
@ -28,10 +28,10 @@ func (s *singleService) {{key.method}}(
|
|||
|
||||
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||||
lruEvent.InitWaitEvent()
|
||||
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||||
lruEvent.SetValue(event2.WorkFuncEventKey, work)
|
||||
s.lruProduce.Call(ctx, lruEvent)
|
||||
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||||
s.lruProduce.Recovery(lruEvent)
|
||||
lruEvent.Recovery()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -37,3 +37,18 @@ HASH_X:
|
|||
- h_len
|
||||
- h_set
|
||||
- h_set_x
|
||||
|
||||
SET_X:
|
||||
- s_add
|
||||
- s_card
|
||||
- s_diff
|
||||
- s_diff_store
|
||||
- s_inter
|
||||
- s_inter_store
|
||||
- s_is_member
|
||||
- s_move
|
||||
- s_pop
|
||||
- s_rem
|
||||
- s_union
|
||||
- s_union_store
|
||||
- s_scan
|
Loading…
Reference in New Issue