proto: Add SubscribeRequest.Namespace

For subscribing to service events in a namespace
This commit is contained in:
Daniel Nephin 2020-10-27 13:27:42 -04:00
parent bc07901527
commit 74b7325839
2 changed files with 97 additions and 35 deletions

View File

@ -108,7 +108,12 @@ type SubscribeRequest struct {
// If it's not the local DC the server will forward the request to
// the remote DC and proxy the results back to the subscriber. An empty
// string defaults to the local datacenter.
Datacenter string `protobuf:"bytes,5,opt,name=Datacenter,proto3" json:"Datacenter,omitempty"`
Datacenter string `protobuf:"bytes,5,opt,name=Datacenter,proto3" json:"Datacenter,omitempty"`
// Namespace which contains the resources. If Namespace is not specified the
// default namespace will be used.
//
// Namespace is an enterprise-only feature.
Namespace string `protobuf:"bytes,6,opt,name=Namespace,proto3" json:"Namespace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -182,6 +187,13 @@ func (m *SubscribeRequest) GetDatacenter() string {
return ""
}
func (m *SubscribeRequest) GetNamespace() string {
if m != nil {
return m.Namespace
}
return ""
}
// Event describes a streaming update on a subscription. Events are used both to
// describe the current "snapshot" of the result as well as ongoing mutations to
// that snapshot.
@ -546,40 +558,41 @@ func init() {
func init() { proto.RegisterFile("proto/pbsubscribe/subscribe.proto", fileDescriptor_ab3eb8c810e315fb) }
var fileDescriptor_ab3eb8c810e315fb = []byte{
// 526 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x5f, 0x6f, 0xd2, 0x50,
0x14, 0xef, 0x85, 0x01, 0xe3, 0xe0, 0x96, 0x7a, 0x87, 0xb1, 0x61, 0x49, 0x83, 0xc4, 0x2c, 0x75,
0x89, 0xd4, 0x60, 0xa2, 0x6f, 0x1a, 0x61, 0x9b, 0x18, 0x93, 0x61, 0xca, 0xf6, 0xa0, 0x6f, 0x97,
0xf6, 0x48, 0x1b, 0xea, 0xbd, 0xb5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xac, 0x6b, 0x74, 0x1f, 0xe0, 0x04, 0xe3, 0x55, 0x4d, 0x3a,
0x9f, 0xe1, 0xf1, 0x50, 0x32, 0x89, 0x3d, 0x9f, 0xf1, 0x31, 0xa6, 0x37, 0x11, 0xc9, 0x40, 0x70,
0xfa, 0x06, 0xaa, 0xd9, 0x8d, 0xd0, 0xc3, 0xfc, 0x42, 0x36, 0x2e, 0xa7, 0xb1, 0x35, 0xd3, 0x96,
0xf6, 0x82, 0x74, 0xdf, 0xfe, 0x9e, 0x9b, 0xe4, 0xcf, 0xdc, 0x24, 0x7f, 0xe7, 0x26, 0xb9, 0xf9,
0x67, 0x6a, 0x5f, 0x9e, 0x8f, 0x03, 0xe9, 0x4f, 0x47, 0x6d, 0x57, 0x7c, 0xb3, 0x7d, 0x96, 0xf8,
0x81, 0x2b, 0xe2, 0xc8, 0x76, 0x05, 0x4f, 0xa6, 0xa1, 0xbd, 0x75, 0xdc, 0xa3, 0xb2, 0x82, 0x5e,
0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x44, 0xbc, 0x0a, 0xfb, 0xf8, 0x03, 0x00, 0x00,
// 543 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcd, 0x6e, 0xd3, 0x4c,
0x14, 0xf5, 0x24, 0xfd, 0xf3, 0xcd, 0xd7, 0xca, 0xdf, 0xb4, 0x08, 0x2b, 0x45, 0x56, 0x88, 0x50,
0x65, 0x2a, 0x11, 0xa3, 0x20, 0xc1, 0x0e, 0x44, 0xd2, 0x96, 0x20, 0xa4, 0x04, 0x39, 0xed, 0x02,
0x76, 0x13, 0xfb, 0x12, 0x5b, 0x71, 0x67, 0x8c, 0x3d, 0x69, 0xe8, 0x9e, 0x87, 0xe0, 0x49, 0xd8,
0xb2, 0x65, 0xc9, 0x23, 0xa0, 0xf0, 0x22, 0x28, 0x13, 0xc7, 0x71, 0x92, 0xee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, 0xb2, 0x98, 0x49,
0xf3, 0x03, 0xdc, 0xef, 0x4b, 0x26, 0xb1, 0x1d, 0x30, 0x3e, 0xc4, 0x6c, 0x63, 0x62, 0x19, 0x0a,
0x4e, 0x5f, 0x82, 0x9e, 0x6f, 0x10, 0x3d, 0x2e, 0x16, 0xb2, 0xb6, 0x57, 0xd5, 0x8d, 0x37, 0xad,
0x6b, 0x4f, 0x49, 0xeb, 0xd5, 0xcf, 0xa9, 0x45, 0x7e, 0x4d, 0x2d, 0xf2, 0x7b, 0x6a, 0x91, 0x6f,
0x7f, 0x2c, 0xed, 0xe3, 0x93, 0x61, 0x28, 0x83, 0xf1, 0xa0, 0xe1, 0x89, 0x6b, 0x27, 0x60, 0x69,
0x10, 0x7a, 0x22, 0x89, 0x1d, 0x4f, 0xf0, 0x74, 0x1c, 0x39, 0x1b, 0xab, 0x3f, 0xd8, 0x51, 0xd0,
0xb3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x45, 0xc8, 0x3f, 0xd7, 0x16, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -751,6 +764,13 @@ func (m *SubscribeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Namespace) > 0 {
i -= len(m.Namespace)
copy(dAtA[i:], m.Namespace)
i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Namespace)))
i--
dAtA[i] = 0x32
}
if len(m.Datacenter) > 0 {
i -= len(m.Datacenter)
copy(dAtA[i:], m.Datacenter)
@ -1030,6 +1050,10 @@ func (m *SubscribeRequest) Size() (n int) {
if l > 0 {
n += 1 + l + sovSubscribe(uint64(l))
}
l = len(m.Namespace)
if l > 0 {
n += 1 + l + sovSubscribe(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@ -1309,6 +1333,38 @@ func (m *SubscribeRequest) Unmarshal(dAtA []byte) error {
}
m.Datacenter = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSubscribe
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthSubscribe
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthSubscribe
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Namespace = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipSubscribe(dAtA[iNdEx:])

View File

@ -73,6 +73,12 @@ message SubscribeRequest {
// the remote DC and proxy the results back to the subscriber. An empty
// string defaults to the local datacenter.
string Datacenter = 5;
// Namespace which contains the resources. If Namespace is not specified the
// default namespace will be used.
//
// Namespace is an enterprise-only feature.
string Namespace = 6;
}
// Event describes a streaming update on a subscription. Events are used both to