Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
refactor: refactor by cr
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuLiangWang committed Mar 30, 2023
1 parent 5914044 commit 2ac676b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/AlekSi/gocov-xml v1.0.0
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230116070525-9430fe7d3219
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230330101212-9add015b62cf
github.com/axw/gocov v1.1.0
github.com/caarlos0/env/v6 v6.10.1
github.com/julienschmidt/httprouter v1.3.0
Expand All @@ -26,6 +26,7 @@ require (

require (
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/CeresDB/ceresdbproto v1.0.1-0.20230330101212-9add015b62cf // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CeresDB/ceresdbproto v1.0.1-0.20230330080500-1c3bf4e803ef h1:uWHypLA/6JxWGMYY/ohQgQq9j9CgMOJaQTnh3YErQCQ=
github.com/CeresDB/ceresdbproto v1.0.1-0.20230330080500-1c3bf4e803ef/go.mod h1:6qWvbMz3dvjcyKVZkg1L/yKb6OrD8r+/rk5Q1GWhyWQ=
github.com/CeresDB/ceresdbproto v1.0.1-0.20230330101212-9add015b62cf h1:RZqP97cwSEW1bg0K/cB9jfwXjY7ykiEd25hl6YgzlQY=
github.com/CeresDB/ceresdbproto v1.0.1-0.20230330101212-9add015b62cf/go.mod h1:6qWvbMz3dvjcyKVZkg1L/yKb6OrD8r+/rk5Q1GWhyWQ=
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230116070525-9430fe7d3219 h1:xI3o/UcsSX0S15+NXhhOnoY0tNvlxgBo3g1inXxhmrU=
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230116070525-9430fe7d3219/go.mod h1:qLTh6jtSu2ZLIFsU3iiDIKvkrQvyY/Csg6Mk0Ub0QZ4=
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230330080500-1c3bf4e803ef h1:LkT/saqReicelzVPfUcF23kEkJ14cWMi4LBaQ0X/ag8=
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230330080500-1c3bf4e803ef/go.mod h1:qLTh6jtSu2ZLIFsU3iiDIKvkrQvyY/Csg6Mk0Ub0QZ4=
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230330101212-9add015b62cf h1:WOLpPZuC5azSCxEyiZ236PMxUXgluGM7u8PwIK6yLXA=
github.com/CeresDB/ceresdbproto/golang v0.0.0-20230330101212-9add015b62cf/go.mod h1:qLTh6jtSu2ZLIFsU3iiDIKvkrQvyY/Csg6Mk0Ub0QZ4=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down
12 changes: 6 additions & 6 deletions server/coordinator/watch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ package coordinator
import (
"context"
"fmt"
"github.com/CeresDB/ceresdbproto/golang/pkg/metaeventpb"
"google.golang.org/protobuf/proto"
"strconv"
"strings"
"sync"

"github.com/CeresDB/ceresdbproto/golang/pkg/metaeventpb"
"github.com/CeresDB/ceresmeta/pkg/log"
"github.com/CeresDB/ceresmeta/server/storage"
"github.com/pkg/errors"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
)

const (
Expand Down Expand Up @@ -75,7 +75,7 @@ func (w *ShardWatch) Start(ctx context.Context) error {
return nil
}

func (w *ShardWatch) Stop(ctx context.Context) error {
func (w *ShardWatch) Stop(_ context.Context) error {
w.lock.Lock()
defer w.lock.Unlock()

Expand Down Expand Up @@ -165,9 +165,9 @@ func encodeShardKey(rootPath string, shardPath string, shardID uint64) string {
return strings.Join([]string{shardKeyPrefix, strconv.FormatUint(shardID, 10)}, keySep)
}

func convertShardLockValueToPB(value []byte) (metaeventpb.ShardLockValue, error) {
shardLockValue := metaeventpb.ShardLockValue{}
if err := proto.Unmarshal(value, &shardLockValue); err != nil {
func convertShardLockValueToPB(value []byte) (*metaeventpb.ShardLockValue, error) {
shardLockValue := &metaeventpb.ShardLockValue{}
if err := proto.Unmarshal(value, shardLockValue); err != nil {
return shardLockValue, errors.WithMessage(err, "unmarshal shardLockValue failed")
}
return shardLockValue, nil
Expand Down
4 changes: 2 additions & 2 deletions server/coordinator/watch/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ package coordinator

import (
"context"
"github.com/CeresDB/ceresdbproto/golang/pkg/metaeventpb"
"google.golang.org/protobuf/proto"
"testing"
"time"

"github.com/CeresDB/ceresdbproto/golang/pkg/metaeventpb"
"github.com/CeresDB/ceresmeta/server/etcdutil"
"github.com/CeresDB/ceresmeta/server/storage"
"github.com/stretchr/testify/require"
clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/protobuf/proto"
)

const (
Expand Down

0 comments on commit 2ac676b

Please sign in to comment.