зеркало из https://github.com/github/vitess-gh.git
proto: Add a throttler service.
This commit is contained in:
Родитель
a8997756c7
Коммит
c445e52a24
|
@ -0,0 +1,66 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: throttlerdata.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package throttlerdata is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
throttlerdata.proto
|
||||
|
||||
It has these top-level messages:
|
||||
SetMaxRateRequest
|
||||
SetMaxRateResponse
|
||||
*/
|
||||
package throttlerdata
|
||||
|
||||
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.
|
||||
const _ = proto.ProtoPackageIsVersion1
|
||||
|
||||
// SetMaxRateRequest is the payload for the SetMaxRate RPC.
|
||||
type SetMaxRateRequest struct {
|
||||
Rate int64 `protobuf:"varint,1,opt,name=rate" json:"rate,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SetMaxRateRequest) Reset() { *m = SetMaxRateRequest{} }
|
||||
func (m *SetMaxRateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetMaxRateRequest) ProtoMessage() {}
|
||||
func (*SetMaxRateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
// SetMaxRateResponse is returned by the SetMaxRate RPC.
|
||||
type SetMaxRateResponse struct {
|
||||
// names is the list of throttler names which were updated.
|
||||
Names []string `protobuf:"bytes,1,rep,name=names" json:"names,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SetMaxRateResponse) Reset() { *m = SetMaxRateResponse{} }
|
||||
func (m *SetMaxRateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetMaxRateResponse) ProtoMessage() {}
|
||||
func (*SetMaxRateResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*SetMaxRateRequest)(nil), "throttlerdata.SetMaxRateRequest")
|
||||
proto.RegisterType((*SetMaxRateResponse)(nil), "throttlerdata.SetMaxRateResponse")
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 118 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0xc9, 0x28, 0xca,
|
||||
0x2f, 0x29, 0xc9, 0x49, 0x2d, 0x4a, 0x49, 0x2c, 0x49, 0xd4, 0x2b, 0x00, 0x72, 0xf2, 0x85, 0x78,
|
||||
0x51, 0x04, 0x95, 0xd4, 0xb9, 0x04, 0x83, 0x53, 0x4b, 0x7c, 0x13, 0x2b, 0x82, 0x12, 0x4b, 0x52,
|
||||
0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x84, 0xb8, 0x58, 0x8a, 0x80, 0x5c, 0x09, 0x46,
|
||||
0x05, 0x46, 0x0d, 0xe6, 0x20, 0x30, 0x5b, 0x49, 0x8b, 0x4b, 0x08, 0x59, 0x61, 0x71, 0x41, 0x7e,
|
||||
0x5e, 0x71, 0xaa, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x6e, 0x6a, 0x31, 0x50, 0x29, 0xb3, 0x06,
|
||||
0x67, 0x10, 0x84, 0x93, 0xc4, 0x06, 0xb6, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x18,
|
||||
0x3f, 0xb5, 0x81, 0x00, 0x00, 0x00,
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: throttlerservice.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package throttlerservice is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
throttlerservice.proto
|
||||
|
||||
It has these top-level messages:
|
||||
*/
|
||||
package throttlerservice
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import throttlerdata "github.com/youtube/vitess/go/vt/proto/throttlerdata"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// 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.ProtoPackageIsVersion1
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion2
|
||||
|
||||
// Client API for Throttler service
|
||||
|
||||
type ThrottlerClient interface {
|
||||
// SetMaxRate allows to change the current max rate for all throttlers
|
||||
// of the process.
|
||||
SetMaxRate(ctx context.Context, in *throttlerdata.SetMaxRateRequest, opts ...grpc.CallOption) (*throttlerdata.SetMaxRateResponse, error)
|
||||
}
|
||||
|
||||
type throttlerClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewThrottlerClient(cc *grpc.ClientConn) ThrottlerClient {
|
||||
return &throttlerClient{cc}
|
||||
}
|
||||
|
||||
func (c *throttlerClient) SetMaxRate(ctx context.Context, in *throttlerdata.SetMaxRateRequest, opts ...grpc.CallOption) (*throttlerdata.SetMaxRateResponse, error) {
|
||||
out := new(throttlerdata.SetMaxRateResponse)
|
||||
err := grpc.Invoke(ctx, "/throttlerservice.Throttler/SetMaxRate", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Throttler service
|
||||
|
||||
type ThrottlerServer interface {
|
||||
// SetMaxRate allows to change the current max rate for all throttlers
|
||||
// of the process.
|
||||
SetMaxRate(context.Context, *throttlerdata.SetMaxRateRequest) (*throttlerdata.SetMaxRateResponse, error)
|
||||
}
|
||||
|
||||
func RegisterThrottlerServer(s *grpc.Server, srv ThrottlerServer) {
|
||||
s.RegisterService(&_Throttler_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Throttler_SetMaxRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(throttlerdata.SetMaxRateRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ThrottlerServer).SetMaxRate(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/throttlerservice.Throttler/SetMaxRate",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ThrottlerServer).SetMaxRate(ctx, req.(*throttlerdata.SetMaxRateRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Throttler_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "throttlerservice.Throttler",
|
||||
HandlerType: (*ThrottlerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SetMaxRate",
|
||||
Handler: _Throttler_SetMaxRate_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 113 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x2b, 0xc9, 0x28, 0xca,
|
||||
0x2f, 0x29, 0xc9, 0x49, 0x2d, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x00, 0xf2,
|
||||
0xf3, 0x85, 0x04, 0xd0, 0xc5, 0xa5, 0x84, 0xe1, 0x22, 0x29, 0x89, 0x25, 0x89, 0x10, 0x65, 0x46,
|
||||
0x09, 0x5c, 0x9c, 0x21, 0x30, 0x61, 0xa1, 0x60, 0x2e, 0xae, 0xe0, 0xd4, 0x12, 0xdf, 0xc4, 0x8a,
|
||||
0xa0, 0xc4, 0x92, 0x54, 0x21, 0x05, 0x3d, 0x54, 0x0d, 0x08, 0xa9, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4,
|
||||
0xe2, 0x12, 0x29, 0x45, 0x3c, 0x2a, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x95, 0x18, 0x92, 0xd8,
|
||||
0xc0, 0x16, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xb9, 0xc8, 0x95, 0xa9, 0x00, 0x00,
|
||||
0x00,
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// Data structures for the throttler RPC interface.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package throttlerdata;
|
||||
|
||||
// SetMaxRateRequest is the payload for the SetMaxRate RPC.
|
||||
message SetMaxRateRequest {
|
||||
int64 rate = 1;
|
||||
}
|
||||
|
||||
// SetMaxRateResponse is returned by the SetMaxRate RPC.
|
||||
message SetMaxRateResponse {
|
||||
// names is the list of throttler names which were updated.
|
||||
repeated string names = 1;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// RPC interface for the internal resharding throttler (go/vt/throttler) which
|
||||
// is used by the resharding clone process (vtworker) and filtered replication
|
||||
// (vttablet).
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package throttlerservice;
|
||||
|
||||
import "throttlerdata.proto";
|
||||
|
||||
// Throttler defines the throttler RPC calls.
|
||||
service Throttler {
|
||||
// SetMaxRate allows to change the current max rate for all throttlers
|
||||
// of the process.
|
||||
rpc SetMaxRate (throttlerdata.SetMaxRateRequest) returns (throttlerdata.SetMaxRateResponse) {};
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: throttlerdata.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='throttlerdata.proto',
|
||||
package='throttlerdata',
|
||||
syntax='proto3',
|
||||
serialized_pb=_b('\n\x13throttlerdata.proto\x12\rthrottlerdata\"!\n\x11SetMaxRateRequest\x12\x0c\n\x04rate\x18\x01 \x01(\x03\"#\n\x12SetMaxRateResponse\x12\r\n\x05names\x18\x01 \x03(\tb\x06proto3')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
|
||||
_SETMAXRATEREQUEST = _descriptor.Descriptor(
|
||||
name='SetMaxRateRequest',
|
||||
full_name='throttlerdata.SetMaxRateRequest',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='rate', full_name='throttlerdata.SetMaxRateRequest.rate', index=0,
|
||||
number=1, type=3, cpp_type=2, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=38,
|
||||
serialized_end=71,
|
||||
)
|
||||
|
||||
|
||||
_SETMAXRATERESPONSE = _descriptor.Descriptor(
|
||||
name='SetMaxRateResponse',
|
||||
full_name='throttlerdata.SetMaxRateResponse',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='names', full_name='throttlerdata.SetMaxRateResponse.names', index=0,
|
||||
number=1, type=9, cpp_type=9, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=73,
|
||||
serialized_end=108,
|
||||
)
|
||||
|
||||
DESCRIPTOR.message_types_by_name['SetMaxRateRequest'] = _SETMAXRATEREQUEST
|
||||
DESCRIPTOR.message_types_by_name['SetMaxRateResponse'] = _SETMAXRATERESPONSE
|
||||
|
||||
SetMaxRateRequest = _reflection.GeneratedProtocolMessageType('SetMaxRateRequest', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SETMAXRATEREQUEST,
|
||||
__module__ = 'throttlerdata_pb2'
|
||||
# @@protoc_insertion_point(class_scope:throttlerdata.SetMaxRateRequest)
|
||||
))
|
||||
_sym_db.RegisterMessage(SetMaxRateRequest)
|
||||
|
||||
SetMaxRateResponse = _reflection.GeneratedProtocolMessageType('SetMaxRateResponse', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SETMAXRATERESPONSE,
|
||||
__module__ = 'throttlerdata_pb2'
|
||||
# @@protoc_insertion_point(class_scope:throttlerdata.SetMaxRateResponse)
|
||||
))
|
||||
_sym_db.RegisterMessage(SetMaxRateResponse)
|
||||
|
||||
|
||||
import abc
|
||||
from grpc.beta import implementations as beta_implementations
|
||||
from grpc.framework.common import cardinality
|
||||
from grpc.framework.interfaces.face import utilities as face_utilities
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,81 @@
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: throttlerservice.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
import throttlerdata_pb2 as throttlerdata__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='throttlerservice.proto',
|
||||
package='throttlerservice',
|
||||
syntax='proto3',
|
||||
serialized_pb=_b('\n\x16throttlerservice.proto\x12\x10throttlerservice\x1a\x13throttlerdata.proto2`\n\tThrottler\x12S\n\nSetMaxRate\x12 .throttlerdata.SetMaxRateRequest\x1a!.throttlerdata.SetMaxRateResponse\"\x00\x62\x06proto3')
|
||||
,
|
||||
dependencies=[throttlerdata__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import abc
|
||||
from grpc.beta import implementations as beta_implementations
|
||||
from grpc.framework.common import cardinality
|
||||
from grpc.framework.interfaces.face import utilities as face_utilities
|
||||
|
||||
class BetaThrottlerServicer(object):
|
||||
"""<fill me in later!>"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
@abc.abstractmethod
|
||||
def SetMaxRate(self, request, context):
|
||||
raise NotImplementedError()
|
||||
|
||||
class BetaThrottlerStub(object):
|
||||
"""The interface to which stubs will conform."""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
@abc.abstractmethod
|
||||
def SetMaxRate(self, request, timeout):
|
||||
raise NotImplementedError()
|
||||
SetMaxRate.future = None
|
||||
|
||||
def beta_create_Throttler_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
|
||||
import throttlerdata_pb2
|
||||
import throttlerdata_pb2
|
||||
request_deserializers = {
|
||||
('throttlerservice.Throttler', 'SetMaxRate'): throttlerdata_pb2.SetMaxRateRequest.FromString,
|
||||
}
|
||||
response_serializers = {
|
||||
('throttlerservice.Throttler', 'SetMaxRate'): throttlerdata_pb2.SetMaxRateResponse.SerializeToString,
|
||||
}
|
||||
method_implementations = {
|
||||
('throttlerservice.Throttler', 'SetMaxRate'): face_utilities.unary_unary_inline(servicer.SetMaxRate),
|
||||
}
|
||||
server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout)
|
||||
return beta_implementations.server(method_implementations, options=server_options)
|
||||
|
||||
def beta_create_Throttler_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
|
||||
import throttlerdata_pb2
|
||||
import throttlerdata_pb2
|
||||
request_serializers = {
|
||||
('throttlerservice.Throttler', 'SetMaxRate'): throttlerdata_pb2.SetMaxRateRequest.SerializeToString,
|
||||
}
|
||||
response_deserializers = {
|
||||
('throttlerservice.Throttler', 'SetMaxRate'): throttlerdata_pb2.SetMaxRateResponse.FromString,
|
||||
}
|
||||
cardinalities = {
|
||||
'SetMaxRate': cardinality.Cardinality.UNARY_UNARY,
|
||||
}
|
||||
stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size)
|
||||
return beta_implementations.dynamic_stub(channel, 'throttlerservice.Throttler', cardinalities, options=stub_options)
|
||||
# @@protoc_insertion_point(module_scope)
|
Загрузка…
Ссылка в новой задаче