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

etcd no longer uses rewritten import paths #36

Merged
merged 2 commits into from
Apr 1, 2016
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
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test:
pre:
- rm -rf $GOPATH/src/github.com/coreos/etcd/vendor # https://github.com/coreos/etcd/issues/4913
- ./lint

8 changes: 4 additions & 4 deletions metcd/ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"net"
"time"

wackycontext "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/coreos/etcd/raft"
"github.com/coreos/etcd/raft/raftpb"
"golang.org/x/net/context"

"github.com/weaveworks/mesh/meshconn"
)
Expand Down Expand Up @@ -155,7 +155,7 @@ func (c *ctrl) driveRaft() {
}

case msg := <-c.incomingc:
c.node.Step(wackycontext.TODO(), msg)
c.node.Step(context.TODO(), msg)

case id := <-c.unreachablec:
c.node.ReportUnreachable(id)
Expand Down Expand Up @@ -184,7 +184,7 @@ func (c *ctrl) driveProposals(cancel <-chan struct{}) {
c.proposalc = nil
continue
}
c.node.Propose(wackycontext.TODO(), data)
c.node.Propose(context.TODO(), data)

case cc, ok := <-c.confchangec:
if !ok {
Expand All @@ -193,7 +193,7 @@ func (c *ctrl) driveProposals(cancel <-chan struct{}) {
continue
}
c.logger.Printf("ctrl: ProposeConfChange %s %x", cc.Type, cc.NodeID)
c.node.ProposeConfChange(wackycontext.TODO(), cc)
c.node.ProposeConfChange(context.TODO(), cc)

case <-cancel:
return
Expand Down
30 changes: 15 additions & 15 deletions metcd/etcd_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"os"
"sort"

wackyproto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
wackycontext "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/lease"
"github.com/coreos/etcd/raft/raftpb"
"github.com/coreos/etcd/storage"
"github.com/coreos/etcd/storage/backend"
"github.com/coreos/etcd/storage/storagepb"
"github.com/gogo/protobuf/proto"
"golang.org/x/net/context"
)

// Transport-agnostic reimplementation of coreos/etcd/etcdserver. The original
Expand Down Expand Up @@ -91,7 +91,7 @@ func newEtcdStore(

// Range implements gRPC KVServer.
// Range gets the keys in the range from the store.
func (s *etcdStore) Range(ctx wackycontext.Context, req *etcdserverpb.RangeRequest) (*etcdserverpb.RangeResponse, error) {
func (s *etcdStore) Range(ctx context.Context, req *etcdserverpb.RangeRequest) (*etcdserverpb.RangeResponse, error) {
ireq := etcdserverpb.InternalRaftRequest{ID: <-s.idgen, Range: req}
msgc, errc, err := s.proposeInternalRaftRequest(ireq)
if err != nil {
Expand All @@ -114,7 +114,7 @@ func (s *etcdStore) Range(ctx wackycontext.Context, req *etcdserverpb.RangeReque
// Put puts the given key into the store.
// A put request increases the revision of the store,
// and generates one event in the event history.
func (s *etcdStore) Put(ctx wackycontext.Context, req *etcdserverpb.PutRequest) (*etcdserverpb.PutResponse, error) {
func (s *etcdStore) Put(ctx context.Context, req *etcdserverpb.PutRequest) (*etcdserverpb.PutResponse, error) {
ireq := etcdserverpb.InternalRaftRequest{ID: <-s.idgen, Put: req}
msgc, errc, err := s.proposeInternalRaftRequest(ireq)
if err != nil {
Expand All @@ -137,7 +137,7 @@ func (s *etcdStore) Put(ctx wackycontext.Context, req *etcdserverpb.PutRequest)
// Delete deletes the given range from the store.
// A delete request increase the revision of the store,
// and generates one event in the event history.
func (s *etcdStore) DeleteRange(ctx wackycontext.Context, req *etcdserverpb.DeleteRangeRequest) (*etcdserverpb.DeleteRangeResponse, error) {
func (s *etcdStore) DeleteRange(ctx context.Context, req *etcdserverpb.DeleteRangeRequest) (*etcdserverpb.DeleteRangeResponse, error) {
ireq := etcdserverpb.InternalRaftRequest{ID: <-s.idgen, DeleteRange: req}
msgc, errc, err := s.proposeInternalRaftRequest(ireq)
if err != nil {
Expand All @@ -161,7 +161,7 @@ func (s *etcdStore) DeleteRange(ctx wackycontext.Context, req *etcdserverpb.Dele
// A txn request increases the revision of the store,
// and generates events with the same revision in the event history.
// It is not allowed to modify the same key several times within one txn.
func (s *etcdStore) Txn(ctx wackycontext.Context, req *etcdserverpb.TxnRequest) (*etcdserverpb.TxnResponse, error) {
func (s *etcdStore) Txn(ctx context.Context, req *etcdserverpb.TxnRequest) (*etcdserverpb.TxnResponse, error) {
ireq := etcdserverpb.InternalRaftRequest{ID: <-s.idgen, Txn: req}
msgc, errc, err := s.proposeInternalRaftRequest(ireq)
if err != nil {
Expand All @@ -183,7 +183,7 @@ func (s *etcdStore) Txn(ctx wackycontext.Context, req *etcdserverpb.TxnRequest)
// Compact implements gRPC KVServer.
// Compact compacts the event history in s. User should compact the
// event history periodically, or it will grow infinitely.
func (s *etcdStore) Compact(ctx wackycontext.Context, req *etcdserverpb.CompactionRequest) (*etcdserverpb.CompactionResponse, error) {
func (s *etcdStore) Compact(ctx context.Context, req *etcdserverpb.CompactionRequest) (*etcdserverpb.CompactionResponse, error) {
// We don't have snapshotting yet, so compact just puts us in a bad state.
// TODO(pb): fix this when we implement snapshotting.
return nil, errors.New("not implemented")
Expand All @@ -193,7 +193,7 @@ func (s *etcdStore) Compact(ctx wackycontext.Context, req *etcdserverpb.Compacti
// Hash returns the hash of local KV state for consistency checking purpose.
// This is designed for testing purpose. Do not use this in production when there
// are ongoing transactions.
func (s *etcdStore) Hash(ctx wackycontext.Context, req *etcdserverpb.HashRequest) (*etcdserverpb.HashResponse, error) {
func (s *etcdStore) Hash(ctx context.Context, req *etcdserverpb.HashRequest) (*etcdserverpb.HashResponse, error) {
h, err := s.kv.Hash()
if err != nil {
return nil, err
Expand Down Expand Up @@ -253,7 +253,7 @@ var (
)

type responseChans struct {
msgc chan<- wackyproto.Message
msgc chan<- proto.Message
errc chan<- error
}

Expand Down Expand Up @@ -347,7 +347,7 @@ func (s *etcdStore) applyCommittedEntry(entry raftpb.Entry) error {
}

// From public API method to proposalc.
func (s *etcdStore) proposeInternalRaftRequest(req etcdserverpb.InternalRaftRequest) (<-chan wackyproto.Message, <-chan error, error) {
func (s *etcdStore) proposeInternalRaftRequest(req etcdserverpb.InternalRaftRequest) (<-chan proto.Message, <-chan error, error) {
data, err := req.Marshal()
if err != nil {
return nil, nil, err
Expand All @@ -369,7 +369,7 @@ func (s *etcdStore) cancelInternalRaftRequest(req etcdserverpb.InternalRaftReque

// From committed entryc, back to public API method.
// etcdserver/v3demo_server.go applyV3Result
func (s *etcdStore) applyInternalRaftRequest(req etcdserverpb.InternalRaftRequest) (wackyproto.Message, error) {
func (s *etcdStore) applyInternalRaftRequest(req etcdserverpb.InternalRaftRequest) (proto.Message, error) {
switch {
case req.Range != nil:
return applyRange(noTxn, s.kv, req.Range)
Expand All @@ -390,17 +390,17 @@ func (s *etcdStore) applyInternalRaftRequest(req etcdserverpb.InternalRaftReques
}
}

func (s *etcdStore) registerPending(id uint64) (<-chan wackyproto.Message, <-chan error, error) {
func (s *etcdStore) registerPending(id uint64) (<-chan proto.Message, <-chan error, error) {
if _, ok := s.pending[id]; ok {
return nil, nil, fmt.Errorf("pending ID %d already registered", id)
}
msgc := make(chan wackyproto.Message)
msgc := make(chan proto.Message)
errc := make(chan error)
s.pending[id] = responseChans{msgc, errc}
return msgc, errc, nil
}

func (s *etcdStore) signalPending(id uint64, msg wackyproto.Message) {
func (s *etcdStore) signalPending(id uint64, msg proto.Message) {
rc, ok := s.pending[id]
if !ok {
// InternalRaftRequests are replicated via Raft. So all peers will invoke this
Expand Down Expand Up @@ -805,7 +805,7 @@ func compareInt64(a, b int64) int {
func applyCompaction(kv storage.KV, req *etcdserverpb.CompactionRequest) (*etcdserverpb.CompactionResponse, error) {
resp := &etcdserverpb.CompactionResponse{}
resp.Header = &etcdserverpb.ResponseHeader{}
err := kv.Compact(req.Revision)
_, err := kv.Compact(req.Revision)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions metcd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"time"

wackygrpc "github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc"
"github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/raft/raftpb"
"google.golang.org/grpc"

"github.com/weaveworks/mesh"
"github.com/weaveworks/mesh/meshconn"
Expand All @@ -26,8 +26,8 @@ type Server interface {
}

// GRPCServer converts a metcd.Server to a *grpc.Server.
func GRPCServer(s Server, options ...wackygrpc.ServerOption) *wackygrpc.Server {
srv := wackygrpc.NewServer(options...)
func GRPCServer(s Server, options ...grpc.ServerOption) *grpc.Server {
srv := grpc.NewServer(options...)
//etcdserverpb.RegisterAuthServer(srv, s)
//etcdserverpb.RegisterClusterServer(srv, s)
etcdserverpb.RegisterKVServer(srv, s)
Expand Down