Browse Source

Merge pull request #3079 from xiang90/gogo

*: resolve proto warnings
Xiang Li 10 years ago
parent
commit
718cb18ca2

+ 17 - 88
etcdserver/etcdserverpb/etcdserver.pb.go

@@ -21,29 +21,28 @@ import math "math"
 
 
 import io "io"
 import io "io"
 import fmt "fmt"
 import fmt "fmt"
-import github_com_gogo_protobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = proto.Marshal
 var _ = math.Inf
 var _ = math.Inf
 
 
 type Request struct {
 type Request struct {
-	ID               uint64 `protobuf:"varint,1,req" json:"ID"`
-	Method           string `protobuf:"bytes,2,req" json:"Method"`
-	Path             string `protobuf:"bytes,3,req" json:"Path"`
-	Val              string `protobuf:"bytes,4,req" json:"Val"`
-	Dir              bool   `protobuf:"varint,5,req" json:"Dir"`
-	PrevValue        string `protobuf:"bytes,6,req" json:"PrevValue"`
-	PrevIndex        uint64 `protobuf:"varint,7,req" json:"PrevIndex"`
+	ID               uint64 `protobuf:"varint,1,opt" json:"ID"`
+	Method           string `protobuf:"bytes,2,opt" json:"Method"`
+	Path             string `protobuf:"bytes,3,opt" json:"Path"`
+	Val              string `protobuf:"bytes,4,opt" json:"Val"`
+	Dir              bool   `protobuf:"varint,5,opt" json:"Dir"`
+	PrevValue        string `protobuf:"bytes,6,opt" json:"PrevValue"`
+	PrevIndex        uint64 `protobuf:"varint,7,opt" json:"PrevIndex"`
 	PrevExist        *bool  `protobuf:"varint,8,opt" json:"PrevExist,omitempty"`
 	PrevExist        *bool  `protobuf:"varint,8,opt" json:"PrevExist,omitempty"`
-	Expiration       int64  `protobuf:"varint,9,req" json:"Expiration"`
-	Wait             bool   `protobuf:"varint,10,req" json:"Wait"`
-	Since            uint64 `protobuf:"varint,11,req" json:"Since"`
-	Recursive        bool   `protobuf:"varint,12,req" json:"Recursive"`
-	Sorted           bool   `protobuf:"varint,13,req" json:"Sorted"`
-	Quorum           bool   `protobuf:"varint,14,req" json:"Quorum"`
-	Time             int64  `protobuf:"varint,15,req" json:"Time"`
-	Stream           bool   `protobuf:"varint,16,req" json:"Stream"`
+	Expiration       int64  `protobuf:"varint,9,opt" json:"Expiration"`
+	Wait             bool   `protobuf:"varint,10,opt" json:"Wait"`
+	Since            uint64 `protobuf:"varint,11,opt" json:"Since"`
+	Recursive        bool   `protobuf:"varint,12,opt" json:"Recursive"`
+	Sorted           bool   `protobuf:"varint,13,opt" json:"Sorted"`
+	Quorum           bool   `protobuf:"varint,14,opt" json:"Quorum"`
+	Time             int64  `protobuf:"varint,15,opt" json:"Time"`
+	Stream           bool   `protobuf:"varint,16,opt" json:"Stream"`
 	XXX_unrecognized []byte `json:"-"`
 	XXX_unrecognized []byte `json:"-"`
 }
 }
 
 
@@ -52,8 +51,8 @@ func (m *Request) String() string { return proto.CompactTextString(m) }
 func (*Request) ProtoMessage()    {}
 func (*Request) ProtoMessage()    {}
 
 
 type Metadata struct {
 type Metadata struct {
-	NodeID           uint64 `protobuf:"varint,1,req" json:"NodeID"`
-	ClusterID        uint64 `protobuf:"varint,2,req" json:"ClusterID"`
+	NodeID           uint64 `protobuf:"varint,1,opt" json:"NodeID"`
+	ClusterID        uint64 `protobuf:"varint,2,opt" json:"ClusterID"`
 	XXX_unrecognized []byte `json:"-"`
 	XXX_unrecognized []byte `json:"-"`
 }
 }
 
 
@@ -64,7 +63,6 @@ func (*Metadata) ProtoMessage()    {}
 func init() {
 func init() {
 }
 }
 func (m *Request) Unmarshal(data []byte) error {
 func (m *Request) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -98,7 +96,6 @@ func (m *Request) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType)
@@ -121,7 +118,6 @@ func (m *Request) Unmarshal(data []byte) error {
 			}
 			}
 			m.Method = string(data[iNdEx:postIndex])
 			m.Method = string(data[iNdEx:postIndex])
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType)
@@ -144,7 +140,6 @@ func (m *Request) Unmarshal(data []byte) error {
 			}
 			}
 			m.Path = string(data[iNdEx:postIndex])
 			m.Path = string(data[iNdEx:postIndex])
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000004)
 		case 4:
 		case 4:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Val", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Val", wireType)
@@ -167,7 +162,6 @@ func (m *Request) Unmarshal(data []byte) error {
 			}
 			}
 			m.Val = string(data[iNdEx:postIndex])
 			m.Val = string(data[iNdEx:postIndex])
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000008)
 		case 5:
 		case 5:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Dir", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Dir", wireType)
@@ -185,7 +179,6 @@ func (m *Request) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Dir = bool(v != 0)
 			m.Dir = bool(v != 0)
-			hasFields[0] |= uint64(0x00000010)
 		case 6:
 		case 6:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field PrevValue", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field PrevValue", wireType)
@@ -208,7 +201,6 @@ func (m *Request) Unmarshal(data []byte) error {
 			}
 			}
 			m.PrevValue = string(data[iNdEx:postIndex])
 			m.PrevValue = string(data[iNdEx:postIndex])
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000020)
 		case 7:
 		case 7:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field PrevIndex", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field PrevIndex", wireType)
@@ -224,7 +216,6 @@ func (m *Request) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000040)
 		case 8:
 		case 8:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field PrevExist", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field PrevExist", wireType)
@@ -258,7 +249,6 @@ func (m *Request) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000080)
 		case 10:
 		case 10:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Wait", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Wait", wireType)
@@ -276,7 +266,6 @@ func (m *Request) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Wait = bool(v != 0)
 			m.Wait = bool(v != 0)
-			hasFields[0] |= uint64(0x00000100)
 		case 11:
 		case 11:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
@@ -292,7 +281,6 @@ func (m *Request) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000200)
 		case 12:
 		case 12:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Recursive", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Recursive", wireType)
@@ -310,7 +298,6 @@ func (m *Request) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Recursive = bool(v != 0)
 			m.Recursive = bool(v != 0)
-			hasFields[0] |= uint64(0x00000400)
 		case 13:
 		case 13:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Sorted", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Sorted", wireType)
@@ -328,7 +315,6 @@ func (m *Request) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Sorted = bool(v != 0)
 			m.Sorted = bool(v != 0)
-			hasFields[0] |= uint64(0x00000800)
 		case 14:
 		case 14:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType)
@@ -346,7 +332,6 @@ func (m *Request) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Quorum = bool(v != 0)
 			m.Quorum = bool(v != 0)
-			hasFields[0] |= uint64(0x00001000)
 		case 15:
 		case 15:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType)
@@ -362,7 +347,6 @@ func (m *Request) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00002000)
 		case 16:
 		case 16:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType)
@@ -380,7 +364,6 @@ func (m *Request) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Stream = bool(v != 0)
 			m.Stream = bool(v != 0)
-			hasFields[0] |= uint64(0x00004000)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -402,56 +385,10 @@ func (m *Request) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("ID")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Method")
-	}
-	if hasFields[0]&uint64(0x00000004) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Path")
-	}
-	if hasFields[0]&uint64(0x00000008) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Val")
-	}
-	if hasFields[0]&uint64(0x00000010) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Dir")
-	}
-	if hasFields[0]&uint64(0x00000020) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("PrevValue")
-	}
-	if hasFields[0]&uint64(0x00000040) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("PrevIndex")
-	}
-	if hasFields[0]&uint64(0x00000080) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Expiration")
-	}
-	if hasFields[0]&uint64(0x00000100) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Wait")
-	}
-	if hasFields[0]&uint64(0x00000200) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Since")
-	}
-	if hasFields[0]&uint64(0x00000400) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Recursive")
-	}
-	if hasFields[0]&uint64(0x00000800) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Sorted")
-	}
-	if hasFields[0]&uint64(0x00001000) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Quorum")
-	}
-	if hasFields[0]&uint64(0x00002000) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Time")
-	}
-	if hasFields[0]&uint64(0x00004000) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Stream")
-	}
 
 
 	return nil
 	return nil
 }
 }
 func (m *Metadata) Unmarshal(data []byte) error {
 func (m *Metadata) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -485,7 +422,6 @@ func (m *Metadata) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field ClusterID", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field ClusterID", wireType)
@@ -501,7 +437,6 @@ func (m *Metadata) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -523,12 +458,6 @@ func (m *Metadata) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("NodeID")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("ClusterID")
-	}
 
 
 	return nil
 	return nil
 }
 }

+ 1 - 0
etcdserver/etcdserverpb/etcdserver.proto

@@ -1,3 +1,4 @@
+syntax = "proto2";
 package etcdserverpb;
 package etcdserverpb;
 
 
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";

+ 27 - 126
raft/raftpb/raft.pb.go

@@ -26,7 +26,6 @@ import math "math"
 
 
 import io "io"
 import io "io"
 import fmt "fmt"
 import fmt "fmt"
-import github_com_gogo_protobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = proto.Marshal
@@ -165,10 +164,10 @@ func (x *ConfChangeType) UnmarshalJSON(data []byte) error {
 }
 }
 
 
 type Entry struct {
 type Entry struct {
-	Type             EntryType `protobuf:"varint,1,req,enum=raftpb.EntryType" json:"Type"`
-	Term             uint64    `protobuf:"varint,2,req" json:"Term"`
-	Index            uint64    `protobuf:"varint,3,req" json:"Index"`
-	Data             []byte    `protobuf:"bytes,4,opt" json:"Data"`
+	Type             EntryType `protobuf:"varint,1,opt,enum=raftpb.EntryType" json:"Type"`
+	Term             uint64    `protobuf:"varint,2,opt" json:"Term"`
+	Index            uint64    `protobuf:"varint,3,opt" json:"Index"`
+	Data             []byte    `protobuf:"bytes,4,opt" json:"Data,omitempty"`
 	XXX_unrecognized []byte    `json:"-"`
 	XXX_unrecognized []byte    `json:"-"`
 }
 }
 
 
@@ -177,9 +176,9 @@ func (m *Entry) String() string { return proto.CompactTextString(m) }
 func (*Entry) ProtoMessage()    {}
 func (*Entry) ProtoMessage()    {}
 
 
 type SnapshotMetadata struct {
 type SnapshotMetadata struct {
-	ConfState        ConfState `protobuf:"bytes,1,req,name=conf_state" json:"conf_state"`
-	Index            uint64    `protobuf:"varint,2,req,name=index" json:"index"`
-	Term             uint64    `protobuf:"varint,3,req,name=term" json:"term"`
+	ConfState        ConfState `protobuf:"bytes,1,opt,name=conf_state" json:"conf_state"`
+	Index            uint64    `protobuf:"varint,2,opt,name=index" json:"index"`
+	Term             uint64    `protobuf:"varint,3,opt,name=term" json:"term"`
 	XXX_unrecognized []byte    `json:"-"`
 	XXX_unrecognized []byte    `json:"-"`
 }
 }
 
 
@@ -188,8 +187,8 @@ func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) }
 func (*SnapshotMetadata) ProtoMessage()    {}
 func (*SnapshotMetadata) ProtoMessage()    {}
 
 
 type Snapshot struct {
 type Snapshot struct {
-	Data             []byte           `protobuf:"bytes,1,opt,name=data" json:"data"`
-	Metadata         SnapshotMetadata `protobuf:"bytes,2,req,name=metadata" json:"metadata"`
+	Data             []byte           `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
+	Metadata         SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"`
 	XXX_unrecognized []byte           `json:"-"`
 	XXX_unrecognized []byte           `json:"-"`
 }
 }
 
 
@@ -198,17 +197,17 @@ func (m *Snapshot) String() string { return proto.CompactTextString(m) }
 func (*Snapshot) ProtoMessage()    {}
 func (*Snapshot) ProtoMessage()    {}
 
 
 type Message struct {
 type Message struct {
-	Type             MessageType `protobuf:"varint,1,req,name=type,enum=raftpb.MessageType" json:"type"`
-	To               uint64      `protobuf:"varint,2,req,name=to" json:"to"`
-	From             uint64      `protobuf:"varint,3,req,name=from" json:"from"`
-	Term             uint64      `protobuf:"varint,4,req,name=term" json:"term"`
-	LogTerm          uint64      `protobuf:"varint,5,req,name=logTerm" json:"logTerm"`
-	Index            uint64      `protobuf:"varint,6,req,name=index" json:"index"`
+	Type             MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"`
+	To               uint64      `protobuf:"varint,2,opt,name=to" json:"to"`
+	From             uint64      `protobuf:"varint,3,opt,name=from" json:"from"`
+	Term             uint64      `protobuf:"varint,4,opt,name=term" json:"term"`
+	LogTerm          uint64      `protobuf:"varint,5,opt,name=logTerm" json:"logTerm"`
+	Index            uint64      `protobuf:"varint,6,opt,name=index" json:"index"`
 	Entries          []Entry     `protobuf:"bytes,7,rep,name=entries" json:"entries"`
 	Entries          []Entry     `protobuf:"bytes,7,rep,name=entries" json:"entries"`
-	Commit           uint64      `protobuf:"varint,8,req,name=commit" json:"commit"`
-	Snapshot         Snapshot    `protobuf:"bytes,9,req,name=snapshot" json:"snapshot"`
-	Reject           bool        `protobuf:"varint,10,req,name=reject" json:"reject"`
-	RejectHint       uint64      `protobuf:"varint,11,req,name=rejectHint" json:"rejectHint"`
+	Commit           uint64      `protobuf:"varint,8,opt,name=commit" json:"commit"`
+	Snapshot         Snapshot    `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot"`
+	Reject           bool        `protobuf:"varint,10,opt,name=reject" json:"reject"`
+	RejectHint       uint64      `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"`
 	XXX_unrecognized []byte      `json:"-"`
 	XXX_unrecognized []byte      `json:"-"`
 }
 }
 
 
@@ -217,9 +216,9 @@ func (m *Message) String() string { return proto.CompactTextString(m) }
 func (*Message) ProtoMessage()    {}
 func (*Message) ProtoMessage()    {}
 
 
 type HardState struct {
 type HardState struct {
-	Term             uint64 `protobuf:"varint,1,req,name=term" json:"term"`
-	Vote             uint64 `protobuf:"varint,2,req,name=vote" json:"vote"`
-	Commit           uint64 `protobuf:"varint,3,req,name=commit" json:"commit"`
+	Term             uint64 `protobuf:"varint,1,opt,name=term" json:"term"`
+	Vote             uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"`
+	Commit           uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"`
 	XXX_unrecognized []byte `json:"-"`
 	XXX_unrecognized []byte `json:"-"`
 }
 }
 
 
@@ -228,7 +227,7 @@ func (m *HardState) String() string { return proto.CompactTextString(m) }
 func (*HardState) ProtoMessage()    {}
 func (*HardState) ProtoMessage()    {}
 
 
 type ConfState struct {
 type ConfState struct {
-	Nodes            []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes"`
+	Nodes            []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"`
 	XXX_unrecognized []byte   `json:"-"`
 	XXX_unrecognized []byte   `json:"-"`
 }
 }
 
 
@@ -237,10 +236,10 @@ func (m *ConfState) String() string { return proto.CompactTextString(m) }
 func (*ConfState) ProtoMessage()    {}
 func (*ConfState) ProtoMessage()    {}
 
 
 type ConfChange struct {
 type ConfChange struct {
-	ID               uint64         `protobuf:"varint,1,req" json:"ID"`
-	Type             ConfChangeType `protobuf:"varint,2,req,enum=raftpb.ConfChangeType" json:"Type"`
-	NodeID           uint64         `protobuf:"varint,3,req" json:"NodeID"`
-	Context          []byte         `protobuf:"bytes,4,opt" json:"Context"`
+	ID               uint64         `protobuf:"varint,1,opt" json:"ID"`
+	Type             ConfChangeType `protobuf:"varint,2,opt,enum=raftpb.ConfChangeType" json:"Type"`
+	NodeID           uint64         `protobuf:"varint,3,opt" json:"NodeID"`
+	Context          []byte         `protobuf:"bytes,4,opt" json:"Context,omitempty"`
 	XXX_unrecognized []byte         `json:"-"`
 	XXX_unrecognized []byte         `json:"-"`
 }
 }
 
 
@@ -254,7 +253,6 @@ func init() {
 	proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value)
 	proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value)
 }
 }
 func (m *Entry) Unmarshal(data []byte) error {
 func (m *Entry) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -288,7 +286,6 @@ func (m *Entry) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
@@ -304,7 +301,6 @@ func (m *Entry) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
@@ -320,7 +316,6 @@ func (m *Entry) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000004)
 		case 4:
 		case 4:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
@@ -364,20 +359,10 @@ func (m *Entry) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Term")
-	}
-	if hasFields[0]&uint64(0x00000004) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Index")
-	}
 
 
 	return nil
 	return nil
 }
 }
 func (m *SnapshotMetadata) Unmarshal(data []byte) error {
 func (m *SnapshotMetadata) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -420,7 +405,6 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
@@ -436,7 +420,6 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
@@ -452,7 +435,6 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000004)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -474,20 +456,10 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("conf_state")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("index")
-	}
-	if hasFields[0]&uint64(0x00000004) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("term")
-	}
 
 
 	return nil
 	return nil
 }
 }
 func (m *Snapshot) Unmarshal(data []byte) error {
 func (m *Snapshot) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -552,7 +524,6 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000001)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -574,14 +545,10 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("metadata")
-	}
 
 
 	return nil
 	return nil
 }
 }
 func (m *Message) Unmarshal(data []byte) error {
 func (m *Message) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -615,7 +582,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
@@ -631,7 +597,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field From", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field From", wireType)
@@ -647,7 +612,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000004)
 		case 4:
 		case 4:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
@@ -663,7 +627,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000008)
 		case 5:
 		case 5:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType)
@@ -679,7 +642,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000010)
 		case 6:
 		case 6:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
@@ -695,7 +657,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000020)
 		case 7:
 		case 7:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType)
@@ -736,7 +697,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000040)
 		case 9:
 		case 9:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType)
@@ -761,7 +721,6 @@ func (m *Message) Unmarshal(data []byte) error {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
-			hasFields[0] |= uint64(0x00000080)
 		case 10:
 		case 10:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType)
@@ -779,7 +738,6 @@ func (m *Message) Unmarshal(data []byte) error {
 				}
 				}
 			}
 			}
 			m.Reject = bool(v != 0)
 			m.Reject = bool(v != 0)
-			hasFields[0] |= uint64(0x00000100)
 		case 11:
 		case 11:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType)
@@ -795,7 +753,6 @@ func (m *Message) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000200)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -817,41 +774,10 @@ func (m *Message) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("to")
-	}
-	if hasFields[0]&uint64(0x00000004) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("from")
-	}
-	if hasFields[0]&uint64(0x00000008) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("term")
-	}
-	if hasFields[0]&uint64(0x00000010) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("logTerm")
-	}
-	if hasFields[0]&uint64(0x00000020) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("index")
-	}
-	if hasFields[0]&uint64(0x00000040) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("commit")
-	}
-	if hasFields[0]&uint64(0x00000080) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("snapshot")
-	}
-	if hasFields[0]&uint64(0x00000100) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("reject")
-	}
-	if hasFields[0]&uint64(0x00000200) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("rejectHint")
-	}
 
 
 	return nil
 	return nil
 }
 }
 func (m *HardState) Unmarshal(data []byte) error {
 func (m *HardState) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -885,7 +811,6 @@ func (m *HardState) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType)
@@ -901,7 +826,6 @@ func (m *HardState) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType)
@@ -917,7 +841,6 @@ func (m *HardState) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000004)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -939,15 +862,6 @@ func (m *HardState) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("term")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("vote")
-	}
-	if hasFields[0]&uint64(0x00000004) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("commit")
-	}
 
 
 	return nil
 	return nil
 }
 }
@@ -1012,7 +926,6 @@ func (m *ConfState) Unmarshal(data []byte) error {
 	return nil
 	return nil
 }
 }
 func (m *ConfChange) Unmarshal(data []byte) error {
 func (m *ConfChange) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -1046,7 +959,6 @@ func (m *ConfChange) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
@@ -1062,7 +974,6 @@ func (m *ConfChange) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
@@ -1078,7 +989,6 @@ func (m *ConfChange) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000004)
 		case 4:
 		case 4:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType)
@@ -1122,15 +1032,6 @@ func (m *ConfChange) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("ID")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type")
-	}
-	if hasFields[0]&uint64(0x00000004) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("NodeID")
-	}
 
 
 	return nil
 	return nil
 }
 }

+ 6 - 5
raft/raftpb/raft.proto

@@ -1,3 +1,4 @@
+syntax = "proto2";
 package raftpb;
 package raftpb;
 
 
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@@ -17,7 +18,7 @@ message Entry {
 	optional EntryType  Type  = 1 [(gogoproto.nullable) = false];
 	optional EntryType  Type  = 1 [(gogoproto.nullable) = false];
 	optional uint64     Term  = 2 [(gogoproto.nullable) = false];
 	optional uint64     Term  = 2 [(gogoproto.nullable) = false];
 	optional uint64     Index = 3 [(gogoproto.nullable) = false];
 	optional uint64     Index = 3 [(gogoproto.nullable) = false];
-	optional bytes      Data  = 4 [(gogoproto.nullable) = false];
+	optional bytes      Data  = 4;
 }
 }
 
 
 message SnapshotMetadata {
 message SnapshotMetadata {
@@ -27,8 +28,8 @@ message SnapshotMetadata {
 }
 }
 
 
 message Snapshot {
 message Snapshot {
-	optional bytes            data     = 1 [(gogoproto.nullable) = false];
-	required SnapshotMetadata metadata = 2 [(gogoproto.nullable) = false];
+	optional bytes            data     = 1;
+	optional SnapshotMetadata metadata = 2 [(gogoproto.nullable) = false];
 }
 }
 
 
 enum MessageType {
 enum MessageType {
@@ -67,7 +68,7 @@ message HardState {
 }
 }
 
 
 message ConfState {
 message ConfState {
-	repeated uint64 nodes = 1 [(gogoproto.nullable) = false];
+	repeated uint64 nodes = 1;
 }
 }
 
 
 enum ConfChangeType {
 enum ConfChangeType {
@@ -80,5 +81,5 @@ message ConfChange {
 	optional uint64          ID      = 1 [(gogoproto.nullable) = false];
 	optional uint64          ID      = 1 [(gogoproto.nullable) = false];
 	optional ConfChangeType  Type    = 2 [(gogoproto.nullable) = false];
 	optional ConfChangeType  Type    = 2 [(gogoproto.nullable) = false];
 	optional uint64          NodeID  = 3 [(gogoproto.nullable) = false];
 	optional uint64          NodeID  = 3 [(gogoproto.nullable) = false];
-	optional bytes           Context = 4 [(gogoproto.nullable) = false];
+	optional bytes           Context = 4;
 }
 }

+ 1 - 7
snap/snappb/snap.pb.go

@@ -20,14 +20,13 @@ import math "math"
 
 
 import io "io"
 import io "io"
 import fmt "fmt"
 import fmt "fmt"
-import github_com_gogo_protobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = proto.Marshal
 var _ = math.Inf
 var _ = math.Inf
 
 
 type Snapshot struct {
 type Snapshot struct {
-	Crc              uint32 `protobuf:"varint,1,req,name=crc" json:"crc"`
+	Crc              uint32 `protobuf:"varint,1,opt,name=crc" json:"crc"`
 	Data             []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
 	Data             []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
 	XXX_unrecognized []byte `json:"-"`
 	XXX_unrecognized []byte `json:"-"`
 }
 }
@@ -39,7 +38,6 @@ func (*Snapshot) ProtoMessage()    {}
 func init() {
 func init() {
 }
 }
 func (m *Snapshot) Unmarshal(data []byte) error {
 func (m *Snapshot) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -73,7 +71,6 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
@@ -117,9 +114,6 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("crc")
-	}
 
 
 	return nil
 	return nil
 }
 }

+ 1 - 0
snap/snappb/snap.proto

@@ -1,3 +1,4 @@
+syntax = "proto2";
 package snappb;
 package snappb;
 
 
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";

+ 69 - 69
storage/storagepb/kv.pb.go

@@ -15,7 +15,6 @@
 package storagepb
 package storagepb
 
 
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
-import math "math"
 
 
 // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
 // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
 
 
@@ -24,7 +23,6 @@ import fmt "fmt"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = proto.Marshal
-var _ = math.Inf
 
 
 type Event_EventType int32
 type Event_EventType int32
 
 
@@ -45,34 +43,20 @@ var Event_EventType_value = map[string]int32{
 	"EXPIRE": 2,
 	"EXPIRE": 2,
 }
 }
 
 
-func (x Event_EventType) Enum() *Event_EventType {
-	p := new(Event_EventType)
-	*p = x
-	return p
-}
 func (x Event_EventType) String() string {
 func (x Event_EventType) String() string {
 	return proto.EnumName(Event_EventType_name, int32(x))
 	return proto.EnumName(Event_EventType_name, int32(x))
 }
 }
-func (x *Event_EventType) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(Event_EventType_value, data, "Event_EventType")
-	if err != nil {
-		return err
-	}
-	*x = Event_EventType(value)
-	return nil
-}
 
 
 type KeyValue struct {
 type KeyValue struct {
-	Key []byte `protobuf:"bytes,1,opt,name=key" json:"key"`
+	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
 	// mod_index is the last modified index of the key.
 	// mod_index is the last modified index of the key.
-	CreateIndex int64 `protobuf:"varint,2,opt,name=create_index" json:"create_index"`
-	ModIndex    int64 `protobuf:"varint,3,opt,name=mod_index" json:"mod_index"`
+	CreateIndex int64 `protobuf:"varint,2,opt,name=create_index,proto3" json:"create_index,omitempty"`
+	ModIndex    int64 `protobuf:"varint,3,opt,name=mod_index,proto3" json:"mod_index,omitempty"`
 	// version is the version of the key. A deletion resets
 	// version is the version of the key. A deletion resets
 	// the version to zero and any modification of the key
 	// the version to zero and any modification of the key
 	// increases its version.
 	// increases its version.
-	Version          int64  `protobuf:"varint,4,opt,name=version" json:"version"`
-	Value            []byte `protobuf:"bytes,5,opt,name=value" json:"value"`
-	XXX_unrecognized []byte `json:"-"`
+	Version int64  `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
+	Value   []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
 }
 }
 
 
 func (m *KeyValue) Reset()         { *m = KeyValue{} }
 func (m *KeyValue) Reset()         { *m = KeyValue{} }
@@ -80,12 +64,11 @@ func (m *KeyValue) String() string { return proto.CompactTextString(m) }
 func (*KeyValue) ProtoMessage()    {}
 func (*KeyValue) ProtoMessage()    {}
 
 
 type Event struct {
 type Event struct {
-	Type Event_EventType `protobuf:"varint,1,opt,name=type,enum=storagepb.Event_EventType" json:"type"`
+	Type Event_EventType `protobuf:"varint,1,opt,name=type,proto3,enum=storagepb.Event_EventType" json:"type,omitempty"`
 	// a put event contains the current key-value
 	// a put event contains the current key-value
 	// a delete/expire event contains the previous
 	// a delete/expire event contains the previous
 	// key-value
 	// key-value
-	Kv               KeyValue `protobuf:"bytes,2,opt,name=kv" json:"kv"`
-	XXX_unrecognized []byte   `json:"-"`
+	Kv *KeyValue `protobuf:"bytes,2,opt,name=kv" json:"kv,omitempty"`
 }
 }
 
 
 func (m *Event) Reset()         { *m = Event{} }
 func (m *Event) Reset()         { *m = Event{} }
@@ -220,7 +203,6 @@ func (m *KeyValue) Unmarshal(data []byte) error {
 			if (iNdEx + skippy) > l {
 			if (iNdEx + skippy) > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
@@ -281,6 +263,9 @@ func (m *Event) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
+			if m.Kv == nil {
+				m.Kv = &KeyValue{}
+			}
 			if err := m.Kv.Unmarshal(data[iNdEx:postIndex]); err != nil {
 			if err := m.Kv.Unmarshal(data[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
@@ -302,7 +287,6 @@ func (m *Event) Unmarshal(data []byte) error {
 			if (iNdEx + skippy) > l {
 			if (iNdEx + skippy) > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
@@ -398,17 +382,24 @@ func (m *KeyValue) Size() (n int) {
 	_ = l
 	_ = l
 	if m.Key != nil {
 	if m.Key != nil {
 		l = len(m.Key)
 		l = len(m.Key)
-		n += 1 + l + sovKv(uint64(l))
+		if l > 0 {
+			n += 1 + l + sovKv(uint64(l))
+		}
+	}
+	if m.CreateIndex != 0 {
+		n += 1 + sovKv(uint64(m.CreateIndex))
+	}
+	if m.ModIndex != 0 {
+		n += 1 + sovKv(uint64(m.ModIndex))
+	}
+	if m.Version != 0 {
+		n += 1 + sovKv(uint64(m.Version))
 	}
 	}
-	n += 1 + sovKv(uint64(m.CreateIndex))
-	n += 1 + sovKv(uint64(m.ModIndex))
-	n += 1 + sovKv(uint64(m.Version))
 	if m.Value != nil {
 	if m.Value != nil {
 		l = len(m.Value)
 		l = len(m.Value)
-		n += 1 + l + sovKv(uint64(l))
-	}
-	if m.XXX_unrecognized != nil {
-		n += len(m.XXX_unrecognized)
+		if l > 0 {
+			n += 1 + l + sovKv(uint64(l))
+		}
 	}
 	}
 	return n
 	return n
 }
 }
@@ -416,11 +407,12 @@ func (m *KeyValue) Size() (n int) {
 func (m *Event) Size() (n int) {
 func (m *Event) Size() (n int) {
 	var l int
 	var l int
 	_ = l
 	_ = l
-	n += 1 + sovKv(uint64(m.Type))
-	l = m.Kv.Size()
-	n += 1 + l + sovKv(uint64(l))
-	if m.XXX_unrecognized != nil {
-		n += len(m.XXX_unrecognized)
+	if m.Type != 0 {
+		n += 1 + sovKv(uint64(m.Type))
+	}
+	if m.Kv != nil {
+		l = m.Kv.Size()
+		n += 1 + l + sovKv(uint64(l))
 	}
 	}
 	return n
 	return n
 }
 }
@@ -454,28 +446,35 @@ func (m *KeyValue) MarshalTo(data []byte) (n int, err error) {
 	var l int
 	var l int
 	_ = l
 	_ = l
 	if m.Key != nil {
 	if m.Key != nil {
-		data[i] = 0xa
+		if len(m.Key) > 0 {
+			data[i] = 0xa
+			i++
+			i = encodeVarintKv(data, i, uint64(len(m.Key)))
+			i += copy(data[i:], m.Key)
+		}
+	}
+	if m.CreateIndex != 0 {
+		data[i] = 0x10
 		i++
 		i++
-		i = encodeVarintKv(data, i, uint64(len(m.Key)))
-		i += copy(data[i:], m.Key)
+		i = encodeVarintKv(data, i, uint64(m.CreateIndex))
 	}
 	}
-	data[i] = 0x10
-	i++
-	i = encodeVarintKv(data, i, uint64(m.CreateIndex))
-	data[i] = 0x18
-	i++
-	i = encodeVarintKv(data, i, uint64(m.ModIndex))
-	data[i] = 0x20
-	i++
-	i = encodeVarintKv(data, i, uint64(m.Version))
-	if m.Value != nil {
-		data[i] = 0x2a
+	if m.ModIndex != 0 {
+		data[i] = 0x18
 		i++
 		i++
-		i = encodeVarintKv(data, i, uint64(len(m.Value)))
-		i += copy(data[i:], m.Value)
+		i = encodeVarintKv(data, i, uint64(m.ModIndex))
 	}
 	}
-	if m.XXX_unrecognized != nil {
-		i += copy(data[i:], m.XXX_unrecognized)
+	if m.Version != 0 {
+		data[i] = 0x20
+		i++
+		i = encodeVarintKv(data, i, uint64(m.Version))
+	}
+	if m.Value != nil {
+		if len(m.Value) > 0 {
+			data[i] = 0x2a
+			i++
+			i = encodeVarintKv(data, i, uint64(len(m.Value)))
+			i += copy(data[i:], m.Value)
+		}
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }
@@ -495,19 +494,20 @@ func (m *Event) MarshalTo(data []byte) (n int, err error) {
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
-	data[i] = 0x8
-	i++
-	i = encodeVarintKv(data, i, uint64(m.Type))
-	data[i] = 0x12
-	i++
-	i = encodeVarintKv(data, i, uint64(m.Kv.Size()))
-	n1, err := m.Kv.MarshalTo(data[i:])
-	if err != nil {
-		return 0, err
+	if m.Type != 0 {
+		data[i] = 0x8
+		i++
+		i = encodeVarintKv(data, i, uint64(m.Type))
 	}
 	}
-	i += n1
-	if m.XXX_unrecognized != nil {
-		i += copy(data[i:], m.XXX_unrecognized)
+	if m.Kv != nil {
+		data[i] = 0x12
+		i++
+		i = encodeVarintKv(data, i, uint64(m.Kv.Size()))
+		n1, err := m.Kv.MarshalTo(data[i:])
+		if err != nil {
+			return 0, err
+		}
+		i += n1
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }

+ 8 - 7
storage/storagepb/kv.proto

@@ -1,3 +1,4 @@
+syntax = "proto3";
 package storagepb;
 package storagepb;
 
 
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@@ -9,15 +10,15 @@ option (gogoproto.goproto_getters_all) = false;
 option (gogoproto.goproto_enum_prefix_all) = false;
 option (gogoproto.goproto_enum_prefix_all) = false;
 
 
 message KeyValue {
 message KeyValue {
-  optional bytes key = 1 [(gogoproto.nullable) = false];
+  bytes key = 1;
   // mod_index is the last modified index of the key.
   // mod_index is the last modified index of the key.
-  optional int64 create_index = 2 [(gogoproto.nullable) = false];
-  optional int64 mod_index = 3 [(gogoproto.nullable) = false];
+  int64 create_index = 2;
+  int64 mod_index = 3;
   // version is the version of the key. A deletion resets
   // version is the version of the key. A deletion resets
   // the version to zero and any modification of the key
   // the version to zero and any modification of the key
   // increases its version.
   // increases its version.
-  optional int64 version = 4 [(gogoproto.nullable) = false];
-  optional bytes value = 5 [(gogoproto.nullable) = false];
+  int64 version = 4;
+  bytes value = 5;
 }
 }
 
 
 message Event {
 message Event {
@@ -26,10 +27,10 @@ message Event {
     DELETE = 1;
     DELETE = 1;
     EXPIRE = 2;
     EXPIRE = 2;
   }
   }
-  optional EventType type = 1 [(gogoproto.nullable) = false];
+  EventType type = 1;
   // a put event contains the current key-value
   // a put event contains the current key-value
   // a delete/expire event contains the previous
   // a delete/expire event contains the previous
   // key-value
   // key-value
-  optional KeyValue kv = 2 [(gogoproto.nullable) = false];
+  KeyValue kv = 2;
 }
 }
 
 

+ 4 - 23
wal/walpb/record.pb.go

@@ -21,15 +21,14 @@ import math "math"
 
 
 import io "io"
 import io "io"
 import fmt "fmt"
 import fmt "fmt"
-import github_com_gogo_protobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = proto.Marshal
 var _ = math.Inf
 var _ = math.Inf
 
 
 type Record struct {
 type Record struct {
-	Type             int64  `protobuf:"varint,1,req,name=type" json:"type"`
-	Crc              uint32 `protobuf:"varint,2,req,name=crc" json:"crc"`
+	Type             int64  `protobuf:"varint,1,opt,name=type" json:"type"`
+	Crc              uint32 `protobuf:"varint,2,opt,name=crc" json:"crc"`
 	Data             []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
 	Data             []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
 	XXX_unrecognized []byte `json:"-"`
 	XXX_unrecognized []byte `json:"-"`
 }
 }
@@ -39,8 +38,8 @@ func (m *Record) String() string { return proto.CompactTextString(m) }
 func (*Record) ProtoMessage()    {}
 func (*Record) ProtoMessage()    {}
 
 
 type Snapshot struct {
 type Snapshot struct {
-	Index            uint64 `protobuf:"varint,1,req,name=index" json:"index"`
-	Term             uint64 `protobuf:"varint,2,req,name=term" json:"term"`
+	Index            uint64 `protobuf:"varint,1,opt,name=index" json:"index"`
+	Term             uint64 `protobuf:"varint,2,opt,name=term" json:"term"`
 	XXX_unrecognized []byte `json:"-"`
 	XXX_unrecognized []byte `json:"-"`
 }
 }
 
 
@@ -51,7 +50,6 @@ func (*Snapshot) ProtoMessage()    {}
 func init() {
 func init() {
 }
 }
 func (m *Record) Unmarshal(data []byte) error {
 func (m *Record) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -85,7 +83,6 @@ func (m *Record) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
@@ -101,7 +98,6 @@ func (m *Record) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		case 3:
 		case 3:
 			if wireType != 2 {
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
@@ -145,17 +141,10 @@ func (m *Record) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("crc")
-	}
 
 
 	return nil
 	return nil
 }
 }
 func (m *Snapshot) Unmarshal(data []byte) error {
 func (m *Snapshot) Unmarshal(data []byte) error {
-	var hasFields [1]uint64
 	l := len(data)
 	l := len(data)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
@@ -189,7 +178,6 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000001)
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
 				return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
@@ -205,7 +193,6 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 					break
 					break
 				}
 				}
 			}
 			}
-			hasFields[0] |= uint64(0x00000002)
 		default:
 		default:
 			var sizeOfWire int
 			var sizeOfWire int
 			for {
 			for {
@@ -227,12 +214,6 @@ func (m *Snapshot) Unmarshal(data []byte) error {
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
-	if hasFields[0]&uint64(0x00000001) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("index")
-	}
-	if hasFields[0]&uint64(0x00000002) == 0 {
-		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("term")
-	}
 
 
 	return nil
 	return nil
 }
 }

+ 1 - 0
wal/walpb/record.proto

@@ -1,3 +1,4 @@
+syntax = "proto2";
 package walpb;
 package walpb;
 
 
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";