Browse Source

Merge pull request #3434 from xiang90/index_revision

*: v3api index->revision
Xiang Li 10 years ago
parent
commit
778f8d8fea

+ 23 - 23
Documentation/rfc/v3api.md

@@ -42,7 +42,7 @@ Put( PutRequest { key = foo, value = bar } )
 PutResponse { 
 PutResponse { 
     cluster_id = 0x1000,
     cluster_id = 0x1000,
     member_id = 0x1,
     member_id = 0x1,
-    index = 1,
+    revision = 1,
     raft_term = 0x1,
     raft_term = 0x1,
 }
 }
 ```
 ```
@@ -54,14 +54,14 @@ Get ( RangeRequest { key = foo } )
 RangeResponse {
 RangeResponse {
     cluster_id = 0x1000,
     cluster_id = 0x1000,
     member_id = 0x1,
     member_id = 0x1,
-    index = 1,
+    revision = 1,
     raft_term = 0x1,
     raft_term = 0x1,
     kvs = {
     kvs = {
       {
       {
           key = foo,
           key = foo,
           value = bar,
           value = bar,
-          create_index = 1,
-          mod_index = 1,
+          create_revision = 1,
+          mod_revision = 1,
           version = 1;
           version = 1;
       },
       },
     },
     },
@@ -75,22 +75,22 @@ Range ( RangeRequest { key = foo, end_key = foo80, limit = 30  } )
 RangeResponse {
 RangeResponse {
     cluster_id = 0x1000,
     cluster_id = 0x1000,
     member_id = 0x1,
     member_id = 0x1,
-    index = 100,
+    revision = 100,
     raft_term = 0x1,
     raft_term = 0x1,
     kvs = {
     kvs = {
       {
       {
           key = foo0,
           key = foo0,
           value = bar0,
           value = bar0,
-          create_index = 1,
-          mod_index = 1,
+          create_revision = 1,
+          mod_revision = 1,
           version = 1;
           version = 1;
       },
       },
          ...,
          ...,
       {
       {
           key = foo30,
           key = foo30,
           value = bar30,
           value = bar30,
-          create_index = 30,
-          mod_index = 30,
+          create_revision = 30,
+          mod_revision = 30,
           version = 1;
           version = 1;
       },
       },
     },
     },
@@ -100,10 +100,10 @@ RangeResponse {
 #### Finish a txn (assume we have foo0=bar0, foo1=bar1)
 #### Finish a txn (assume we have foo0=bar0, foo1=bar1)
 ```
 ```
 Txn(TxnRequest {
 Txn(TxnRequest {
-    // mod_index of foo0 is equal to 1, mod_index of foo1 is greater than 1
+    // mod_revision of foo0 is equal to 1, mod_revision of foo1 is greater than 1
     compare = {
     compare = {
-        {compareType = equal, key = foo0, mod_index = 1}, 
-        {compareType = greater, key = foo1, mod_index = 1}}
+        {compareType = equal, key = foo0, mod_revision = 1}, 
+        {compareType = greater, key = foo1, mod_revision = 1}}
     },
     },
     // if the comparison succeeds, put foo2 = bar2
     // if the comparison succeeds, put foo2 = bar2
     success = {PutRequest { key = foo2, value = success }},
     success = {PutRequest { key = foo2, value = success }},
@@ -114,7 +114,7 @@ Txn(TxnRequest {
 TxnResponse {
 TxnResponse {
     cluster_id = 0x1000,
     cluster_id = 0x1000,
     member_id = 0x1,
     member_id = 0x1,
-    index = 3,
+    revision = 3,
     raft_term = 0x1,
     raft_term = 0x1,
     succeeded = true,
     succeeded = true,
     responses = {
     responses = {
@@ -122,7 +122,7 @@ TxnResponse {
       {
       {
             cluster_id = 0x1000,
             cluster_id = 0x1000,
             member_id = 0x1,
             member_id = 0x1,
-            index = 3,
+            revision = 3,
             raft_term = 0x1,
             raft_term = 0x1,
         }
         }
     }
     }
@@ -135,8 +135,8 @@ TxnResponse {
 Watch( WatchRequest{
 Watch( WatchRequest{
            key = foo,
            key = foo,
            end_key = fop, // prefix foo
            end_key = fop, // prefix foo
-           start_index = 20,
-           end_index = 10000,
+           start_revision = 20,
+           end_revision = 10000,
            // server decided notification frequency
            // server decided notification frequency
            progress_notification = true,
            progress_notification = true,
        } 
        } 
@@ -147,14 +147,14 @@ Watch( WatchRequest{
 WatchResponse {
 WatchResponse {
     cluster_id = 0x1000,
     cluster_id = 0x1000,
     member_id = 0x1,
     member_id = 0x1,
-    index = 3,
+    revision = 3,
     raft_term = 0x1,
     raft_term = 0x1,
     event_type = put,
     event_type = put,
     kv = {
     kv = {
               key = foo0,
               key = foo0,
               value = bar0,
               value = bar0,
-              create_index = 1,
-              mod_index = 1,
+              create_revision = 1,
+              mod_revision = 1,
               version = 1;
               version = 1;
           },
           },
     }
     }
@@ -164,7 +164,7 @@ WatchResponse {
     WatchResponse {
     WatchResponse {
         cluster_id = 0x1000,
         cluster_id = 0x1000,
         member_id = 0x1,
         member_id = 0x1,
-        index = 2000,
+        revision = 2000,
         raft_term = 0x1,
         raft_term = 0x1,
         // nil event as notification
         // nil event as notification
     }
     }
@@ -175,14 +175,14 @@ WatchResponse {
     WatchResponse {
     WatchResponse {
         cluster_id = 0x1000,
         cluster_id = 0x1000,
         member_id = 0x1,
         member_id = 0x1,
-        index = 3000,
+        revision = 3000,
         raft_term = 0x1,
         raft_term = 0x1,
         event_type = put,
         event_type = put,
         kv = {
         kv = {
                 key = foo0,
                 key = foo0,
                 value = bar3000,
                 value = bar3000,
-                create_index = 1,
-                mod_index = 3000,
+                create_revision = 1,
+                mod_revision = 3000,
                 version = 2;
                 version = 2;
           },
           },
     }
     }

+ 21 - 21
Documentation/rfc/v3api.proto

@@ -6,18 +6,18 @@ service etcd {
   rpc Range(RangeRequest) returns (RangeResponse) {}
   rpc Range(RangeRequest) returns (RangeResponse) {}
 
 
   // Put puts the given key into the store.
   // Put puts the given key into the store.
-  // A put request increases the index of the store,
+  // A put request increases the revision of the store,
   // and generates one event in the event history.
   // and generates one event in the event history.
   rpc Put(PutRequest) returns (PutResponse) {}
   rpc Put(PutRequest) returns (PutResponse) {}
 
 
   // Delete deletes the given range from the store.
   // Delete deletes the given range from the store.
-  // A delete request increase the index of the store,
+  // A delete request increase the revision of the store,
   // and generates one event in the event history.
   // and generates one event in the event history.
   rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {}
   rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {}
 
 
   // Txn processes all the requests in one transaction.
   // Txn processes all the requests in one transaction.
-  // A txn request increases the index of the store,
-  // and generates events with the same index in the event history.
+  // A txn request increases the revision of the store,
+  // and generates events with the same revision in the event history.
   rpc Txn(TxnRequest) returns (TxnResponse) {}
   rpc Txn(TxnRequest) returns (TxnResponse) {}
 
 
   // Watch watches the events happening or happened in etcd. Both input and output
   // Watch watches the events happening or happened in etcd. Both input and output
@@ -55,8 +55,8 @@ message ResponseHeader {
   string error = 1;
   string error = 1;
   uint64 cluster_id = 2;
   uint64 cluster_id = 2;
   uint64 member_id = 3;
   uint64 member_id = 3;
-  // index of the store when the request was applied.
-  int64 index = 4;
+  // revision of the store when the request was applied.
+  int64 revision = 4;
   // term of raft when the request was applied.
   // term of raft when the request was applied.
   uint64 raft_term = 5;
   uint64 raft_term = 5;
 }
 }
@@ -137,10 +137,10 @@ message Compare {
   oneof target_union {
   oneof target_union {
     // version of the given key
     // version of the given key
     int64 version = 4;
     int64 version = 4;
-    // create index of the given key
-    int64 create_index = 5;
-    // last modified index of the given key
-    int64 mod_index = 6;
+    // create revision of the given key
+    int64 create_revision = 5;
+    // last modified revision of the given key
+    int64 mod_revision = 6;
     // value of the given key
     // value of the given key
     bytes value = 7;
     bytes value = 7;
   }
   }
@@ -180,9 +180,9 @@ message TxnResponse {
 
 
 message KeyValue {
 message KeyValue {
   bytes key = 1;
   bytes key = 1;
-  int64 create_index = 2;
-  // mod_index is the last modified index of the key.
-  int64 mod_index = 3;
+  int64 create_revision = 2;
+  // mod_revision is the last modified revision of the key.
+  int64 mod_revision = 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.
@@ -195,10 +195,10 @@ message WatchRangeRequest {
   bytes key = 1;
   bytes key = 1;
   // if the range_end is given, it gets the keys in range [key, range_end).
   // if the range_end is given, it gets the keys in range [key, range_end).
   bytes range_end = 2;
   bytes range_end = 2;
-  // start_index is an optional index (including) to watch from. No start_index is "now".
-  int64 start_index = 3;
-  // end_index is an optional index (excluding) to end watch. No end_index is "forever".
-  int64 end_index = 4;
+  // start_revision is an optional revision (including) to watch from. No start_revision is "now".
+  int64 start_revision = 3;
+  // end_revision is an optional revision (excluding) to end watch. No end_revision is "forever".
+  int64 end_revision = 4;
   bool progress_notification = 5;
   bool progress_notification = 5;
 }
 }
 
 
@@ -220,12 +220,12 @@ message Event {
   KeyValue kv = 2;
   KeyValue kv = 2;
 }
 }
 
 
-// Compaction compacts the kv store upto the given index (including). 
+// Compaction compacts the kv store upto the given revision (including). 
 // It removes the old versions of a key. It keeps the newest version of 
 // It removes the old versions of a key. It keeps the newest version of 
-// the key even if its latest modification index is smaller than the given 
-// index.
+// the key even if its latest modification revision is smaller than the given 
+// revision.
 message CompactionRequest {
 message CompactionRequest {
-  int64 index = 1;
+  int64 revision = 1;
 }
 }
 
 
 message CompactionResponse {
 message CompactionResponse {

+ 46 - 46
etcdserver/etcdserverpb/rpc.pb.go

@@ -74,8 +74,8 @@ type ResponseHeader struct {
 	Error     string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
 	Error     string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
 	ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id,proto3" json:"cluster_id,omitempty"`
 	ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id,proto3" json:"cluster_id,omitempty"`
 	MemberId  uint64 `protobuf:"varint,3,opt,name=member_id,proto3" json:"member_id,omitempty"`
 	MemberId  uint64 `protobuf:"varint,3,opt,name=member_id,proto3" json:"member_id,omitempty"`
-	// index of the store when the request was applied.
-	Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
+	// revision of the store when the request was applied.
+	Revision int64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"`
 	// term of raft when the request was applied.
 	// term of raft when the request was applied.
 	RaftTerm uint64 `protobuf:"varint,5,opt,name=raft_term,proto3" json:"raft_term,omitempty"`
 	RaftTerm uint64 `protobuf:"varint,5,opt,name=raft_term,proto3" json:"raft_term,omitempty"`
 }
 }
@@ -246,10 +246,10 @@ type Compare struct {
 	Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
 	Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
 	// version of the given key
 	// version of the given key
 	Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
 	Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
-	// create index of the given key
-	CreateIndex int64 `protobuf:"varint,5,opt,name=create_index,proto3" json:"create_index,omitempty"`
-	// last modified index of the given key
-	ModIndex int64 `protobuf:"varint,6,opt,name=mod_index,proto3" json:"mod_index,omitempty"`
+	// create revision of the given key
+	CreateRevision int64 `protobuf:"varint,5,opt,name=create_revision,proto3" json:"create_revision,omitempty"`
+	// last modified revision of the given key
+	ModRevision int64 `protobuf:"varint,6,opt,name=mod_revision,proto3" json:"mod_revision,omitempty"`
 	// value of the given key
 	// value of the given key
 	Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
 	Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
 }
 }
@@ -328,12 +328,12 @@ func (m *TxnResponse) GetResponses() []*ResponseUnion {
 	return nil
 	return nil
 }
 }
 
 
-// Compaction compacts the kv store upto the given index (including).
+// Compaction compacts the kv store upto the given revision (including).
 // It removes the old versions of a key. It keeps the newest version of
 // It removes the old versions of a key. It keeps the newest version of
-// the key even if its latest modification index is smaller than the given
-// index.
+// the key even if its latest modification revision is smaller than the given
+// revision.
 type CompactionRequest struct {
 type CompactionRequest struct {
-	Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
+	Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
 }
 }
 
 
 func (m *CompactionRequest) Reset()         { *m = CompactionRequest{} }
 func (m *CompactionRequest) Reset()         { *m = CompactionRequest{} }
@@ -370,16 +370,16 @@ type EtcdClient interface {
 	// Range gets the keys in the range from the store.
 	// Range gets the keys in the range from the store.
 	Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error)
 	Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error)
 	// Put puts the given key into the store.
 	// Put puts the given key into the store.
-	// A put request increases the index of the store,
+	// A put request increases the revision of the store,
 	// and generates one event in the event history.
 	// and generates one event in the event history.
 	Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
 	Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
 	// Delete deletes the given range from the store.
 	// Delete deletes the given range from the store.
-	// A delete request increase the index of the store,
+	// A delete request increase the revision of the store,
 	// and generates one event in the event history.
 	// and generates one event in the event history.
 	DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error)
 	DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error)
 	// Txn processes all the requests in one transaction.
 	// Txn processes all the requests in one transaction.
-	// A txn request increases the index of the store,
-	// and generates events with the same index in the event history.
+	// A txn request increases the revision of the store,
+	// and generates events with the same revision in the event history.
 	Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error)
 	Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error)
 	// Compact compacts the event history in etcd. User should compact the
 	// Compact compacts the event history in etcd. User should compact the
 	// event history periodically, or it will grow infinitely.
 	// event history periodically, or it will grow infinitely.
@@ -445,16 +445,16 @@ type EtcdServer interface {
 	// Range gets the keys in the range from the store.
 	// Range gets the keys in the range from the store.
 	Range(context.Context, *RangeRequest) (*RangeResponse, error)
 	Range(context.Context, *RangeRequest) (*RangeResponse, error)
 	// Put puts the given key into the store.
 	// Put puts the given key into the store.
-	// A put request increases the index of the store,
+	// A put request increases the revision of the store,
 	// and generates one event in the event history.
 	// and generates one event in the event history.
 	Put(context.Context, *PutRequest) (*PutResponse, error)
 	Put(context.Context, *PutRequest) (*PutResponse, error)
 	// Delete deletes the given range from the store.
 	// Delete deletes the given range from the store.
-	// A delete request increase the index of the store,
+	// A delete request increase the revision of the store,
 	// and generates one event in the event history.
 	// and generates one event in the event history.
 	DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error)
 	DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error)
 	// Txn processes all the requests in one transaction.
 	// Txn processes all the requests in one transaction.
-	// A txn request increases the index of the store,
-	// and generates events with the same index in the event history.
+	// A txn request increases the revision of the store,
+	// and generates events with the same revision in the event history.
 	Txn(context.Context, *TxnRequest) (*TxnResponse, error)
 	Txn(context.Context, *TxnRequest) (*TxnResponse, error)
 	// Compact compacts the event history in etcd. User should compact the
 	// Compact compacts the event history in etcd. User should compact the
 	// event history periodically, or it will grow infinitely.
 	// event history periodically, or it will grow infinitely.
@@ -584,10 +584,10 @@ func (m *ResponseHeader) MarshalTo(data []byte) (int, error) {
 		i++
 		i++
 		i = encodeVarintRpc(data, i, uint64(m.MemberId))
 		i = encodeVarintRpc(data, i, uint64(m.MemberId))
 	}
 	}
-	if m.Index != 0 {
+	if m.Revision != 0 {
 		data[i] = 0x20
 		data[i] = 0x20
 		i++
 		i++
-		i = encodeVarintRpc(data, i, uint64(m.Index))
+		i = encodeVarintRpc(data, i, uint64(m.Revision))
 	}
 	}
 	if m.RaftTerm != 0 {
 	if m.RaftTerm != 0 {
 		data[i] = 0x28
 		data[i] = 0x28
@@ -949,15 +949,15 @@ func (m *Compare) MarshalTo(data []byte) (int, error) {
 		i++
 		i++
 		i = encodeVarintRpc(data, i, uint64(m.Version))
 		i = encodeVarintRpc(data, i, uint64(m.Version))
 	}
 	}
-	if m.CreateIndex != 0 {
+	if m.CreateRevision != 0 {
 		data[i] = 0x28
 		data[i] = 0x28
 		i++
 		i++
-		i = encodeVarintRpc(data, i, uint64(m.CreateIndex))
+		i = encodeVarintRpc(data, i, uint64(m.CreateRevision))
 	}
 	}
-	if m.ModIndex != 0 {
+	if m.ModRevision != 0 {
 		data[i] = 0x30
 		data[i] = 0x30
 		i++
 		i++
-		i = encodeVarintRpc(data, i, uint64(m.ModIndex))
+		i = encodeVarintRpc(data, i, uint64(m.ModRevision))
 	}
 	}
 	if m.Value != nil {
 	if m.Value != nil {
 		if len(m.Value) > 0 {
 		if len(m.Value) > 0 {
@@ -1089,10 +1089,10 @@ func (m *CompactionRequest) MarshalTo(data []byte) (int, error) {
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
-	if m.Index != 0 {
+	if m.Revision != 0 {
 		data[i] = 0x8
 		data[i] = 0x8
 		i++
 		i++
-		i = encodeVarintRpc(data, i, uint64(m.Index))
+		i = encodeVarintRpc(data, i, uint64(m.Revision))
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }
@@ -1165,8 +1165,8 @@ func (m *ResponseHeader) Size() (n int) {
 	if m.MemberId != 0 {
 	if m.MemberId != 0 {
 		n += 1 + sovRpc(uint64(m.MemberId))
 		n += 1 + sovRpc(uint64(m.MemberId))
 	}
 	}
-	if m.Index != 0 {
-		n += 1 + sovRpc(uint64(m.Index))
+	if m.Revision != 0 {
+		n += 1 + sovRpc(uint64(m.Revision))
 	}
 	}
 	if m.RaftTerm != 0 {
 	if m.RaftTerm != 0 {
 		n += 1 + sovRpc(uint64(m.RaftTerm))
 		n += 1 + sovRpc(uint64(m.RaftTerm))
@@ -1327,11 +1327,11 @@ func (m *Compare) Size() (n int) {
 	if m.Version != 0 {
 	if m.Version != 0 {
 		n += 1 + sovRpc(uint64(m.Version))
 		n += 1 + sovRpc(uint64(m.Version))
 	}
 	}
-	if m.CreateIndex != 0 {
-		n += 1 + sovRpc(uint64(m.CreateIndex))
+	if m.CreateRevision != 0 {
+		n += 1 + sovRpc(uint64(m.CreateRevision))
 	}
 	}
-	if m.ModIndex != 0 {
-		n += 1 + sovRpc(uint64(m.ModIndex))
+	if m.ModRevision != 0 {
+		n += 1 + sovRpc(uint64(m.ModRevision))
 	}
 	}
 	if m.Value != nil {
 	if m.Value != nil {
 		l = len(m.Value)
 		l = len(m.Value)
@@ -1388,8 +1388,8 @@ func (m *TxnResponse) Size() (n int) {
 func (m *CompactionRequest) Size() (n int) {
 func (m *CompactionRequest) Size() (n int) {
 	var l int
 	var l int
 	_ = l
 	_ = l
-	if m.Index != 0 {
-		n += 1 + sovRpc(uint64(m.Index))
+	if m.Revision != 0 {
+		n += 1 + sovRpc(uint64(m.Revision))
 	}
 	}
 	return n
 	return n
 }
 }
@@ -1496,16 +1496,16 @@ func (m *ResponseHeader) Unmarshal(data []byte) error {
 			}
 			}
 		case 4:
 		case 4:
 			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 Revision", wireType)
 			}
 			}
-			m.Index = 0
+			m.Revision = 0
 			for shift := uint(0); ; shift += 7 {
 			for shift := uint(0); ; shift += 7 {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
 				b := data[iNdEx]
 				b := data[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.Index |= (int64(b) & 0x7F) << shift
+				m.Revision |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}
@@ -2503,32 +2503,32 @@ func (m *Compare) Unmarshal(data []byte) error {
 			}
 			}
 		case 5:
 		case 5:
 			if wireType != 0 {
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field CreateIndex", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType)
 			}
 			}
-			m.CreateIndex = 0
+			m.CreateRevision = 0
 			for shift := uint(0); ; shift += 7 {
 			for shift := uint(0); ; shift += 7 {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
 				b := data[iNdEx]
 				b := data[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.CreateIndex |= (int64(b) & 0x7F) << shift
+				m.CreateRevision |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}
 			}
 			}
 		case 6:
 		case 6:
 			if wireType != 0 {
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field ModIndex", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType)
 			}
 			}
-			m.ModIndex = 0
+			m.ModRevision = 0
 			for shift := uint(0); ; shift += 7 {
 			for shift := uint(0); ; shift += 7 {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
 				b := data[iNdEx]
 				b := data[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.ModIndex |= (int64(b) & 0x7F) << shift
+				m.ModRevision |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}
@@ -2854,16 +2854,16 @@ func (m *CompactionRequest) Unmarshal(data []byte) error {
 		switch fieldNum {
 		switch fieldNum {
 		case 1:
 		case 1:
 			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 Revision", wireType)
 			}
 			}
-			m.Index = 0
+			m.Revision = 0
 			for shift := uint(0); ; shift += 7 {
 			for shift := uint(0); ; shift += 7 {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
 				b := data[iNdEx]
 				b := data[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.Index |= (int64(b) & 0x7F) << shift
+				m.Revision |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}

+ 14 - 14
etcdserver/etcdserverpb/rpc.proto

@@ -13,18 +13,18 @@ service etcd {
   rpc Range(RangeRequest) returns (RangeResponse) {}
   rpc Range(RangeRequest) returns (RangeResponse) {}
 
 
   // Put puts the given key into the store.
   // Put puts the given key into the store.
-  // A put request increases the index of the store,
+  // A put request increases the revision of the store,
   // and generates one event in the event history.
   // and generates one event in the event history.
   rpc Put(PutRequest) returns (PutResponse) {}
   rpc Put(PutRequest) returns (PutResponse) {}
 
 
   // Delete deletes the given range from the store.
   // Delete deletes the given range from the store.
-  // A delete request increase the index of the store,
+  // A delete request increase the revision of the store,
   // and generates one event in the event history.
   // and generates one event in the event history.
   rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {}
   rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {}
 
 
   // Txn processes all the requests in one transaction.
   // Txn processes all the requests in one transaction.
-  // A txn request increases the index of the store,
-  // and generates events with the same index in the event history.
+  // A txn request increases the revision of the store,
+  // and generates events with the same revision in the event history.
   rpc Txn(TxnRequest) returns (TxnResponse) {}
   rpc Txn(TxnRequest) returns (TxnResponse) {}
 
 
   // Compact compacts the event history in etcd. User should compact the
   // Compact compacts the event history in etcd. User should compact the
@@ -37,8 +37,8 @@ message ResponseHeader {
   string error = 1;
   string error = 1;
   uint64 cluster_id = 2;
   uint64 cluster_id = 2;
   uint64 member_id = 3;
   uint64 member_id = 3;
-  // index of the store when the request was applied.
-  int64 index = 4;
+  // revision of the store when the request was applied.
+  int64 revision = 4;
   // term of raft when the request was applied.
   // term of raft when the request was applied.
   uint64 raft_term = 5;
   uint64 raft_term = 5;
 }
 }
@@ -119,10 +119,10 @@ message Compare {
   oneof target_union {
   oneof target_union {
     // version of the given key
     // version of the given key
     int64 version = 4;
     int64 version = 4;
-    // create index of the given key
-    int64 create_index = 5;
-    // last modified index of the given key
-    int64 mod_index = 6;
+    // create revision of the given key
+    int64 create_revision = 5;
+    // last modified revision of the given key
+    int64 mod_revision = 6;
     // value of the given key
     // value of the given key
     bytes value = 7;
     bytes value = 7;
   }
   }
@@ -160,12 +160,12 @@ message TxnResponse {
   repeated ResponseUnion responses = 3;
   repeated ResponseUnion responses = 3;
 }
 }
 
 
-// Compaction compacts the kv store upto the given index (including).
+// Compaction compacts the kv store upto the given revision (including).
 // It removes the old versions of a key. It keeps the newest version of
 // It removes the old versions of a key. It keeps the newest version of
-// the key even if its latest modification index is smaller than the given
-// index.
+// the key even if its latest modification revision is smaller than the given
+// revision.
 message CompactionRequest {
 message CompactionRequest {
-  int64 index = 1;
+  int64 revision = 1;
 }
 }
 
 
 message CompactionResponse {
 message CompactionResponse {

+ 9 - 9
etcdserver/v3demo_server.go

@@ -36,7 +36,7 @@ func (s *EtcdServer) V3DemoDo(ctx context.Context, r pb.InternalRaftRequest) pro
 	case r.DeleteRange != nil:
 	case r.DeleteRange != nil:
 		return doDeleteRange(s.kv, r.DeleteRange)
 		return doDeleteRange(s.kv, r.DeleteRange)
 	case r.Txn != nil:
 	case r.Txn != nil:
-		var index int64
+		var revision int64
 		rt := r.Txn
 		rt := r.Txn
 
 
 		ok := true
 		ok := true
@@ -46,7 +46,7 @@ func (s *EtcdServer) V3DemoDo(ctx context.Context, r pb.InternalRaftRequest) pro
 				ok = false
 				ok = false
 				break
 				break
 			}
 			}
-			index = rev
+			revision = rev
 			kv := kvs[0]
 			kv := kvs[0]
 
 
 			// -1 is less, 0 is equal, 1 is greater
 			// -1 is less, 0 is equal, 1 is greater
@@ -55,9 +55,9 @@ func (s *EtcdServer) V3DemoDo(ctx context.Context, r pb.InternalRaftRequest) pro
 			case pb.Compare_VALUE:
 			case pb.Compare_VALUE:
 				result = bytes.Compare(kv.Value, c.Value)
 				result = bytes.Compare(kv.Value, c.Value)
 			case pb.Compare_CREATE:
 			case pb.Compare_CREATE:
-				result = compareInt64(kv.CreateIndex, c.CreateIndex)
+				result = compareInt64(kv.CreateRevision, c.CreateRevision)
 			case pb.Compare_MOD:
 			case pb.Compare_MOD:
-				result = compareInt64(kv.ModIndex, c.ModIndex)
+				result = compareInt64(kv.ModRevision, c.ModRevision)
 			case pb.Compare_VERSION:
 			case pb.Compare_VERSION:
 				result = compareInt64(kv.Version, c.Version)
 				result = compareInt64(kv.Version, c.Version)
 			}
 			}
@@ -93,12 +93,12 @@ func (s *EtcdServer) V3DemoDo(ctx context.Context, r pb.InternalRaftRequest) pro
 			resps[i] = doUnion(s.kv, reqs[i])
 			resps[i] = doUnion(s.kv, reqs[i])
 		}
 		}
 		if len(resps) != 0 {
 		if len(resps) != 0 {
-			index += 1
+			revision += 1
 		}
 		}
 
 
 		txnResp := &pb.TxnResponse{}
 		txnResp := &pb.TxnResponse{}
 		txnResp.Header = &pb.ResponseHeader{}
 		txnResp.Header = &pb.ResponseHeader{}
-		txnResp.Header.Index = index
+		txnResp.Header.Revision = revision
 		txnResp.Responses = resps
 		txnResp.Responses = resps
 		txnResp.Succeeded = ok
 		txnResp.Succeeded = ok
 		return txnResp
 		return txnResp
@@ -122,7 +122,7 @@ func doPut(kv dstorage.KV, p *pb.PutRequest) *pb.PutResponse {
 	resp := &pb.PutResponse{}
 	resp := &pb.PutResponse{}
 	resp.Header = &pb.ResponseHeader{}
 	resp.Header = &pb.ResponseHeader{}
 	rev := kv.Put(p.Key, p.Value)
 	rev := kv.Put(p.Key, p.Value)
-	resp.Header.Index = rev
+	resp.Header.Revision = rev
 	return resp
 	return resp
 }
 }
 
 
@@ -134,7 +134,7 @@ func doRange(kv dstorage.KV, r *pb.RangeRequest) *pb.RangeResponse {
 		panic("not handled error")
 		panic("not handled error")
 	}
 	}
 
 
-	resp.Header.Index = rev
+	resp.Header.Revision = rev
 	for i := range kvs {
 	for i := range kvs {
 		resp.Kvs = append(resp.Kvs, &kvs[i])
 		resp.Kvs = append(resp.Kvs, &kvs[i])
 	}
 	}
@@ -145,7 +145,7 @@ func doDeleteRange(kv dstorage.KV, dr *pb.DeleteRangeRequest) *pb.DeleteRangeRes
 	resp := &pb.DeleteRangeResponse{}
 	resp := &pb.DeleteRangeResponse{}
 	resp.Header = &pb.ResponseHeader{}
 	resp.Header = &pb.ResponseHeader{}
 	_, rev := kv.DeleteRange(dr.Key, dr.RangeEnd)
 	_, rev := kv.DeleteRange(dr.Key, dr.RangeEnd)
-	resp.Header.Index = rev
+	resp.Header.Revision = rev
 	return resp
 	return resp
 }
 }
 
 

+ 18 - 18
storage/kv_test.go

@@ -82,9 +82,9 @@ func testKVRange(t *testing.T, f rangeFunc) {
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	kvs := []storagepb.KeyValue{
 	kvs := []storagepb.KeyValue{
-		{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: 1, ModIndex: 1, Version: 1},
-		{Key: []byte("foo1"), Value: []byte("bar1"), CreateIndex: 2, ModIndex: 2, Version: 1},
-		{Key: []byte("foo2"), Value: []byte("bar2"), CreateIndex: 3, ModIndex: 3, Version: 1},
+		{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1},
+		{Key: []byte("foo1"), Value: []byte("bar1"), CreateRevision: 2, ModRevision: 2, Version: 1},
+		{Key: []byte("foo2"), Value: []byte("bar2"), CreateRevision: 3, ModRevision: 3, Version: 1},
 	}
 	}
 
 
 	wrev := int64(3)
 	wrev := int64(3)
@@ -149,9 +149,9 @@ func testKVRangeRev(t *testing.T, f rangeFunc) {
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	kvs := []storagepb.KeyValue{
 	kvs := []storagepb.KeyValue{
-		{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: 1, ModIndex: 1, Version: 1},
-		{Key: []byte("foo1"), Value: []byte("bar1"), CreateIndex: 2, ModIndex: 2, Version: 1},
-		{Key: []byte("foo2"), Value: []byte("bar2"), CreateIndex: 3, ModIndex: 3, Version: 1},
+		{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1},
+		{Key: []byte("foo1"), Value: []byte("bar1"), CreateRevision: 2, ModRevision: 2, Version: 1},
+		{Key: []byte("foo2"), Value: []byte("bar2"), CreateRevision: 3, ModRevision: 3, Version: 1},
 	}
 	}
 
 
 	tests := []struct {
 	tests := []struct {
@@ -223,9 +223,9 @@ func testKVRangeLimit(t *testing.T, f rangeFunc) {
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	kvs := []storagepb.KeyValue{
 	kvs := []storagepb.KeyValue{
-		{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: 1, ModIndex: 1, Version: 1},
-		{Key: []byte("foo1"), Value: []byte("bar1"), CreateIndex: 2, ModIndex: 2, Version: 1},
-		{Key: []byte("foo2"), Value: []byte("bar2"), CreateIndex: 3, ModIndex: 3, Version: 1},
+		{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1},
+		{Key: []byte("foo1"), Value: []byte("bar1"), CreateRevision: 2, ModRevision: 2, Version: 1},
+		{Key: []byte("foo2"), Value: []byte("bar2"), CreateRevision: 3, ModRevision: 3, Version: 1},
 	}
 	}
 
 
 	wrev := int64(3)
 	wrev := int64(3)
@@ -276,7 +276,7 @@ func testKVPutMultipleTimes(t *testing.T, f putFunc) {
 			t.Fatal(err)
 			t.Fatal(err)
 		}
 		}
 		wkvs := []storagepb.KeyValue{
 		wkvs := []storagepb.KeyValue{
-			{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: 1, ModIndex: base, Version: base},
+			{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: base, Version: base},
 		}
 		}
 		if !reflect.DeepEqual(kvs, wkvs) {
 		if !reflect.DeepEqual(kvs, wkvs) {
 			t.Errorf("#%d: kvs = %+v, want %+v", i, kvs, wkvs)
 			t.Errorf("#%d: kvs = %+v, want %+v", i, kvs, wkvs)
@@ -377,7 +377,7 @@ func TestKVOperationInSequence(t *testing.T) {
 			t.Fatal(err)
 			t.Fatal(err)
 		}
 		}
 		wkvs := []storagepb.KeyValue{
 		wkvs := []storagepb.KeyValue{
-			{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: base + 1, ModIndex: base + 1, Version: 1},
+			{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: base + 1, ModRevision: base + 1, Version: 1},
 		}
 		}
 		if !reflect.DeepEqual(kvs, wkvs) {
 		if !reflect.DeepEqual(kvs, wkvs) {
 			t.Errorf("#%d: kvs = %+v, want %+v", i, kvs, wkvs)
 			t.Errorf("#%d: kvs = %+v, want %+v", i, kvs, wkvs)
@@ -494,7 +494,7 @@ func TestKVTnxOperationInSequence(t *testing.T) {
 			t.Fatal(err)
 			t.Fatal(err)
 		}
 		}
 		wkvs := []storagepb.KeyValue{
 		wkvs := []storagepb.KeyValue{
-			{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: base + 1, ModIndex: base + 1, Version: 1},
+			{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: base + 1, ModRevision: base + 1, Version: 1},
 		}
 		}
 		if !reflect.DeepEqual(kvs, wkvs) {
 		if !reflect.DeepEqual(kvs, wkvs) {
 			t.Errorf("#%d: kvs = %+v, want %+v", i, kvs, wkvs)
 			t.Errorf("#%d: kvs = %+v, want %+v", i, kvs, wkvs)
@@ -545,13 +545,13 @@ func TestKVCompactReserveLastValue(t *testing.T) {
 		{
 		{
 			0,
 			0,
 			[]storagepb.KeyValue{
 			[]storagepb.KeyValue{
-				{Key: []byte("foo"), Value: []byte("bar0"), CreateIndex: 1, ModIndex: 1, Version: 1},
+				{Key: []byte("foo"), Value: []byte("bar0"), CreateRevision: 1, ModRevision: 1, Version: 1},
 			},
 			},
 		},
 		},
 		{
 		{
 			1,
 			1,
 			[]storagepb.KeyValue{
 			[]storagepb.KeyValue{
-				{Key: []byte("foo"), Value: []byte("bar1"), CreateIndex: 1, ModIndex: 2, Version: 2},
+				{Key: []byte("foo"), Value: []byte("bar1"), CreateRevision: 1, ModRevision: 2, Version: 2},
 			},
 			},
 		},
 		},
 		{
 		{
@@ -561,7 +561,7 @@ func TestKVCompactReserveLastValue(t *testing.T) {
 		{
 		{
 			3,
 			3,
 			[]storagepb.KeyValue{
 			[]storagepb.KeyValue{
-				{Key: []byte("foo"), Value: []byte("bar2"), CreateIndex: 4, ModIndex: 4, Version: 1},
+				{Key: []byte("foo"), Value: []byte("bar2"), CreateRevision: 4, ModRevision: 4, Version: 1},
 			},
 			},
 		},
 		},
 	}
 	}
@@ -661,9 +661,9 @@ func TestKVSnapshot(t *testing.T) {
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo1"), []byte("bar1"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	s.Put([]byte("foo2"), []byte("bar2"))
 	wkvs := []storagepb.KeyValue{
 	wkvs := []storagepb.KeyValue{
-		{Key: []byte("foo"), Value: []byte("bar"), CreateIndex: 1, ModIndex: 1, Version: 1},
-		{Key: []byte("foo1"), Value: []byte("bar1"), CreateIndex: 2, ModIndex: 2, Version: 1},
-		{Key: []byte("foo2"), Value: []byte("bar2"), CreateIndex: 3, ModIndex: 3, Version: 1},
+		{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 1, ModRevision: 1, Version: 1},
+		{Key: []byte("foo1"), Value: []byte("bar1"), CreateRevision: 2, ModRevision: 2, Version: 1},
+		{Key: []byte("foo2"), Value: []byte("bar2"), CreateRevision: 3, ModRevision: 3, Version: 1},
 	}
 	}
 
 
 	f, err := os.Create("new_test")
 	f, err := os.Create("new_test")

+ 6 - 6
storage/kvstore.go

@@ -238,7 +238,7 @@ func (s *store) Restore() error {
 		// restore index
 		// restore index
 		switch e.Type {
 		switch e.Type {
 		case storagepb.PUT:
 		case storagepb.PUT:
-			s.kvindex.Restore(e.Kv.Key, revision{e.Kv.CreateIndex, 0}, rev, e.Kv.Version)
+			s.kvindex.Restore(e.Kv.Key, revision{e.Kv.CreateRevision, 0}, rev, e.Kv.Version)
 		case storagepb.DELETE:
 		case storagepb.DELETE:
 			s.kvindex.Tombstone(e.Kv.Key, rev)
 			s.kvindex.Tombstone(e.Kv.Key, rev)
 		default:
 		default:
@@ -344,11 +344,11 @@ func (s *store) put(key, value []byte) {
 	event := storagepb.Event{
 	event := storagepb.Event{
 		Type: storagepb.PUT,
 		Type: storagepb.PUT,
 		Kv: &storagepb.KeyValue{
 		Kv: &storagepb.KeyValue{
-			Key:         key,
-			Value:       value,
-			CreateIndex: c,
-			ModIndex:    rev,
-			Version:     ver,
+			Key:            key,
+			Value:          value,
+			CreateRevision: c,
+			ModRevision:    rev,
+			Version:        ver,
 		},
 		},
 	}
 	}
 
 

+ 25 - 25
storage/kvstore_test.go

@@ -32,11 +32,11 @@ func TestStorePut(t *testing.T) {
 			storagepb.Event{
 			storagepb.Event{
 				Type: storagepb.PUT,
 				Type: storagepb.PUT,
 				Kv: &storagepb.KeyValue{
 				Kv: &storagepb.KeyValue{
-					Key:         []byte("foo"),
-					Value:       []byte("bar"),
-					CreateIndex: 2,
-					ModIndex:    2,
-					Version:     1,
+					Key:            []byte("foo"),
+					Value:          []byte("bar"),
+					CreateRevision: 2,
+					ModRevision:    2,
+					Version:        1,
 				},
 				},
 			},
 			},
 			revision{2, 0},
 			revision{2, 0},
@@ -48,11 +48,11 @@ func TestStorePut(t *testing.T) {
 			storagepb.Event{
 			storagepb.Event{
 				Type: storagepb.PUT,
 				Type: storagepb.PUT,
 				Kv: &storagepb.KeyValue{
 				Kv: &storagepb.KeyValue{
-					Key:         []byte("foo"),
-					Value:       []byte("bar"),
-					CreateIndex: 2,
-					ModIndex:    2,
-					Version:     2,
+					Key:            []byte("foo"),
+					Value:          []byte("bar"),
+					CreateRevision: 2,
+					ModRevision:    2,
+					Version:        2,
 				},
 				},
 			},
 			},
 			revision{2, 1},
 			revision{2, 1},
@@ -64,11 +64,11 @@ func TestStorePut(t *testing.T) {
 			storagepb.Event{
 			storagepb.Event{
 				Type: storagepb.PUT,
 				Type: storagepb.PUT,
 				Kv: &storagepb.KeyValue{
 				Kv: &storagepb.KeyValue{
-					Key:         []byte("foo"),
-					Value:       []byte("bar"),
-					CreateIndex: 2,
-					ModIndex:    3,
-					Version:     3,
+					Key:            []byte("foo"),
+					Value:          []byte("bar"),
+					CreateRevision: 2,
+					ModRevision:    3,
+					Version:        3,
 				},
 				},
 			},
 			},
 			revision{3, 0},
 			revision{3, 0},
@@ -108,11 +108,11 @@ func TestStoreRange(t *testing.T) {
 	ev := storagepb.Event{
 	ev := storagepb.Event{
 		Type: storagepb.PUT,
 		Type: storagepb.PUT,
 		Kv: &storagepb.KeyValue{
 		Kv: &storagepb.KeyValue{
-			Key:         []byte("foo"),
-			Value:       []byte("bar"),
-			CreateIndex: 1,
-			ModIndex:    2,
-			Version:     1,
+			Key:            []byte("foo"),
+			Value:          []byte("bar"),
+			CreateRevision: 1,
+			ModRevision:    2,
+			Version:        1,
 		},
 		},
 	}
 	}
 	evb, err := ev.Marshal()
 	evb, err := ev.Marshal()
@@ -269,11 +269,11 @@ func TestStoreRestore(t *testing.T) {
 	putev := storagepb.Event{
 	putev := storagepb.Event{
 		Type: storagepb.PUT,
 		Type: storagepb.PUT,
 		Kv: &storagepb.KeyValue{
 		Kv: &storagepb.KeyValue{
-			Key:         []byte("foo"),
-			Value:       []byte("bar"),
-			CreateIndex: 3,
-			ModIndex:    3,
-			Version:     1,
+			Key:            []byte("foo"),
+			Value:          []byte("bar"),
+			CreateRevision: 3,
+			ModRevision:    3,
+			Version:        1,
 		},
 		},
 	}
 	}
 	putevb, err := putev.Marshal()
 	putevb, err := putev.Marshal()

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

@@ -48,10 +48,10 @@ func (x Event_EventType) String() string {
 }
 }
 
 
 type KeyValue struct {
 type KeyValue struct {
-	Key         []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
-	CreateIndex int64  `protobuf:"varint,2,opt,name=create_index,proto3" json:"create_index,omitempty"`
-	// mod_index is the last modified index of the key.
-	ModIndex int64 `protobuf:"varint,3,opt,name=mod_index,proto3" json:"mod_index,omitempty"`
+	Key            []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+	CreateRevision int64  `protobuf:"varint,2,opt,name=create_revision,proto3" json:"create_revision,omitempty"`
+	// mod_revision is the last modified revision of the key.
+	ModRevision int64 `protobuf:"varint,3,opt,name=mod_revision,proto3" json:"mod_revision,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.
@@ -101,15 +101,15 @@ func (m *KeyValue) MarshalTo(data []byte) (int, error) {
 			i += copy(data[i:], m.Key)
 			i += copy(data[i:], m.Key)
 		}
 		}
 	}
 	}
-	if m.CreateIndex != 0 {
+	if m.CreateRevision != 0 {
 		data[i] = 0x10
 		data[i] = 0x10
 		i++
 		i++
-		i = encodeVarintKv(data, i, uint64(m.CreateIndex))
+		i = encodeVarintKv(data, i, uint64(m.CreateRevision))
 	}
 	}
-	if m.ModIndex != 0 {
+	if m.ModRevision != 0 {
 		data[i] = 0x18
 		data[i] = 0x18
 		i++
 		i++
-		i = encodeVarintKv(data, i, uint64(m.ModIndex))
+		i = encodeVarintKv(data, i, uint64(m.ModRevision))
 	}
 	}
 	if m.Version != 0 {
 	if m.Version != 0 {
 		data[i] = 0x20
 		data[i] = 0x20
@@ -196,11 +196,11 @@ func (m *KeyValue) Size() (n int) {
 			n += 1 + l + sovKv(uint64(l))
 			n += 1 + l + sovKv(uint64(l))
 		}
 		}
 	}
 	}
-	if m.CreateIndex != 0 {
-		n += 1 + sovKv(uint64(m.CreateIndex))
+	if m.CreateRevision != 0 {
+		n += 1 + sovKv(uint64(m.CreateRevision))
 	}
 	}
-	if m.ModIndex != 0 {
-		n += 1 + sovKv(uint64(m.ModIndex))
+	if m.ModRevision != 0 {
+		n += 1 + sovKv(uint64(m.ModRevision))
 	}
 	}
 	if m.Version != 0 {
 	if m.Version != 0 {
 		n += 1 + sovKv(uint64(m.Version))
 		n += 1 + sovKv(uint64(m.Version))
@@ -286,32 +286,32 @@ func (m *KeyValue) Unmarshal(data []byte) error {
 			iNdEx = postIndex
 			iNdEx = postIndex
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field CreateIndex", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType)
 			}
 			}
-			m.CreateIndex = 0
+			m.CreateRevision = 0
 			for shift := uint(0); ; shift += 7 {
 			for shift := uint(0); ; shift += 7 {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
 				b := data[iNdEx]
 				b := data[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.CreateIndex |= (int64(b) & 0x7F) << shift
+				m.CreateRevision |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}
 			}
 			}
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field ModIndex", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType)
 			}
 			}
-			m.ModIndex = 0
+			m.ModRevision = 0
 			for shift := uint(0); ; shift += 7 {
 			for shift := uint(0); ; shift += 7 {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
 				b := data[iNdEx]
 				b := data[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.ModIndex |= (int64(b) & 0x7F) << shift
+				m.ModRevision |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}

+ 3 - 3
storage/storagepb/kv.proto

@@ -11,9 +11,9 @@ option (gogoproto.goproto_enum_prefix_all) = false;
 
 
 message KeyValue {
 message KeyValue {
   bytes key = 1;
   bytes key = 1;
-  int64 create_index = 2;
-  // mod_index is the last modified index of the key.
-  int64 mod_index = 3;
+  int64 create_revision = 2;
+  // mod_revision is the last modified revision of the key.
+  int64 mod_revision = 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.