12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package impl
- import (
- "google.golang.org/grpc"
- "smart-log/pb"
- "context"
- "smart-log/pb/v1"
- "smart-log/impl/v1/operation_log"
- "github.com/jaryhe/gopkgs/tasker/rpctasker"
- )
- // 具体实现
- type Rcvr struct {
- }
- func Register(s *grpc.Server) {
- pb.RegisterSmartSiteLogServer(s, &Rcvr{})
- }
- func (c *Rcvr) LogAdd(ctx context.Context, req *v1.LogAddRequest) (reply *v1.LogAddReply, err error) {
- t1 := func() error {
- reply, err = operation_log.LogAdd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) LogList(ctx context.Context, req *v1.LogListRequest) (reply *v1.LogListReply, err error) {
- t1 := func() error {
- reply, err = operation_log.LogList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
|