pb

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Code_name = map[int32]string{
		0: "Ok",
		1: "PermissionDenied",
		2: "InvalidRequestParameters",
		3: "ResourceAlreadyExists",
		4: "TenantNotExist",
		5: "TaskNotExist",
		6: "TenantQuotaExceeded",
		7: "TaskFinished",
		8: "TaskNotRunning",
	}
	Code_value = map[string]int32{
		"Ok":                       0,
		"PermissionDenied":         1,
		"InvalidRequestParameters": 2,
		"ResourceAlreadyExists":    3,
		"TenantNotExist":           4,
		"TaskNotExist":             5,
		"TenantQuotaExceeded":      6,
		"TaskFinished":             7,
		"TaskNotRunning":           8,
	}
)

Enum value maps for Code.

View Source
var File_common_proto protoreflect.FileDescriptor
View Source
var File_scheduler_proto protoreflect.FileDescriptor
View Source
var ScheduleService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pb.ScheduleService",
	HandlerType: (*ScheduleServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateTenant",
			Handler:    _ScheduleService_CreateTenant_Handler,
		},
		{
			MethodName: "QueryTenantTaskConcurrency",
			Handler:    _ScheduleService_QueryTenantTaskConcurrency_Handler,
		},
		{
			MethodName: "CreateTask",
			Handler:    _ScheduleService_CreateTask_Handler,
		},
		{
			MethodName: "PauseTask",
			Handler:    _ScheduleService_PauseTask_Handler,
		},
		{
			MethodName: "RestartTask",
			Handler:    _ScheduleService_RestartTask_Handler,
		},
		{
			MethodName: "StopTask",
			Handler:    _ScheduleService_StopTask_Handler,
		},
		{
			MethodName: "QueryTaskStatus",
			Handler:    _ScheduleService_QueryTaskStatus_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "scheduler.proto",
}

ScheduleService_ServiceDesc is the grpc.ServiceDesc for ScheduleService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterScheduleServiceHandler

func RegisterScheduleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterScheduleServiceHandler registers the http handlers for service ScheduleService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterScheduleServiceHandlerClient

func RegisterScheduleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ScheduleServiceClient) error

RegisterScheduleServiceHandlerClient registers the http handlers for service ScheduleService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ScheduleServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ScheduleServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ScheduleServiceClient" to call the correct interceptors.

func RegisterScheduleServiceHandlerFromEndpoint

func RegisterScheduleServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterScheduleServiceHandlerFromEndpoint is same as RegisterScheduleServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterScheduleServiceHandlerServer

func RegisterScheduleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ScheduleServiceServer) error

RegisterScheduleServiceHandlerServer registers the http handlers for service ScheduleService to "mux". UnaryRPC :call ScheduleServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterScheduleServiceHandlerFromEndpoint instead.

func RegisterScheduleServiceServer

func RegisterScheduleServiceServer(s grpc.ServiceRegistrar, srv ScheduleServiceServer)

Types

type Code

type Code int32
const (
	Code_Ok                       Code = 0
	Code_PermissionDenied         Code = 1
	Code_InvalidRequestParameters Code = 2
	Code_ResourceAlreadyExists    Code = 3
	Code_TenantNotExist           Code = 4
	Code_TaskNotExist             Code = 5
	Code_TenantQuotaExceeded      Code = 6
	Code_TaskFinished             Code = 7
	Code_TaskNotRunning           Code = 8
)

func (Code) Descriptor

func (Code) Descriptor() protoreflect.EnumDescriptor

func (Code) Enum

func (x Code) Enum() *Code

func (Code) EnumDescriptor deprecated

func (Code) EnumDescriptor() ([]byte, []int)

Deprecated: Use Code.Descriptor instead.

func (Code) Number

func (x Code) Number() protoreflect.EnumNumber

func (Code) String

func (x Code) String() string

func (Code) Type

func (Code) Type() protoreflect.EnumType

type CreateTaskOptions

type CreateTaskOptions struct {

	// Whether to check tenant's resource quota while creating a new task
	CheckResourceQuota bool `protobuf:"varint,1,opt,name=check_resource_quota,json=checkResourceQuota,proto3" json:"check_resource_quota,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTaskOptions) Descriptor deprecated

func (*CreateTaskOptions) Descriptor() ([]byte, []int)

Deprecated: Use CreateTaskOptions.ProtoReflect.Descriptor instead.

func (*CreateTaskOptions) GetCheckResourceQuota

func (x *CreateTaskOptions) GetCheckResourceQuota() bool

func (*CreateTaskOptions) ProtoMessage

func (*CreateTaskOptions) ProtoMessage()

func (*CreateTaskOptions) ProtoReflect

func (x *CreateTaskOptions) ProtoReflect() protoreflect.Message

func (*CreateTaskOptions) Reset

func (x *CreateTaskOptions) Reset()

func (*CreateTaskOptions) String

func (x *CreateTaskOptions) String() string

type CreateTaskRequest

type CreateTaskRequest struct {

	// Create task options
	Options *CreateTaskOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"`
	// Task type
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// Tenant id
	TenantId string `protobuf:"bytes,3,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"`
	// Task uid
	Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid,omitempty"`
	// Task handler
	Handler string `protobuf:"bytes,5,opt,name=handler,proto3" json:"handler,omitempty"`
	// Task config
	Config []byte `protobuf:"bytes,6,opt,name=config,proto3" json:"config,omitempty"`
	// Task schedule strategy
	ScheduleStrategy string `protobuf:"bytes,7,opt,name=schedule_strategy,json=scheduleStrategy,proto3" json:"schedule_strategy,omitempty"`
	// Task priority
	Priority int32 `protobuf:"varint,8,opt,name=priority,proto3" json:"priority,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTaskRequest) Descriptor deprecated

func (*CreateTaskRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateTaskRequest.ProtoReflect.Descriptor instead.

func (*CreateTaskRequest) GetConfig

func (x *CreateTaskRequest) GetConfig() []byte

func (*CreateTaskRequest) GetHandler

func (x *CreateTaskRequest) GetHandler() string

func (*CreateTaskRequest) GetOptions

func (x *CreateTaskRequest) GetOptions() *CreateTaskOptions

func (*CreateTaskRequest) GetPriority

func (x *CreateTaskRequest) GetPriority() int32

func (*CreateTaskRequest) GetScheduleStrategy

func (x *CreateTaskRequest) GetScheduleStrategy() string

func (*CreateTaskRequest) GetTenantId

func (x *CreateTaskRequest) GetTenantId() string

func (*CreateTaskRequest) GetType

func (x *CreateTaskRequest) GetType() string

func (*CreateTaskRequest) GetUid

func (x *CreateTaskRequest) GetUid() string

func (*CreateTaskRequest) ProtoMessage

func (*CreateTaskRequest) ProtoMessage()

func (*CreateTaskRequest) ProtoReflect

func (x *CreateTaskRequest) ProtoReflect() protoreflect.Message

func (*CreateTaskRequest) Reset

func (x *CreateTaskRequest) Reset()

func (*CreateTaskRequest) String

func (x *CreateTaskRequest) String() string

type CreateTenantRequest

type CreateTenantRequest struct {

	// Tenant uid, must be unique across different zones
	Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	// Tenant zone
	Zone string `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"`
	// Tenant priority
	Priority int32 `protobuf:"varint,3,opt,name=priority,proto3" json:"priority,omitempty"`
	// Tenant name
	Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	// Tenant resource quota
	Quota *ResourceQuota `protobuf:"bytes,6,opt,name=quota,proto3" json:"quota,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTenantRequest) Descriptor deprecated

func (*CreateTenantRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateTenantRequest.ProtoReflect.Descriptor instead.

func (*CreateTenantRequest) GetName

func (x *CreateTenantRequest) GetName() string

func (*CreateTenantRequest) GetPriority

func (x *CreateTenantRequest) GetPriority() int32

func (*CreateTenantRequest) GetQuota

func (x *CreateTenantRequest) GetQuota() *ResourceQuota

func (*CreateTenantRequest) GetUid

func (x *CreateTenantRequest) GetUid() string

func (*CreateTenantRequest) GetZone

func (x *CreateTenantRequest) GetZone() string

func (*CreateTenantRequest) ProtoMessage

func (*CreateTenantRequest) ProtoMessage()

func (*CreateTenantRequest) ProtoReflect

func (x *CreateTenantRequest) ProtoReflect() protoreflect.Message

func (*CreateTenantRequest) Reset

func (x *CreateTenantRequest) Reset()

func (*CreateTenantRequest) String

func (x *CreateTenantRequest) String() string

type PauseTaskRequest

type PauseTaskRequest struct {

	// Task type
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Task uid
	Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
	// contains filtered or unexported fields
}

func (*PauseTaskRequest) Descriptor deprecated

func (*PauseTaskRequest) Descriptor() ([]byte, []int)

Deprecated: Use PauseTaskRequest.ProtoReflect.Descriptor instead.

func (*PauseTaskRequest) GetType

func (x *PauseTaskRequest) GetType() string

func (*PauseTaskRequest) GetUid

func (x *PauseTaskRequest) GetUid() string

func (*PauseTaskRequest) ProtoMessage

func (*PauseTaskRequest) ProtoMessage()

func (*PauseTaskRequest) ProtoReflect

func (x *PauseTaskRequest) ProtoReflect() protoreflect.Message

func (*PauseTaskRequest) Reset

func (x *PauseTaskRequest) Reset()

func (*PauseTaskRequest) String

func (x *PauseTaskRequest) String() string

type QueryTaskStatusRequest

type QueryTaskStatusRequest struct {

	// Task type
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Task uid
	Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryTaskStatusRequest) Descriptor deprecated

func (*QueryTaskStatusRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryTaskStatusRequest.ProtoReflect.Descriptor instead.

func (*QueryTaskStatusRequest) GetType

func (x *QueryTaskStatusRequest) GetType() string

func (*QueryTaskStatusRequest) GetUid

func (x *QueryTaskStatusRequest) GetUid() string

func (*QueryTaskStatusRequest) ProtoMessage

func (*QueryTaskStatusRequest) ProtoMessage()

func (*QueryTaskStatusRequest) ProtoReflect

func (x *QueryTaskStatusRequest) ProtoReflect() protoreflect.Message

func (*QueryTaskStatusRequest) Reset

func (x *QueryTaskStatusRequest) Reset()

func (*QueryTaskStatusRequest) String

func (x *QueryTaskStatusRequest) String() string

type QueryTaskStatusResponse

type QueryTaskStatusResponse struct {
	Code   Code   `protobuf:"varint,1,opt,name=code,proto3,enum=pb.Code" json:"code,omitempty"`
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryTaskStatusResponse) Descriptor deprecated

func (*QueryTaskStatusResponse) Descriptor() ([]byte, []int)

Deprecated: Use QueryTaskStatusResponse.ProtoReflect.Descriptor instead.

func (*QueryTaskStatusResponse) GetCode

func (x *QueryTaskStatusResponse) GetCode() Code

func (*QueryTaskStatusResponse) GetStatus

func (x *QueryTaskStatusResponse) GetStatus() string

func (*QueryTaskStatusResponse) ProtoMessage

func (*QueryTaskStatusResponse) ProtoMessage()

func (*QueryTaskStatusResponse) ProtoReflect

func (x *QueryTaskStatusResponse) ProtoReflect() protoreflect.Message

func (*QueryTaskStatusResponse) Reset

func (x *QueryTaskStatusResponse) Reset()

func (*QueryTaskStatusResponse) String

func (x *QueryTaskStatusResponse) String() string

type QueryTenantTaskConcurrencyRequest

type QueryTenantTaskConcurrencyRequest struct {

	// Tenant uid
	Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryTenantTaskConcurrencyRequest) Descriptor deprecated

func (*QueryTenantTaskConcurrencyRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryTenantTaskConcurrencyRequest.ProtoReflect.Descriptor instead.

func (*QueryTenantTaskConcurrencyRequest) GetUid

func (*QueryTenantTaskConcurrencyRequest) ProtoMessage

func (*QueryTenantTaskConcurrencyRequest) ProtoMessage()

func (*QueryTenantTaskConcurrencyRequest) ProtoReflect

func (*QueryTenantTaskConcurrencyRequest) Reset

func (*QueryTenantTaskConcurrencyRequest) String

type QueryTenantTaskConcurrencyResponse

type QueryTenantTaskConcurrencyResponse struct {
	Code    Code  `protobuf:"varint,1,opt,name=code,proto3,enum=pb.Code" json:"code,omitempty"`
	Running int64 `protobuf:"varint,2,opt,name=running,proto3" json:"running,omitempty"`
	Pending int64 `protobuf:"varint,3,opt,name=pending,proto3" json:"pending,omitempty"`
	Limit   int64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryTenantTaskConcurrencyResponse) Descriptor deprecated

func (*QueryTenantTaskConcurrencyResponse) Descriptor() ([]byte, []int)

Deprecated: Use QueryTenantTaskConcurrencyResponse.ProtoReflect.Descriptor instead.

func (*QueryTenantTaskConcurrencyResponse) GetCode

func (*QueryTenantTaskConcurrencyResponse) GetLimit

func (*QueryTenantTaskConcurrencyResponse) GetPending

func (x *QueryTenantTaskConcurrencyResponse) GetPending() int64

func (*QueryTenantTaskConcurrencyResponse) GetRunning

func (x *QueryTenantTaskConcurrencyResponse) GetRunning() int64

func (*QueryTenantTaskConcurrencyResponse) ProtoMessage

func (*QueryTenantTaskConcurrencyResponse) ProtoMessage()

func (*QueryTenantTaskConcurrencyResponse) ProtoReflect

func (*QueryTenantTaskConcurrencyResponse) Reset

func (*QueryTenantTaskConcurrencyResponse) String

type ResourceQuota

type ResourceQuota struct {
	Type  string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Value int64  `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceQuota) Descriptor deprecated

func (*ResourceQuota) Descriptor() ([]byte, []int)

Deprecated: Use ResourceQuota.ProtoReflect.Descriptor instead.

func (*ResourceQuota) GetType added in v1.0.0

func (x *ResourceQuota) GetType() string

func (*ResourceQuota) GetValue added in v1.0.0

func (x *ResourceQuota) GetValue() int64

func (*ResourceQuota) ProtoMessage

func (*ResourceQuota) ProtoMessage()

func (*ResourceQuota) ProtoReflect

func (x *ResourceQuota) ProtoReflect() protoreflect.Message

func (*ResourceQuota) Reset

func (x *ResourceQuota) Reset()

func (*ResourceQuota) String

func (x *ResourceQuota) String() string

type Response

type Response struct {
	Code    Code   `protobuf:"varint,1,opt,name=code,proto3,enum=pb.Code" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() Code

func (*Response) GetMessage

func (x *Response) GetMessage() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type RestartTaskRequest

type RestartTaskRequest struct {

	// Task type
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Task uid
	Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
	// contains filtered or unexported fields
}

func (*RestartTaskRequest) Descriptor deprecated

func (*RestartTaskRequest) Descriptor() ([]byte, []int)

Deprecated: Use RestartTaskRequest.ProtoReflect.Descriptor instead.

func (*RestartTaskRequest) GetType

func (x *RestartTaskRequest) GetType() string

func (*RestartTaskRequest) GetUid

func (x *RestartTaskRequest) GetUid() string

func (*RestartTaskRequest) ProtoMessage

func (*RestartTaskRequest) ProtoMessage()

func (*RestartTaskRequest) ProtoReflect

func (x *RestartTaskRequest) ProtoReflect() protoreflect.Message

func (*RestartTaskRequest) Reset

func (x *RestartTaskRequest) Reset()

func (*RestartTaskRequest) String

func (x *RestartTaskRequest) String() string

type ScheduleServiceClient

type ScheduleServiceClient interface {
	// Tenant API
	CreateTenant(ctx context.Context, in *CreateTenantRequest, opts ...grpc.CallOption) (*Response, error)
	QueryTenantTaskConcurrency(ctx context.Context, in *QueryTenantTaskConcurrencyRequest, opts ...grpc.CallOption) (*QueryTenantTaskConcurrencyResponse, error)
	// Task API
	CreateTask(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*Response, error)
	PauseTask(ctx context.Context, in *PauseTaskRequest, opts ...grpc.CallOption) (*Response, error)
	RestartTask(ctx context.Context, in *RestartTaskRequest, opts ...grpc.CallOption) (*Response, error)
	StopTask(ctx context.Context, in *StopTaskRequest, opts ...grpc.CallOption) (*Response, error)
	QueryTaskStatus(ctx context.Context, in *QueryTaskStatusRequest, opts ...grpc.CallOption) (*QueryTaskStatusResponse, error)
}

ScheduleServiceClient is the client API for ScheduleService service.

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 ScheduleServiceServer

type ScheduleServiceServer interface {
	// Tenant API
	CreateTenant(context.Context, *CreateTenantRequest) (*Response, error)
	QueryTenantTaskConcurrency(context.Context, *QueryTenantTaskConcurrencyRequest) (*QueryTenantTaskConcurrencyResponse, error)
	// Task API
	CreateTask(context.Context, *CreateTaskRequest) (*Response, error)
	PauseTask(context.Context, *PauseTaskRequest) (*Response, error)
	RestartTask(context.Context, *RestartTaskRequest) (*Response, error)
	StopTask(context.Context, *StopTaskRequest) (*Response, error)
	QueryTaskStatus(context.Context, *QueryTaskStatusRequest) (*QueryTaskStatusResponse, error)
	// contains filtered or unexported methods
}

ScheduleServiceServer is the server API for ScheduleService service. All implementations must embed UnimplementedScheduleServiceServer for forward compatibility

type StopTaskRequest

type StopTaskRequest struct {

	// Task type
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Task uid
	Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
	// contains filtered or unexported fields
}

func (*StopTaskRequest) Descriptor deprecated

func (*StopTaskRequest) Descriptor() ([]byte, []int)

Deprecated: Use StopTaskRequest.ProtoReflect.Descriptor instead.

func (*StopTaskRequest) GetType

func (x *StopTaskRequest) GetType() string

func (*StopTaskRequest) GetUid

func (x *StopTaskRequest) GetUid() string

func (*StopTaskRequest) ProtoMessage

func (*StopTaskRequest) ProtoMessage()

func (*StopTaskRequest) ProtoReflect

func (x *StopTaskRequest) ProtoReflect() protoreflect.Message

func (*StopTaskRequest) Reset

func (x *StopTaskRequest) Reset()

func (*StopTaskRequest) String

func (x *StopTaskRequest) String() string

type UnimplementedScheduleServiceServer

type UnimplementedScheduleServiceServer struct {
}

UnimplementedScheduleServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedScheduleServiceServer) CreateTask

func (UnimplementedScheduleServiceServer) CreateTenant

func (UnimplementedScheduleServiceServer) PauseTask

func (UnimplementedScheduleServiceServer) QueryTaskStatus

func (UnimplementedScheduleServiceServer) RestartTask

func (UnimplementedScheduleServiceServer) StopTask

type UnsafeScheduleServiceServer

type UnsafeScheduleServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeScheduleServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ScheduleServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL