Last active
July 12, 2016 03:50
-
-
Save yugui/4425e705680fb4f6c99423b99b8a83d2 to your computer and use it in GitHub Desktop.
Reproducible case of https://github.com/gengo/grpc-gateway/issues/82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/golang/protobuf/jsonpb" | |
) | |
func main() { | |
const input = `{"create_request": {"key": "Zm9v"}}` | |
var req WatchRequest | |
if err := jsonpb.UnmarshalString(input, &req); err != nil { | |
log.Fatal(err) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build !gogo | |
// Code generated by protoc-gen-go. | |
// Manually added build tag by yugui | |
// | |
// source: rpc.proto | |
// DO NOT EDIT! | |
// --> Sorry, yugui added a build tag | |
/* | |
Package main is a generated protocol buffer package. | |
It is generated from these files: | |
rpc.proto | |
It has these top-level messages: | |
WatchRequest | |
WatchCreateRequest | |
WatchCancelRequest | |
*/ | |
package main | |
import proto "github.com/golang/protobuf/proto" | |
import fmt "fmt" | |
import math "math" | |
// Reference imports to suppress errors if they are not otherwise used. | |
var _ = proto.Marshal | |
var _ = fmt.Errorf | |
var _ = math.Inf | |
// This is a compile-time assertion to ensure that this generated file | |
// is compatible with the proto package it is being compiled against. | |
// A compilation error at this line likely means your copy of the | |
// proto package needs to be updated. | |
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package | |
type WatchCreateRequest_FilterType int32 | |
const ( | |
// filter out put event. | |
WatchCreateRequest_NOPUT WatchCreateRequest_FilterType = 0 | |
// filter out delete event. | |
WatchCreateRequest_NODELETE WatchCreateRequest_FilterType = 1 | |
) | |
var WatchCreateRequest_FilterType_name = map[int32]string{ | |
0: "NOPUT", | |
1: "NODELETE", | |
} | |
var WatchCreateRequest_FilterType_value = map[string]int32{ | |
"NOPUT": 0, | |
"NODELETE": 1, | |
} | |
func (x WatchCreateRequest_FilterType) String() string { | |
return proto.EnumName(WatchCreateRequest_FilterType_name, int32(x)) | |
} | |
func (WatchCreateRequest_FilterType) EnumDescriptor() ([]byte, []int) { | |
return fileDescriptor0, []int{1, 0} | |
} | |
type WatchRequest struct { | |
// request_union is a request to either create a new watcher or cancel an existing watcher. | |
// | |
// Types that are valid to be assigned to RequestUnion: | |
// *WatchRequest_CreateRequest | |
// *WatchRequest_CancelRequest | |
RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"` | |
} | |
func (m *WatchRequest) Reset() { *m = WatchRequest{} } | |
func (m *WatchRequest) String() string { return proto.CompactTextString(m) } | |
func (*WatchRequest) ProtoMessage() {} | |
func (*WatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } | |
type isWatchRequest_RequestUnion interface { | |
isWatchRequest_RequestUnion() | |
} | |
type WatchRequest_CreateRequest struct { | |
CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,oneof"` | |
} | |
type WatchRequest_CancelRequest struct { | |
CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,oneof"` | |
} | |
func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {} | |
func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {} | |
func (m *WatchRequest) GetRequestUnion() isWatchRequest_RequestUnion { | |
if m != nil { | |
return m.RequestUnion | |
} | |
return nil | |
} | |
func (m *WatchRequest) GetCreateRequest() *WatchCreateRequest { | |
if x, ok := m.GetRequestUnion().(*WatchRequest_CreateRequest); ok { | |
return x.CreateRequest | |
} | |
return nil | |
} | |
func (m *WatchRequest) GetCancelRequest() *WatchCancelRequest { | |
if x, ok := m.GetRequestUnion().(*WatchRequest_CancelRequest); ok { | |
return x.CancelRequest | |
} | |
return nil | |
} | |
// XXX_OneofFuncs is for the internal use of the proto package. | |
func (*WatchRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { | |
return _WatchRequest_OneofMarshaler, _WatchRequest_OneofUnmarshaler, _WatchRequest_OneofSizer, []interface{}{ | |
(*WatchRequest_CreateRequest)(nil), | |
(*WatchRequest_CancelRequest)(nil), | |
} | |
} | |
func _WatchRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { | |
m := msg.(*WatchRequest) | |
// request_union | |
switch x := m.RequestUnion.(type) { | |
case *WatchRequest_CreateRequest: | |
b.EncodeVarint(1<<3 | proto.WireBytes) | |
if err := b.EncodeMessage(x.CreateRequest); err != nil { | |
return err | |
} | |
case *WatchRequest_CancelRequest: | |
b.EncodeVarint(2<<3 | proto.WireBytes) | |
if err := b.EncodeMessage(x.CancelRequest); err != nil { | |
return err | |
} | |
case nil: | |
default: | |
return fmt.Errorf("WatchRequest.RequestUnion has unexpected type %T", x) | |
} | |
return nil | |
} | |
func _WatchRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { | |
m := msg.(*WatchRequest) | |
switch tag { | |
case 1: // request_union.create_request | |
if wire != proto.WireBytes { | |
return true, proto.ErrInternalBadWireType | |
} | |
msg := new(WatchCreateRequest) | |
err := b.DecodeMessage(msg) | |
m.RequestUnion = &WatchRequest_CreateRequest{msg} | |
return true, err | |
case 2: // request_union.cancel_request | |
if wire != proto.WireBytes { | |
return true, proto.ErrInternalBadWireType | |
} | |
msg := new(WatchCancelRequest) | |
err := b.DecodeMessage(msg) | |
m.RequestUnion = &WatchRequest_CancelRequest{msg} | |
return true, err | |
default: | |
return false, nil | |
} | |
} | |
func _WatchRequest_OneofSizer(msg proto.Message) (n int) { | |
m := msg.(*WatchRequest) | |
// request_union | |
switch x := m.RequestUnion.(type) { | |
case *WatchRequest_CreateRequest: | |
s := proto.Size(x.CreateRequest) | |
n += proto.SizeVarint(1<<3 | proto.WireBytes) | |
n += proto.SizeVarint(uint64(s)) | |
n += s | |
case *WatchRequest_CancelRequest: | |
s := proto.Size(x.CancelRequest) | |
n += proto.SizeVarint(2<<3 | proto.WireBytes) | |
n += proto.SizeVarint(uint64(s)) | |
n += s | |
case nil: | |
default: | |
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) | |
} | |
return n | |
} | |
type WatchCreateRequest struct { | |
// key is the key to register for watching. | |
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` | |
// range_end is the end of the range [key, range_end) to watch. If range_end is not given, | |
// only the key argument is watched. If range_end is equal to '\0', all keys greater than | |
// or equal to the key argument are watched. | |
RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` | |
// start_revision is an optional revision to watch from (inclusive). No start_revision is "now". | |
StartRevision int64 `protobuf:"varint,3,opt,name=start_revision,json=startRevision" json:"start_revision,omitempty"` | |
// progress_notify is set so that the etcd server will periodically send a WatchResponse with | |
// no events to the new watcher if there are no recent events. It is useful when clients | |
// wish to recover a disconnected watcher starting from a recent known revision. | |
// The etcd server may decide how often it will send notifications based on current load. | |
ProgressNotify bool `protobuf:"varint,4,opt,name=progress_notify,json=progressNotify" json:"progress_notify,omitempty"` | |
// filters filter the events at server side before it sends back to the watcher. | |
Filters []WatchCreateRequest_FilterType `protobuf:"varint,5,rep,name=filters,enum=main.WatchCreateRequest_FilterType" json:"filters,omitempty"` | |
// If prev_kv is set, created watcher gets the previous KV before the event happens. | |
// If the previous KV is already compacted, nothing will be returned. | |
PrevKv bool `protobuf:"varint,6,opt,name=prev_kv,json=prevKv" json:"prev_kv,omitempty"` | |
} | |
func (m *WatchCreateRequest) Reset() { *m = WatchCreateRequest{} } | |
func (m *WatchCreateRequest) String() string { return proto.CompactTextString(m) } | |
func (*WatchCreateRequest) ProtoMessage() {} | |
func (*WatchCreateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } | |
type WatchCancelRequest struct { | |
// watch_id is the watcher id to cancel so that no more events are transmitted. | |
WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId" json:"watch_id,omitempty"` | |
} | |
func (m *WatchCancelRequest) Reset() { *m = WatchCancelRequest{} } | |
func (m *WatchCancelRequest) String() string { return proto.CompactTextString(m) } | |
func (*WatchCancelRequest) ProtoMessage() {} | |
func (*WatchCancelRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } | |
func init() { | |
proto.RegisterType((*WatchRequest)(nil), "main.WatchRequest") | |
proto.RegisterType((*WatchCreateRequest)(nil), "main.WatchCreateRequest") | |
proto.RegisterType((*WatchCancelRequest)(nil), "main.WatchCancelRequest") | |
proto.RegisterEnum("main.WatchCreateRequest_FilterType", WatchCreateRequest_FilterType_name, WatchCreateRequest_FilterType_value) | |
} | |
func init() { proto.RegisterFile("rpc.proto", fileDescriptor0) } | |
var fileDescriptor0 = []byte{ | |
// 331 bytes of a gzipped FileDescriptorProto | |
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0xcd, 0x4e, 0xf2, 0x40, | |
0x14, 0x86, 0x29, 0xe5, 0xa7, 0x9c, 0xaf, 0x14, 0x32, 0x9b, 0xaf, 0xc6, 0x0d, 0xa9, 0x21, 0xb2, | |
0xaa, 0x09, 0xae, 0x5d, 0xf8, 0x53, 0xa3, 0xd1, 0x80, 0x99, 0x60, 0x5c, 0x36, 0xb5, 0x1d, 0xb0, | |
0x01, 0xa7, 0x75, 0x66, 0xc0, 0x70, 0x1b, 0xde, 0x83, 0xf7, 0xe9, 0xf4, 0x48, 0xb5, 0x09, 0x71, | |
0xd7, 0x79, 0xf2, 0x9c, 0x77, 0x4e, 0xdf, 0x81, 0x8e, 0xc8, 0x63, 0x3f, 0x17, 0x99, 0xca, 0x48, | |
0xe3, 0x35, 0x4a, 0xb9, 0xf7, 0x69, 0x80, 0xfd, 0x14, 0xa9, 0xf8, 0x85, 0xb2, 0xb7, 0x35, 0x93, | |
0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xfa, 0xf0, 0x38, 0xeb, 0xd7, 0x88, 0x0d, 0xd6, 0x64, 0x7a, 0x15, 0xdc, | |
0x07, 0xb3, 0xa0, 0x6f, 0x78, 0x27, 0x65, 0x27, 0xd5, 0xee, 0xc8, 0x01, 0x58, 0xef, 0x05, 0x0d, | |
0xd3, 0x04, 0x8b, 0x31, 0x69, 0x1b, 0xcf, 0xb7, 0xc9, 0x73, 0x0b, 0x9f, 0xfe, 0xf4, 0x2b, 0x00, | |
0x00, 0xff, 0xff, 0x75, 0xb9, 0xa2, 0xdd, 0x07, 0x02, 0x00, 0x00, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build gogo | |
// Code generated by protoc-gen-gogo. | |
// Manually added build tag by yugui | |
// | |
// source: rpc.proto | |
// DO NOT EDIT! | |
// --> Sorry, yugui added a build tag | |
/* | |
Package main is a generated protocol buffer package. | |
It is generated from these files: | |
rpc.proto | |
It has these top-level messages: | |
WatchRequest | |
WatchCreateRequest | |
WatchCancelRequest | |
*/ | |
package main | |
import proto "github.com/gogo/protobuf/proto" | |
import fmt "fmt" | |
import math "math" | |
// Reference imports to suppress errors if they are not otherwise used. | |
var _ = proto.Marshal | |
var _ = fmt.Errorf | |
var _ = math.Inf | |
// This is a compile-time assertion to ensure that this generated file | |
// is compatible with the proto package it is being compiled against. | |
const _ = proto.GoGoProtoPackageIsVersion1 | |
type WatchCreateRequest_FilterType int32 | |
const ( | |
// filter out put event. | |
WatchCreateRequest_NOPUT WatchCreateRequest_FilterType = 0 | |
// filter out delete event. | |
WatchCreateRequest_NODELETE WatchCreateRequest_FilterType = 1 | |
) | |
var WatchCreateRequest_FilterType_name = map[int32]string{ | |
0: "NOPUT", | |
1: "NODELETE", | |
} | |
var WatchCreateRequest_FilterType_value = map[string]int32{ | |
"NOPUT": 0, | |
"NODELETE": 1, | |
} | |
func (x WatchCreateRequest_FilterType) String() string { | |
return proto.EnumName(WatchCreateRequest_FilterType_name, int32(x)) | |
} | |
func (WatchCreateRequest_FilterType) EnumDescriptor() ([]byte, []int) { | |
return fileDescriptorRpc, []int{1, 0} | |
} | |
type WatchRequest struct { | |
// request_union is a request to either create a new watcher or cancel an existing watcher. | |
// | |
// Types that are valid to be assigned to RequestUnion: | |
// *WatchRequest_CreateRequest | |
// *WatchRequest_CancelRequest | |
RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"` | |
} | |
func (m *WatchRequest) Reset() { *m = WatchRequest{} } | |
func (m *WatchRequest) String() string { return proto.CompactTextString(m) } | |
func (*WatchRequest) ProtoMessage() {} | |
func (*WatchRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{0} } | |
type isWatchRequest_RequestUnion interface { | |
isWatchRequest_RequestUnion() | |
} | |
type WatchRequest_CreateRequest struct { | |
CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,oneof"` | |
} | |
type WatchRequest_CancelRequest struct { | |
CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,oneof"` | |
} | |
func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {} | |
func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {} | |
func (m *WatchRequest) GetRequestUnion() isWatchRequest_RequestUnion { | |
if m != nil { | |
return m.RequestUnion | |
} | |
return nil | |
} | |
func (m *WatchRequest) GetCreateRequest() *WatchCreateRequest { | |
if x, ok := m.GetRequestUnion().(*WatchRequest_CreateRequest); ok { | |
return x.CreateRequest | |
} | |
return nil | |
} | |
func (m *WatchRequest) GetCancelRequest() *WatchCancelRequest { | |
if x, ok := m.GetRequestUnion().(*WatchRequest_CancelRequest); ok { | |
return x.CancelRequest | |
} | |
return nil | |
} | |
// XXX_OneofFuncs is for the internal use of the proto package. | |
func (*WatchRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { | |
return _WatchRequest_OneofMarshaler, _WatchRequest_OneofUnmarshaler, _WatchRequest_OneofSizer, []interface{}{ | |
(*WatchRequest_CreateRequest)(nil), | |
(*WatchRequest_CancelRequest)(nil), | |
} | |
} | |
func _WatchRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { | |
m := msg.(*WatchRequest) | |
// request_union | |
switch x := m.RequestUnion.(type) { | |
case *WatchRequest_CreateRequest: | |
_ = b.EncodeVarint(1<<3 | proto.WireBytes) | |
if err := b.EncodeMessage(x.CreateRequest); err != nil { | |
return err | |
} | |
case *WatchRequest_CancelRequest: | |
_ = b.EncodeVarint(2<<3 | proto.WireBytes) | |
if err := b.EncodeMessage(x.CancelRequest); err != nil { | |
return err | |
} | |
case nil: | |
default: | |
return fmt.Errorf("WatchRequest.RequestUnion has unexpected type %T", x) | |
} | |
return nil | |
} | |
func _WatchRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { | |
m := msg.(*WatchRequest) | |
switch tag { | |
case 1: // request_union.create_request | |
if wire != proto.WireBytes { | |
return true, proto.ErrInternalBadWireType | |
} | |
msg := new(WatchCreateRequest) | |
err := b.DecodeMessage(msg) | |
m.RequestUnion = &WatchRequest_CreateRequest{msg} | |
return true, err | |
case 2: // request_union.cancel_request | |
if wire != proto.WireBytes { | |
return true, proto.ErrInternalBadWireType | |
} | |
msg := new(WatchCancelRequest) | |
err := b.DecodeMessage(msg) | |
m.RequestUnion = &WatchRequest_CancelRequest{msg} | |
return true, err | |
default: | |
return false, nil | |
} | |
} | |
func _WatchRequest_OneofSizer(msg proto.Message) (n int) { | |
m := msg.(*WatchRequest) | |
// request_union | |
switch x := m.RequestUnion.(type) { | |
case *WatchRequest_CreateRequest: | |
s := proto.Size(x.CreateRequest) | |
n += proto.SizeVarint(1<<3 | proto.WireBytes) | |
n += proto.SizeVarint(uint64(s)) | |
n += s | |
case *WatchRequest_CancelRequest: | |
s := proto.Size(x.CancelRequest) | |
n += proto.SizeVarint(2<<3 | proto.WireBytes) | |
n += proto.SizeVarint(uint64(s)) | |
n += s | |
case nil: | |
default: | |
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) | |
} | |
return n | |
} | |
type WatchCreateRequest struct { | |
// key is the key to register for watching. | |
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` | |
// range_end is the end of the range [key, range_end) to watch. If range_end is not given, | |
// only the key argument is watched. If range_end is equal to '\0', all keys greater than | |
// or equal to the key argument are watched. | |
RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` | |
// start_revision is an optional revision to watch from (inclusive). No start_revision is "now". | |
StartRevision int64 `protobuf:"varint,3,opt,name=start_revision,json=startRevision,proto3" json:"start_revision,omitempty"` | |
// progress_notify is set so that the etcd server will periodically send a WatchResponse with | |
// no events to the new watcher if there are no recent events. It is useful when clients | |
// wish to recover a disconnected watcher starting from a recent known revision. | |
// The etcd server may decide how often it will send notifications based on current load. | |
ProgressNotify bool `protobuf:"varint,4,opt,name=progress_notify,json=progressNotify,proto3" json:"progress_notify,omitempty"` | |
// filters filter the events at server side before it sends back to the watcher. | |
Filters []WatchCreateRequest_FilterType `protobuf:"varint,5,rep,name=filters,enum=main.WatchCreateRequest_FilterType" json:"filters,omitempty"` | |
// If prev_kv is set, created watcher gets the previous KV before the event happens. | |
// If the previous KV is already compacted, nothing will be returned. | |
PrevKv bool `protobuf:"varint,6,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` | |
} | |
func (m *WatchCreateRequest) Reset() { *m = WatchCreateRequest{} } | |
func (m *WatchCreateRequest) String() string { return proto.CompactTextString(m) } | |
func (*WatchCreateRequest) ProtoMessage() {} | |
func (*WatchCreateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1} } | |
type WatchCancelRequest struct { | |
// watch_id is the watcher id to cancel so that no more events are transmitted. | |
WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` | |
} | |
func (m *WatchCancelRequest) Reset() { *m = WatchCancelRequest{} } | |
func (m *WatchCancelRequest) String() string { return proto.CompactTextString(m) } | |
func (*WatchCancelRequest) ProtoMessage() {} | |
func (*WatchCancelRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{2} } | |
func init() { | |
proto.RegisterType((*WatchRequest)(nil), "main.WatchRequest") | |
proto.RegisterType((*WatchCreateRequest)(nil), "main.WatchCreateRequest") | |
proto.RegisterType((*WatchCancelRequest)(nil), "main.WatchCancelRequest") | |
proto.RegisterEnum("main.WatchCreateRequest_FilterType", WatchCreateRequest_FilterType_name, WatchCreateRequest_FilterType_value) | |
} | |
var fileDescriptorRpc = []byte{ | |
// 331 bytes of a gzipped FileDescriptorProto | |
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0xcd, 0x4e, 0xf2, 0x40, | |
0x14, 0x86, 0x29, 0xe5, 0xa7, 0x9c, 0xaf, 0x14, 0x32, 0x9b, 0xaf, 0xc6, 0x0d, 0xa9, 0x21, 0xb2, | |
0xaa, 0x09, 0xae, 0x5d, 0xf8, 0x53, 0xa3, 0xd1, 0x80, 0x99, 0x60, 0x5c, 0x36, 0xb5, 0x1d, 0xb0, | |
0x01, 0xa7, 0x75, 0x66, 0xc0, 0x70, 0x1b, 0xde, 0x83, 0xf7, 0xe9, 0xf4, 0x48, 0xb5, 0x09, 0x71, | |
0xd7, 0x79, 0xf2, 0x9c, 0x77, 0x4e, 0xdf, 0x81, 0x8e, 0xc8, 0x63, 0x3f, 0x17, 0x99, 0xca, 0x48, | |
0xe3, 0x35, 0x4a, 0xb9, 0xf7, 0x69, 0x80, 0xfd, 0x14, 0xa9, 0xf8, 0x85, 0xb2, 0xb7, 0x35, 0x93, | |
0x8a, 0x9c, 0x83, 0x13, 0x0b, 0x16, 0x29, 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, 0xd6, 0x64, 0x7a, 0x15, 0xdc, | |
0x07, 0xb3, 0xa0, 0x6f, 0x78, 0x27, 0x65, 0x27, 0xd5, 0xee, 0xc8, 0x01, 0x58, 0xef, 0x05, 0x0d, | |
0xd3, 0x04, 0x8b, 0x31, 0x69, 0x1b, 0xcf, 0xb7, 0xc9, 0x73, 0x0b, 0x9f, 0xfe, 0xf4, 0x2b, 0x00, | |
0x00, 0xff, 0xff, 0x75, 0xb9, 0xa2, 0xdd, 0x07, 0x02, 0x00, 0x00, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package main; | |
message WatchRequest { | |
// request_union is a request to either create a new watcher or cancel an existing watcher. | |
oneof request_union { | |
WatchCreateRequest create_request = 1; | |
WatchCancelRequest cancel_request = 2; | |
} | |
} | |
message WatchCreateRequest { | |
// key is the key to register for watching. | |
bytes key = 1; | |
// range_end is the end of the range [key, range_end) to watch. If range_end is not given, | |
// only the key argument is watched. If range_end is equal to '\0', all keys greater than | |
// or equal to the key argument are watched. | |
bytes range_end = 2; | |
// start_revision is an optional revision to watch from (inclusive). No start_revision is "now". | |
int64 start_revision = 3; | |
// progress_notify is set so that the etcd server will periodically send a WatchResponse with | |
// no events to the new watcher if there are no recent events. It is useful when clients | |
// wish to recover a disconnected watcher starting from a recent known revision. | |
// The etcd server may decide how often it will send notifications based on current load. | |
bool progress_notify = 4; | |
enum FilterType { | |
// filter out put event. | |
NOPUT = 0; | |
// filter out delete event. | |
NODELETE = 1; | |
} | |
// filters filter the events at server side before it sends back to the watcher. | |
repeated FilterType filters = 5; | |
// If prev_kv is set, created watcher gets the previous KV before the event happens. | |
// If the previous KV is already compacted, nothing will be returned. | |
bool prev_kv = 6; | |
} | |
message WatchCancelRequest { | |
// watch_id is the watcher id to cancel so that no more events are transmitted. | |
int64 watch_id = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment