forked from p93542168/wheat-cache
474 lines
12 KiB
Go
474 lines
12 KiB
Go
|
// Code generated by gen-struct. DO NOT EDIT.
|
||
|
// make gen-service generated
|
||
|
package service
|
||
|
|
||
|
import (
|
||
|
context "context"
|
||
|
|
||
|
"gitee.com/timedb/wheatCache/pkg/event"
|
||
|
"gitee.com/timedb/wheatCache/pkg/lru"
|
||
|
"gitee.com/timedb/wheatCache/pkg/proto"
|
||
|
)
|
||
|
|
||
|
func (s *singleService) LIndex(
|
||
|
ctx context.Context,
|
||
|
req *proto.LIndexRequest,
|
||
|
) (*proto.LIndexResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LIndex(req.Key, req.Index)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LIndexResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LLen(
|
||
|
ctx context.Context,
|
||
|
req *proto.LLenRequest,
|
||
|
) (*proto.LLenResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LLen(req.Key)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LLenResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LPop(
|
||
|
ctx context.Context,
|
||
|
req *proto.LPopRequest,
|
||
|
) (*proto.LPopResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LPop(req.Key, req.Count)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LPopResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LPush(
|
||
|
ctx context.Context,
|
||
|
req *proto.LPushRequest,
|
||
|
) (*proto.LPushResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LPush(req.Key, req.Values)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LPushResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LPushX(
|
||
|
ctx context.Context,
|
||
|
req *proto.LPushXRequest,
|
||
|
) (*proto.LPushXResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LPushX(req.Key, req.Values)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LPushXResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LRange(
|
||
|
ctx context.Context,
|
||
|
req *proto.LRangeRequest,
|
||
|
) (*proto.LRangeResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LRange(req.Key, req.Start, req.End)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LRangeResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LRem(
|
||
|
ctx context.Context,
|
||
|
req *proto.LRemRequest,
|
||
|
) (*proto.LRemResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LRem(req.Key, req.Count, req.Value)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LRemResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LSet(
|
||
|
ctx context.Context,
|
||
|
req *proto.LSetRequest,
|
||
|
) (*proto.LSetResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LSet(req.Key, req.Index, req.Value)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LSetResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) RPop(
|
||
|
ctx context.Context,
|
||
|
req *proto.RPopRequest,
|
||
|
) (*proto.RPopResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.RPop(req.Key, req.Count)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.RPopResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) LTrim(
|
||
|
ctx context.Context,
|
||
|
req *proto.LTrimRequest,
|
||
|
) (*proto.LTrimResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.LTrim(req.Key, req.Start, req.End)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.LTrimResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) RPush(
|
||
|
ctx context.Context,
|
||
|
req *proto.RPushRequest,
|
||
|
) (*proto.RPushResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.RPush(req.Key, req.Values)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.RPushResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) RPushX(
|
||
|
ctx context.Context,
|
||
|
req *proto.RPushXRequest,
|
||
|
) (*proto.RPushXResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.RPushX(req.Key, req.Values)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.RPushXResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) Set(
|
||
|
ctx context.Context,
|
||
|
req *proto.SetRequest,
|
||
|
) (*proto.SetResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.Set(req.Key, req.Val)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.SetResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) Get(
|
||
|
ctx context.Context,
|
||
|
req *proto.GetRequest,
|
||
|
) (*proto.GetResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.Get(req.Key)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.GetResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) Add(
|
||
|
ctx context.Context,
|
||
|
req *proto.AddRequest,
|
||
|
) (*proto.AddResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.Add(req.Key, req.Renewal)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.AddResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) Reduce(
|
||
|
ctx context.Context,
|
||
|
req *proto.ReduceRequest,
|
||
|
) (*proto.ReduceResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.Reduce(req.Key, req.Renewal)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.ReduceResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) Setnx(
|
||
|
ctx context.Context,
|
||
|
req *proto.SetnxRequest,
|
||
|
) (*proto.SetnxResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.Setnx(req.Key, req.Val)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.SetnxResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) SetBit(
|
||
|
ctx context.Context,
|
||
|
req *proto.SetBitRequest,
|
||
|
) (*proto.SetBitResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.SetBit(req.Key, req.Val, req.Offer)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.SetBitResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) GetBit(
|
||
|
ctx context.Context,
|
||
|
req *proto.GetBitRequest,
|
||
|
) (*proto.GetBitResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.GetBit(req.Key, req.Offer)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.GetBitResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) GetRange(
|
||
|
ctx context.Context,
|
||
|
req *proto.GetRangeRequest,
|
||
|
) (*proto.GetRangeResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.GetRange(req.Key, req.Start, req.End)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.GetRangeResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) GetSet(
|
||
|
ctx context.Context,
|
||
|
req *proto.GetSetRequest,
|
||
|
) (*proto.GetSetResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.GetSet(req.Key, req.Val)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.GetSetResponse), nil
|
||
|
}
|
||
|
|
||
|
func (s *singleService) StrLen(
|
||
|
ctx context.Context,
|
||
|
req *proto.StrLenRequest,
|
||
|
) (*proto.StrLenResponse, error) {
|
||
|
work := event.EventWorkFunc(func() (interface{}, error) {
|
||
|
return s.dao.StrLen(req.Key)
|
||
|
})
|
||
|
|
||
|
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
|
||
|
lruEvent.InitWaitEvent()
|
||
|
lruEvent.SetValue(lru.WorkFuncEventKey, work)
|
||
|
s.lruProduce.Call(ctx, lruEvent)
|
||
|
resp, err := lruEvent.StartWaitEvent(s.timeOut)
|
||
|
s.lruProduce.Recovery(lruEvent)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return resp.(*proto.StrLenResponse), nil
|
||
|
}
|