*: fix proto and regenerate all go files

release-2.3
Xiang Li 2015-12-30 20:11:19 -08:00
parent 4444d92032
commit 1dc0e664f0
3 changed files with 1073 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -213,3 +213,34 @@ message WatchResponse {
// TODO: support batched events response?
storagepb.Event event = 2;
}
message LeaseCreateRequest {
// advisory ttl in seconds
int64 ttl = 1;
}
message LeaseCreateResponse {
ResponseHeader header = 1;
int64 lease_id = 2;
// server decided ttl in second
int64 ttl = 3;
string error = 4;
}
message LeaseRevokeRequest {
int64 lease_id = 1;
}
message LeaseRevokeResponse {
ResponseHeader header = 1;
}
message LeaseKeepAliveRequest {
int64 lease_id = 1;
}
message LeaseKeepAliveResponse {
ResponseHeader header = 1;
int64 lease_id = 2;
int64 ttl = 3;
}

View File

@ -57,6 +57,9 @@ type KeyValue struct {
// increases its version.
Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
// lease is the ID of the lease that attached to key.
// When the attached lease expires, the key will be deleted.
Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"`
}
func (m *KeyValue) Reset() { *m = KeyValue{} }
@ -126,6 +129,11 @@ func (m *KeyValue) MarshalTo(data []byte) (int, error) {
i += copy(data[i:], m.Value)
}
}
if m.Lease != 0 {
data[i] = 0x30
i++
i = encodeVarintKv(data, i, uint64(m.Lease))
}
return i, nil
}
@ -218,6 +226,9 @@ func (m *KeyValue) Size() (n int) {
n += 1 + l + sovKv(uint64(l))
}
}
if m.Lease != 0 {
n += 1 + sovKv(uint64(m.Lease))
}
return n
}
@ -367,6 +378,22 @@ func (m *KeyValue) Unmarshal(data []byte) error {
}
m.Value = append([]byte{}, data[iNdEx:postIndex]...)
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType)
}
m.Lease = 0
for shift := uint(0); ; shift += 7 {
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
m.Lease |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
var sizeOfWire int
for {