feat: Add DropTableTask, AlterTableTask (#54)

* feat: use type instead of pb bytes

* feat: add table_info to CreateTableTask

* fix: remove unused fields

* feat: bring create route method back

* feat: add table_id in SubmitDdlTaskResponse

* feat: add drop table task

* feat: add alter table task

* chore: allow large_enum_variant

* chore: apply suggestions from CR
This commit is contained in:
Weny Xu
2023-07-06 12:55:09 +09:00
committed by GitHub
parent f82201d712
commit 917ead6274
10 changed files with 1421 additions and 501 deletions
+36
View File
@@ -22,6 +22,7 @@ const _ = grpc.SupportPackageIsVersion7
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type RouterClient interface {
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*RouteResponse, error)
// Fetch routing information for tables. The smallest unit is the complete
// routing information(all regions) of a table.
//
@@ -56,6 +57,15 @@ func NewRouterClient(cc grpc.ClientConnInterface) RouterClient {
return &routerClient{cc}
}
func (c *routerClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*RouteResponse, error) {
out := new(RouteResponse)
err := c.cc.Invoke(ctx, "/greptime.v1.meta.Router/Create", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *routerClient) Route(ctx context.Context, in *RouteRequest, opts ...grpc.CallOption) (*RouteResponse, error) {
out := new(RouteResponse)
err := c.cc.Invoke(ctx, "/greptime.v1.meta.Router/Route", in, out, opts...)
@@ -78,6 +88,7 @@ func (c *routerClient) Delete(ctx context.Context, in *DeleteRequest, opts ...gr
// All implementations must embed UnimplementedRouterServer
// for forward compatibility
type RouterServer interface {
Create(context.Context, *CreateRequest) (*RouteResponse, error)
// Fetch routing information for tables. The smallest unit is the complete
// routing information(all regions) of a table.
//
@@ -109,6 +120,9 @@ type RouterServer interface {
type UnimplementedRouterServer struct {
}
func (UnimplementedRouterServer) Create(context.Context, *CreateRequest) (*RouteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedRouterServer) Route(context.Context, *RouteRequest) (*RouteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Route not implemented")
}
@@ -128,6 +142,24 @@ func RegisterRouterServer(s grpc.ServiceRegistrar, srv RouterServer) {
s.RegisterService(&Router_ServiceDesc, srv)
}
func _Router_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RouterServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/greptime.v1.meta.Router/Create",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RouterServer).Create(ctx, req.(*CreateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Router_Route_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RouteRequest)
if err := dec(in); err != nil {
@@ -171,6 +203,10 @@ var Router_ServiceDesc = grpc.ServiceDesc{
ServiceName: "greptime.v1.meta.Router",
HandlerType: (*RouterServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Create",
Handler: _Router_Create_Handler,
},
{
MethodName: "Route",
Handler: _Router_Route_Handler,