This commit is contained in:
Alain Jobart 2015-06-10 10:11:40 -07:00
Родитель c47fc6ca94
Коммит 14b82b06db
5 изменённых файлов: 176 добавлений и 145 удалений

Просмотреть файл

@ -187,6 +187,7 @@ proto:
cd go/vt/proto/topo && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/topo.proto --go_out=plugins=grpc:.
cd go/vt/proto/replication && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/replication.proto --go_out=plugins=grpc:.
cd go/vt/proto/binlog && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/binlog.proto --go_out=plugins=grpc:.
cd go/vt/proto/binlogservice && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/binlogservice.proto --go_out=plugins=grpc:.
cd go/vt/proto/queryservice && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/queryservice.proto --go_out=plugins=grpc:.
cd go/vt/proto/query && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/query.proto --go_out=plugins=grpc:.
cd go/vt/proto/vtgate && $$VTROOT/dist/protobuf/bin/protoc -I../../../../proto ../../../../proto/vtgate.proto --go_out=plugins=grpc:.

Просмотреть файл

@ -24,15 +24,6 @@ import proto "github.com/golang/protobuf/proto"
import topo "github.com/youtube/vitess/go/vt/proto/topo"
import replication "github.com/youtube/vitess/go/vt/proto/replication"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
@ -251,124 +242,3 @@ func (m *StreamTablesResponse) GetBinlogTransaction() *BinlogTransaction {
func init() {
proto.RegisterEnum("binlog.BinlogTransaction_Statement_Category", BinlogTransaction_Statement_Category_name, BinlogTransaction_Statement_Category_value)
}
// Client API for UpdateStream service
type UpdateStreamClient interface {
// StreamUpdate streams the binlog events, to know which objects have changed.
StreamUpdate(ctx context.Context, in *StreamUpdateRequest, opts ...grpc.CallOption) (*StreamUpdateResponse, error)
// StreamKeyRange returns the binlog transactions related to
// the specified Keyrange.
StreamKeyRange(ctx context.Context, in *StreamKeyRangeRequest, opts ...grpc.CallOption) (*StreamKeyRangeResponse, error)
// StreamTables returns the binlog transactions related to
// the specified Tables.
StreamTables(ctx context.Context, in *StreamTablesRequest, opts ...grpc.CallOption) (*StreamTablesResponse, error)
}
type updateStreamClient struct {
cc *grpc.ClientConn
}
func NewUpdateStreamClient(cc *grpc.ClientConn) UpdateStreamClient {
return &updateStreamClient{cc}
}
func (c *updateStreamClient) StreamUpdate(ctx context.Context, in *StreamUpdateRequest, opts ...grpc.CallOption) (*StreamUpdateResponse, error) {
out := new(StreamUpdateResponse)
err := grpc.Invoke(ctx, "/binlog.UpdateStream/StreamUpdate", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *updateStreamClient) StreamKeyRange(ctx context.Context, in *StreamKeyRangeRequest, opts ...grpc.CallOption) (*StreamKeyRangeResponse, error) {
out := new(StreamKeyRangeResponse)
err := grpc.Invoke(ctx, "/binlog.UpdateStream/StreamKeyRange", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *updateStreamClient) StreamTables(ctx context.Context, in *StreamTablesRequest, opts ...grpc.CallOption) (*StreamTablesResponse, error) {
out := new(StreamTablesResponse)
err := grpc.Invoke(ctx, "/binlog.UpdateStream/StreamTables", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for UpdateStream service
type UpdateStreamServer interface {
// StreamUpdate streams the binlog events, to know which objects have changed.
StreamUpdate(context.Context, *StreamUpdateRequest) (*StreamUpdateResponse, error)
// StreamKeyRange returns the binlog transactions related to
// the specified Keyrange.
StreamKeyRange(context.Context, *StreamKeyRangeRequest) (*StreamKeyRangeResponse, error)
// StreamTables returns the binlog transactions related to
// the specified Tables.
StreamTables(context.Context, *StreamTablesRequest) (*StreamTablesResponse, error)
}
func RegisterUpdateStreamServer(s *grpc.Server, srv UpdateStreamServer) {
s.RegisterService(&_UpdateStream_serviceDesc, srv)
}
func _UpdateStream_StreamUpdate_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(StreamUpdateRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(UpdateStreamServer).StreamUpdate(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
func _UpdateStream_StreamKeyRange_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(StreamKeyRangeRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(UpdateStreamServer).StreamKeyRange(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
func _UpdateStream_StreamTables_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(StreamTablesRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(UpdateStreamServer).StreamTables(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
var _UpdateStream_serviceDesc = grpc.ServiceDesc{
ServiceName: "binlog.UpdateStream",
HandlerType: (*UpdateStreamServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "StreamUpdate",
Handler: _UpdateStream_StreamUpdate_Handler,
},
{
MethodName: "StreamKeyRange",
Handler: _UpdateStream_StreamKeyRange_Handler,
},
{
MethodName: "StreamTables",
Handler: _UpdateStream_StreamTables_Handler,
},
},
Streams: []grpc.StreamDesc{},
}

Просмотреть файл

@ -0,0 +1,152 @@
// Code generated by protoc-gen-go.
// source: binlogservice.proto
// DO NOT EDIT!
/*
Package binlogservice is a generated protocol buffer package.
It is generated from these files:
binlogservice.proto
It has these top-level messages:
*/
package binlogservice
import proto "github.com/golang/protobuf/proto"
import binlog "github.com/youtube/vitess/go/vt/proto/binlog"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
func init() {
}
// Client API for UpdateStream service
type UpdateStreamClient interface {
// StreamUpdate streams the binlog events, to know which objects have changed.
StreamUpdate(ctx context.Context, in *binlog.StreamUpdateRequest, opts ...grpc.CallOption) (*binlog.StreamUpdateResponse, error)
// StreamKeyRange returns the binlog transactions related to
// the specified Keyrange.
StreamKeyRange(ctx context.Context, in *binlog.StreamKeyRangeRequest, opts ...grpc.CallOption) (*binlog.StreamKeyRangeResponse, error)
// StreamTables returns the binlog transactions related to
// the specified Tables.
StreamTables(ctx context.Context, in *binlog.StreamTablesRequest, opts ...grpc.CallOption) (*binlog.StreamTablesResponse, error)
}
type updateStreamClient struct {
cc *grpc.ClientConn
}
func NewUpdateStreamClient(cc *grpc.ClientConn) UpdateStreamClient {
return &updateStreamClient{cc}
}
func (c *updateStreamClient) StreamUpdate(ctx context.Context, in *binlog.StreamUpdateRequest, opts ...grpc.CallOption) (*binlog.StreamUpdateResponse, error) {
out := new(binlog.StreamUpdateResponse)
err := grpc.Invoke(ctx, "/binlogservice.UpdateStream/StreamUpdate", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *updateStreamClient) StreamKeyRange(ctx context.Context, in *binlog.StreamKeyRangeRequest, opts ...grpc.CallOption) (*binlog.StreamKeyRangeResponse, error) {
out := new(binlog.StreamKeyRangeResponse)
err := grpc.Invoke(ctx, "/binlogservice.UpdateStream/StreamKeyRange", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *updateStreamClient) StreamTables(ctx context.Context, in *binlog.StreamTablesRequest, opts ...grpc.CallOption) (*binlog.StreamTablesResponse, error) {
out := new(binlog.StreamTablesResponse)
err := grpc.Invoke(ctx, "/binlogservice.UpdateStream/StreamTables", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for UpdateStream service
type UpdateStreamServer interface {
// StreamUpdate streams the binlog events, to know which objects have changed.
StreamUpdate(context.Context, *binlog.StreamUpdateRequest) (*binlog.StreamUpdateResponse, error)
// StreamKeyRange returns the binlog transactions related to
// the specified Keyrange.
StreamKeyRange(context.Context, *binlog.StreamKeyRangeRequest) (*binlog.StreamKeyRangeResponse, error)
// StreamTables returns the binlog transactions related to
// the specified Tables.
StreamTables(context.Context, *binlog.StreamTablesRequest) (*binlog.StreamTablesResponse, error)
}
func RegisterUpdateStreamServer(s *grpc.Server, srv UpdateStreamServer) {
s.RegisterService(&_UpdateStream_serviceDesc, srv)
}
func _UpdateStream_StreamUpdate_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(binlog.StreamUpdateRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(UpdateStreamServer).StreamUpdate(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
func _UpdateStream_StreamKeyRange_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(binlog.StreamKeyRangeRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(UpdateStreamServer).StreamKeyRange(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
func _UpdateStream_StreamTables_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(binlog.StreamTablesRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(UpdateStreamServer).StreamTables(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
var _UpdateStream_serviceDesc = grpc.ServiceDesc{
ServiceName: "binlogservice.UpdateStream",
HandlerType: (*UpdateStreamServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "StreamUpdate",
Handler: _UpdateStream_StreamUpdate_Handler,
},
{
MethodName: "StreamKeyRange",
Handler: _UpdateStream_StreamKeyRange_Handler,
},
{
MethodName: "StreamTables",
Handler: _UpdateStream_StreamTables_Handler,
},
},
Streams: []grpc.StreamDesc{},
}

Просмотреть файл

@ -97,18 +97,3 @@ message StreamTablesRequest {
message StreamTablesResponse {
BinlogTransaction binlog_transaction = 1;
}
// UpdateStream is the RPC version of binlog.UpdateStream.
service UpdateStream {
// StreamUpdate streams the binlog events, to know which objects have changed.
rpc StreamUpdate(StreamUpdateRequest) returns (StreamUpdateResponse) {};
// StreamKeyRange returns the binlog transactions related to
// the specified Keyrange.
rpc StreamKeyRange(StreamKeyRangeRequest) returns (StreamKeyRangeResponse) {};
// StreamTables returns the binlog transactions related to
// the specified Tables.
rpc StreamTables(StreamTablesRequest) returns (StreamTablesResponse) {};
}

23
proto/binlogservice.proto Normal file
Просмотреть файл

@ -0,0 +1,23 @@
// This file contains all the types and servers necessary to make
// RPC calls to VtTablet for the binlog protocol.
syntax = "proto3";
package binlogservice;
import "binlog.proto";
// UpdateStream is the RPC version of binlog.UpdateStream.
service UpdateStream {
// StreamUpdate streams the binlog events, to know which objects have changed.
rpc StreamUpdate(binlog.StreamUpdateRequest) returns (binlog.StreamUpdateResponse) {};
// StreamKeyRange returns the binlog transactions related to
// the specified Keyrange.
rpc StreamKeyRange(binlog.StreamKeyRangeRequest) returns (binlog.StreamKeyRangeResponse) {};
// StreamTables returns the binlog transactions related to
// the specified Tables.
rpc StreamTables(binlog.StreamTablesRequest) returns (binlog.StreamTablesResponse) {};
}