Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename proto roachpb #2680

Merged
merged 9 commits into from
Sep 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ check:
@echo "checking for tabs in shell scripts"
@! git grep -F ' ' -- '*.sh'
@echo "checking for forbidden imports"
@! go list -f '{{ $$ip := .ImportPath }}{{ range .Imports}}{{ $$ip }}: {{ println . }}{{end}}' $(PKG) | grep -E ' (path|log)$$' | grep -Ev '(base|security|sql/driver|util/(log|stop)): log$$'
@! go list -f '{{ $$ip := .ImportPath }}{{ range .Imports}}{{ $$ip }}: {{ println . }}{{end}}' $(PKG) | \
grep -E ' (golang/protobuf/proto|log|path)$$' | \
grep -Ev '(base|security|sql/driver|util/(log|stop)): log$$'
@echo "errcheck"
@errcheck -ignore 'bytes:Write.*,io:Close,net:Close,net/http:Close,net/rpc:Close,os:Close,database/sql:Close' $(PKG)
@echo "vet"
Expand Down
6 changes: 3 additions & 3 deletions acceptance/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import (
"github.com/cockroachdb/cockroach/acceptance/localcluster"
"github.com/cockroachdb/cockroach/client"
"github.com/cockroachdb/cockroach/keys"
"github.com/cockroachdb/cockroach/proto"
"github.com/cockroachdb/cockroach/roachpb"
"github.com/cockroachdb/cockroach/util"
"github.com/cockroachdb/cockroach/util/log"
)

func countRangeReplicas(db *client.DB) (int, error) {
desc := &proto.RangeDescriptor{}
if err := db.GetProto(keys.RangeDescriptorKey(proto.KeyMin), desc); err != nil {
desc := &roachpb.RangeDescriptor{}
if err := db.GetProto(keys.RangeDescriptorKey(roachpb.KeyMin), desc); err != nil {
return 0, err
}
return len(desc.Replicas), nil
Expand Down
4 changes: 2 additions & 2 deletions acceptance/status_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import (
"time"

"github.com/cockroachdb/cockroach/acceptance/localcluster"
"github.com/cockroachdb/cockroach/proto"
"github.com/cockroachdb/cockroach/roachpb"
"github.com/cockroachdb/cockroach/util"
"github.com/cockroachdb/cockroach/util/log"
"github.com/cockroachdb/cockroach/util/retry"
)

type details struct {
NodeID proto.NodeID `json:"nodeID"`
NodeID roachpb.NodeID `json:"nodeID"`
}

var retryOptions = retry.Options{
Expand Down
14 changes: 7 additions & 7 deletions cli/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/cockroachdb/cockroach/client"
"github.com/cockroachdb/cockroach/keys"
"github.com/cockroachdb/cockroach/proto"
"github.com/cockroachdb/cockroach/roachpb"
"github.com/cockroachdb/cockroach/security"
"github.com/cockroachdb/cockroach/util/stop"

Expand Down Expand Up @@ -83,7 +83,7 @@ func runGet(cmd *cobra.Command, args []string) {
kvDB, stopper := makeDBClient()
defer stopper.Stop()

key := proto.Key(unquoteArg(args[0], false))
key := roachpb.Key(unquoteArg(args[0], false))
r, err := kvDB.Get(key)
if err != nil {
fmt.Fprintf(osStderr, "get failed: %s\n", err)
Expand Down Expand Up @@ -201,7 +201,7 @@ func runInc(cmd *cobra.Command, args []string) {
}
}

key := proto.Key(unquoteArg(args[0], true /* disallow system keys */))
key := roachpb.Key(unquoteArg(args[0], true /* disallow system keys */))
if r, err := kvDB.Inc(key, int64(amount)); err != nil {
fmt.Fprintf(osStderr, "increment failed: %s\n", err)
osExit(1)
Expand Down Expand Up @@ -335,15 +335,15 @@ func runReverseScan(cmd *cobra.Command, args []string) {
showResult(rows)
}

func initScanArgs(args []string) (startKey, endKey proto.Key) {
func initScanArgs(args []string) (startKey, endKey roachpb.Key) {
if len(args) >= 1 {
startKey = proto.Key(unquoteArg(args[0], false))
startKey = roachpb.Key(unquoteArg(args[0], false))
} else {
// Start with the first key after the system key range.
startKey = keys.UserDataSpan.Start
}
if len(args) >= 2 {
endKey = proto.Key(unquoteArg(args[1], false))
endKey = roachpb.Key(unquoteArg(args[1], false))
} else {
// Exclude table data keys by default. The user can explicitly request them
// by passing \xff\xff for the end key.
Expand All @@ -360,7 +360,7 @@ func showResult(rows []client.KeyValue) {
continue
}

key := proto.Key(row.Key)
key := roachpb.Key(row.Key)
fmt.Printf("%s\t%s\n", key, row.PrettyValue())
}
fmt.Printf("%d result(s)\n", len(rows))
Expand Down
10 changes: 5 additions & 5 deletions cli/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"

"github.com/cockroachdb/cockroach/keys"
"github.com/cockroachdb/cockroach/proto"
"github.com/cockroachdb/cockroach/roachpb"

"github.com/spf13/cobra"
)
Expand All @@ -42,9 +42,9 @@ func runLsRanges(cmd *cobra.Command, args []string) {
mustUsage(cmd)
return
}
var startKey proto.Key
var startKey roachpb.Key
if len(args) >= 1 {
startKey = keys.RangeMetaKey(proto.Key(args[0]))
startKey = keys.RangeMetaKey(roachpb.Key(args[0]))
} else {
startKey = keys.Meta2Prefix
}
Expand All @@ -59,7 +59,7 @@ func runLsRanges(cmd *cobra.Command, args []string) {
}

for _, row := range rows {
desc := &proto.RangeDescriptor{}
desc := &roachpb.RangeDescriptor{}
if err := row.ValueProto(desc); err != nil {
fmt.Fprintf(os.Stderr, "%s: unable to unmarshal range descriptor\n", row.Key)
continue
Expand Down Expand Up @@ -89,7 +89,7 @@ func runSplitRange(cmd *cobra.Command, args []string) {
return
}

key := proto.Key(args[0])
key := roachpb.Key(args[0])
kvDB, stopper := makeDBClient()
defer stopper.Stop()
if err := kvDB.AdminSplit(key); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cli/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/cockroachdb/cockroach/client"
"github.com/cockroachdb/cockroach/config"
"github.com/cockroachdb/cockroach/proto"
"github.com/cockroachdb/cockroach/roachpb"
"github.com/cockroachdb/cockroach/security"
"github.com/cockroachdb/cockroach/server"
"github.com/cockroachdb/cockroach/storage/engine"
Expand Down Expand Up @@ -152,7 +152,7 @@ func runStart(_ *cobra.Command, _ []string) {
if context.EphemeralSingleNode {
// TODO(marc): set this in the zones table when we have an entry
// for the default cluster-wide zone config.
config.DefaultZoneConfig.ReplicaAttrs = []proto.Attributes{{}}
config.DefaultZoneConfig.ReplicaAttrs = []roachpb.Attributes{{}}
}

signalCh := make(chan os.Signal, 1)
Expand Down
6 changes: 3 additions & 3 deletions cli/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/cockroachdb/cockroach/config"
"github.com/cockroachdb/cockroach/util/log"
gogoproto "github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/proto"
yaml "gopkg.in/yaml.v1"

"github.com/spf13/cobra"
Expand All @@ -35,7 +35,7 @@ import (
// its yaml representation.
func zoneProtoToYAMLString(val string) (string, error) {
var zone config.ZoneConfig
if err := gogoproto.Unmarshal([]byte(val), &zone); err != nil {
if err := proto.Unmarshal([]byte(val), &zone); err != nil {
return "", err
}
ret, err := yaml.Marshal(zone)
Expand Down Expand Up @@ -223,7 +223,7 @@ func runSetZone(cmd *cobra.Command, args []string) {
return
}

buf, err := gogoproto.Marshal(&pbZoneConfig)
buf, err := proto.Marshal(&pbZoneConfig)
if err != nil {
log.Errorf("unable to parse zone config file %q: %s", args[1], err)
return
Expand Down
Loading