mirror of https://github.com/dragonflyoss/api.git
feat: add DeleteSeedPeer api to grpc definition (#161)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
eef93d8b3d
commit
4599e869d4
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dragonfly-api"
|
||||
version = "2.0.13"
|
||||
version = "2.0.14"
|
||||
authors = ["Gaius <gaius.qi@gmail.com>"]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -785,6 +785,187 @@ var _UpdateSeedPeerRequest_Type_InLookup = map[string]struct{}{
|
|||
"weak": {},
|
||||
}
|
||||
|
||||
// Validate checks the field values on DeleteSeedPeerRequest with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *DeleteSeedPeerRequest) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on DeleteSeedPeerRequest with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// DeleteSeedPeerRequestMultiError, or nil if none found.
|
||||
func (m *DeleteSeedPeerRequest) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *DeleteSeedPeerRequest) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
||||
err := DeleteSeedPeerRequestValidationError{
|
||||
field: "SourceType",
|
||||
reason: "value must be one of the defined enum values",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if err := m._validateHostname(m.GetHostname()); err != nil {
|
||||
err = DeleteSeedPeerRequestValidationError{
|
||||
field: "Hostname",
|
||||
reason: "value must be a valid hostname",
|
||||
cause: err,
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if m.GetIp() != "" {
|
||||
|
||||
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
||||
err := DeleteSeedPeerRequestValidationError{
|
||||
field: "Ip",
|
||||
reason: "value must be a valid IP address",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if m.GetClusterId() < 1 {
|
||||
err := DeleteSeedPeerRequestValidationError{
|
||||
field: "ClusterId",
|
||||
reason: "value must be greater than or equal to 1",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return DeleteSeedPeerRequestMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *DeleteSeedPeerRequest) _validateHostname(host string) error {
|
||||
s := strings.ToLower(strings.TrimSuffix(host, "."))
|
||||
|
||||
if len(host) > 253 {
|
||||
return errors.New("hostname cannot exceed 253 characters")
|
||||
}
|
||||
|
||||
for _, part := range strings.Split(s, ".") {
|
||||
if l := len(part); l == 0 || l > 63 {
|
||||
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
|
||||
}
|
||||
|
||||
if part[0] == '-' {
|
||||
return errors.New("hostname parts cannot begin with hyphens")
|
||||
}
|
||||
|
||||
if part[len(part)-1] == '-' {
|
||||
return errors.New("hostname parts cannot end with hyphens")
|
||||
}
|
||||
|
||||
for _, r := range part {
|
||||
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
|
||||
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteSeedPeerRequestMultiError is an error wrapping multiple validation
|
||||
// errors returned by DeleteSeedPeerRequest.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type DeleteSeedPeerRequestMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m DeleteSeedPeerRequestMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m DeleteSeedPeerRequestMultiError) AllErrors() []error { return m }
|
||||
|
||||
// DeleteSeedPeerRequestValidationError is the validation error returned by
|
||||
// DeleteSeedPeerRequest.Validate if the designated constraints aren't met.
|
||||
type DeleteSeedPeerRequestValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e DeleteSeedPeerRequestValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e DeleteSeedPeerRequestValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e DeleteSeedPeerRequestValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e DeleteSeedPeerRequestValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e DeleteSeedPeerRequestValidationError) ErrorName() string {
|
||||
return "DeleteSeedPeerRequestValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e DeleteSeedPeerRequestValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sDeleteSeedPeerRequest.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = DeleteSeedPeerRequestValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = DeleteSeedPeerRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on SchedulerCluster with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// first error encountered is returned, or nil if there are no violations.
|
||||
|
@ -3810,182 +3991,3 @@ var _ interface {
|
|||
Cause() error
|
||||
ErrorName() string
|
||||
} = CreateModelRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on KeepAliveRequest with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// first error encountered is returned, or nil if there are no violations.
|
||||
func (m *KeepAliveRequest) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on KeepAliveRequest with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// KeepAliveRequestMultiError, or nil if none found.
|
||||
func (m *KeepAliveRequest) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *KeepAliveRequest) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
||||
err := KeepAliveRequestValidationError{
|
||||
field: "SourceType",
|
||||
reason: "value must be one of the defined enum values",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if err := m._validateHostname(m.GetHostname()); err != nil {
|
||||
err = KeepAliveRequestValidationError{
|
||||
field: "Hostname",
|
||||
reason: "value must be a valid hostname",
|
||||
cause: err,
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if m.GetClusterId() < 1 {
|
||||
err := KeepAliveRequestValidationError{
|
||||
field: "ClusterId",
|
||||
reason: "value must be greater than or equal to 1",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if m.GetIp() != "" {
|
||||
|
||||
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
||||
err := KeepAliveRequestValidationError{
|
||||
field: "Ip",
|
||||
reason: "value must be a valid IP address",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return KeepAliveRequestMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KeepAliveRequest) _validateHostname(host string) error {
|
||||
s := strings.ToLower(strings.TrimSuffix(host, "."))
|
||||
|
||||
if len(host) > 253 {
|
||||
return errors.New("hostname cannot exceed 253 characters")
|
||||
}
|
||||
|
||||
for _, part := range strings.Split(s, ".") {
|
||||
if l := len(part); l == 0 || l > 63 {
|
||||
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
|
||||
}
|
||||
|
||||
if part[0] == '-' {
|
||||
return errors.New("hostname parts cannot begin with hyphens")
|
||||
}
|
||||
|
||||
if part[len(part)-1] == '-' {
|
||||
return errors.New("hostname parts cannot end with hyphens")
|
||||
}
|
||||
|
||||
for _, r := range part {
|
||||
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
|
||||
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// KeepAliveRequestMultiError is an error wrapping multiple validation errors
|
||||
// returned by KeepAliveRequest.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type KeepAliveRequestMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m KeepAliveRequestMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m KeepAliveRequestMultiError) AllErrors() []error { return m }
|
||||
|
||||
// KeepAliveRequestValidationError is the validation error returned by
|
||||
// KeepAliveRequest.Validate if the designated constraints aren't met.
|
||||
type KeepAliveRequestValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e KeepAliveRequestValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e KeepAliveRequestValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e KeepAliveRequestValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e KeepAliveRequestValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e KeepAliveRequestValidationError) ErrorName() string { return "KeepAliveRequestValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e KeepAliveRequestValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sKeepAliveRequest.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = KeepAliveRequestValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = KeepAliveRequestValidationError{}
|
||||
|
|
|
@ -112,6 +112,18 @@ message UpdateSeedPeerRequest {
|
|||
int32 object_storage_port = 10 [(validate.rules).int32 = {gte: 1024, lt: 65535, ignore_empty: true}];
|
||||
}
|
||||
|
||||
// DeleteSeedPeerRequest represents request of DeleteSeedPeer.
|
||||
message DeleteSeedPeerRequest {
|
||||
// Request source type.
|
||||
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
|
||||
// Source service hostname.
|
||||
string hostname = 2 [(validate.rules).string.hostname = true];
|
||||
// Source service ip.
|
||||
string ip = 3 [(validate.rules).string = {ip: true, ignore_empty: true}];
|
||||
// ID of the cluster to which the source service belongs.
|
||||
uint64 cluster_id = 4 [(validate.rules).uint64 = {gte: 1}];
|
||||
}
|
||||
|
||||
// SeedPeerCluster represents cluster of scheduler.
|
||||
message SchedulerCluster {
|
||||
// Cluster id.
|
||||
|
@ -342,18 +354,6 @@ message CreateModelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
// KeepAliveRequest represents request of KeepAlive.
|
||||
message KeepAliveRequest {
|
||||
// Request source type.
|
||||
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
|
||||
// Source service hostname.
|
||||
string hostname = 2 [(validate.rules).string.hostname = true];
|
||||
// ID of the cluster to which the source service belongs.
|
||||
uint64 cluster_id = 3 [(validate.rules).uint64 = {gte: 1}];
|
||||
// Source service ip.
|
||||
string ip = 4 [(validate.rules).string = {ip: true, ignore_empty: true}];
|
||||
}
|
||||
|
||||
// Manager RPC Service.
|
||||
service Manager {
|
||||
// Get SeedPeer and SeedPeer cluster configuration.
|
||||
|
@ -362,6 +362,9 @@ service Manager {
|
|||
// Update SeedPeer configuration.
|
||||
rpc UpdateSeedPeer(UpdateSeedPeerRequest) returns(SeedPeer);
|
||||
|
||||
// Delete SeedPeer configuration.
|
||||
rpc DeleteSeedPeer(DeleteSeedPeerRequest) returns(google.protobuf.Empty);
|
||||
|
||||
// Get Scheduler and Scheduler cluster configuration.
|
||||
rpc GetScheduler(GetSchedulerRequest)returns(Scheduler);
|
||||
|
||||
|
@ -382,7 +385,4 @@ service Manager {
|
|||
|
||||
// Create model and update data of model to object storage.
|
||||
rpc CreateModel(CreateModelRequest)returns(google.protobuf.Empty);
|
||||
|
||||
// KeepAlive with manager.
|
||||
rpc KeepAlive(stream KeepAliveRequest)returns(google.protobuf.Empty);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ type ManagerClient interface {
|
|||
GetSeedPeer(ctx context.Context, in *GetSeedPeerRequest, opts ...grpc.CallOption) (*SeedPeer, error)
|
||||
// Update SeedPeer configuration.
|
||||
UpdateSeedPeer(ctx context.Context, in *UpdateSeedPeerRequest, opts ...grpc.CallOption) (*SeedPeer, error)
|
||||
// Delete SeedPeer configuration.
|
||||
DeleteSeedPeer(ctx context.Context, in *DeleteSeedPeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// Get Scheduler and Scheduler cluster configuration.
|
||||
GetScheduler(ctx context.Context, in *GetSchedulerRequest, opts ...grpc.CallOption) (*Scheduler, error)
|
||||
// Update scheduler configuration.
|
||||
|
@ -41,8 +43,6 @@ type ManagerClient interface {
|
|||
ListApplications(ctx context.Context, in *ListApplicationsRequest, opts ...grpc.CallOption) (*ListApplicationsResponse, error)
|
||||
// Create model and update data of model to object storage.
|
||||
CreateModel(ctx context.Context, in *CreateModelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// KeepAlive with manager.
|
||||
KeepAlive(ctx context.Context, opts ...grpc.CallOption) (Manager_KeepAliveClient, error)
|
||||
}
|
||||
|
||||
type managerClient struct {
|
||||
|
@ -71,6 +71,15 @@ func (c *managerClient) UpdateSeedPeer(ctx context.Context, in *UpdateSeedPeerRe
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *managerClient) DeleteSeedPeer(ctx context.Context, in *DeleteSeedPeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/manager.v2.Manager/DeleteSeedPeer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *managerClient) GetScheduler(ctx context.Context, in *GetSchedulerRequest, opts ...grpc.CallOption) (*Scheduler, error) {
|
||||
out := new(Scheduler)
|
||||
err := c.cc.Invoke(ctx, "/manager.v2.Manager/GetScheduler", in, out, opts...)
|
||||
|
@ -134,40 +143,6 @@ func (c *managerClient) CreateModel(ctx context.Context, in *CreateModelRequest,
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *managerClient) KeepAlive(ctx context.Context, opts ...grpc.CallOption) (Manager_KeepAliveClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &Manager_ServiceDesc.Streams[0], "/manager.v2.Manager/KeepAlive", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &managerKeepAliveClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type Manager_KeepAliveClient interface {
|
||||
Send(*KeepAliveRequest) error
|
||||
CloseAndRecv() (*emptypb.Empty, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type managerKeepAliveClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *managerKeepAliveClient) Send(m *KeepAliveRequest) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *managerKeepAliveClient) CloseAndRecv() (*emptypb.Empty, error) {
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := new(emptypb.Empty)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// ManagerServer is the server API for Manager service.
|
||||
// All implementations should embed UnimplementedManagerServer
|
||||
// for forward compatibility
|
||||
|
@ -176,6 +151,8 @@ type ManagerServer interface {
|
|||
GetSeedPeer(context.Context, *GetSeedPeerRequest) (*SeedPeer, error)
|
||||
// Update SeedPeer configuration.
|
||||
UpdateSeedPeer(context.Context, *UpdateSeedPeerRequest) (*SeedPeer, error)
|
||||
// Delete SeedPeer configuration.
|
||||
DeleteSeedPeer(context.Context, *DeleteSeedPeerRequest) (*emptypb.Empty, error)
|
||||
// Get Scheduler and Scheduler cluster configuration.
|
||||
GetScheduler(context.Context, *GetSchedulerRequest) (*Scheduler, error)
|
||||
// Update scheduler configuration.
|
||||
|
@ -190,8 +167,6 @@ type ManagerServer interface {
|
|||
ListApplications(context.Context, *ListApplicationsRequest) (*ListApplicationsResponse, error)
|
||||
// Create model and update data of model to object storage.
|
||||
CreateModel(context.Context, *CreateModelRequest) (*emptypb.Empty, error)
|
||||
// KeepAlive with manager.
|
||||
KeepAlive(Manager_KeepAliveServer) error
|
||||
}
|
||||
|
||||
// UnimplementedManagerServer should be embedded to have forward compatible implementations.
|
||||
|
@ -204,6 +179,9 @@ func (UnimplementedManagerServer) GetSeedPeer(context.Context, *GetSeedPeerReque
|
|||
func (UnimplementedManagerServer) UpdateSeedPeer(context.Context, *UpdateSeedPeerRequest) (*SeedPeer, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateSeedPeer not implemented")
|
||||
}
|
||||
func (UnimplementedManagerServer) DeleteSeedPeer(context.Context, *DeleteSeedPeerRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteSeedPeer not implemented")
|
||||
}
|
||||
func (UnimplementedManagerServer) GetScheduler(context.Context, *GetSchedulerRequest) (*Scheduler, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetScheduler not implemented")
|
||||
}
|
||||
|
@ -225,9 +203,6 @@ func (UnimplementedManagerServer) ListApplications(context.Context, *ListApplica
|
|||
func (UnimplementedManagerServer) CreateModel(context.Context, *CreateModelRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateModel not implemented")
|
||||
}
|
||||
func (UnimplementedManagerServer) KeepAlive(Manager_KeepAliveServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method KeepAlive not implemented")
|
||||
}
|
||||
|
||||
// UnsafeManagerServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ManagerServer will
|
||||
|
@ -276,6 +251,24 @@ func _Manager_UpdateSeedPeer_Handler(srv interface{}, ctx context.Context, dec f
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Manager_DeleteSeedPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteSeedPeerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ManagerServer).DeleteSeedPeer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/manager.v2.Manager/DeleteSeedPeer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ManagerServer).DeleteSeedPeer(ctx, req.(*DeleteSeedPeerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Manager_GetScheduler_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetSchedulerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -402,32 +395,6 @@ func _Manager_CreateModel_Handler(srv interface{}, ctx context.Context, dec func
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Manager_KeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(ManagerServer).KeepAlive(&managerKeepAliveServer{stream})
|
||||
}
|
||||
|
||||
type Manager_KeepAliveServer interface {
|
||||
SendAndClose(*emptypb.Empty) error
|
||||
Recv() (*KeepAliveRequest, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type managerKeepAliveServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *managerKeepAliveServer) SendAndClose(m *emptypb.Empty) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *managerKeepAliveServer) Recv() (*KeepAliveRequest, error) {
|
||||
m := new(KeepAliveRequest)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Manager_ServiceDesc is the grpc.ServiceDesc for Manager service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -443,6 +410,10 @@ var Manager_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "UpdateSeedPeer",
|
||||
Handler: _Manager_UpdateSeedPeer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSeedPeer",
|
||||
Handler: _Manager_DeleteSeedPeer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetScheduler",
|
||||
Handler: _Manager_GetScheduler_Handler,
|
||||
|
@ -472,12 +443,6 @@ var Manager_ServiceDesc = grpc.ServiceDesc{
|
|||
Handler: _Manager_CreateModel_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "KeepAlive",
|
||||
Handler: _Manager_KeepAlive_Handler,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pkg/apis/manager/v2/manager.proto",
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
manager "d7y.io/api/v2/pkg/apis/manager/v2"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
grpc "google.golang.org/grpc"
|
||||
metadata "google.golang.org/grpc/metadata"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
|
@ -58,6 +57,26 @@ func (mr *MockManagerClientMockRecorder) CreateModel(ctx, in interface{}, opts .
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateModel", reflect.TypeOf((*MockManagerClient)(nil).CreateModel), varargs...)
|
||||
}
|
||||
|
||||
// DeleteSeedPeer mocks base method.
|
||||
func (m *MockManagerClient) DeleteSeedPeer(ctx context.Context, in *manager.DeleteSeedPeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, in}
|
||||
for _, a := range opts {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "DeleteSeedPeer", varargs...)
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// DeleteSeedPeer indicates an expected call of DeleteSeedPeer.
|
||||
func (mr *MockManagerClientMockRecorder) DeleteSeedPeer(ctx, in interface{}, opts ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, in}, opts...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSeedPeer", reflect.TypeOf((*MockManagerClient)(nil).DeleteSeedPeer), varargs...)
|
||||
}
|
||||
|
||||
// GetObjectStorage mocks base method.
|
||||
func (m *MockManagerClient) GetObjectStorage(ctx context.Context, in *manager.GetObjectStorageRequest, opts ...grpc.CallOption) (*manager.ObjectStorage, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -118,26 +137,6 @@ func (mr *MockManagerClientMockRecorder) GetSeedPeer(ctx, in interface{}, opts .
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSeedPeer", reflect.TypeOf((*MockManagerClient)(nil).GetSeedPeer), varargs...)
|
||||
}
|
||||
|
||||
// KeepAlive mocks base method.
|
||||
func (m *MockManagerClient) KeepAlive(ctx context.Context, opts ...grpc.CallOption) (manager.Manager_KeepAliveClient, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx}
|
||||
for _, a := range opts {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "KeepAlive", varargs...)
|
||||
ret0, _ := ret[0].(manager.Manager_KeepAliveClient)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// KeepAlive indicates an expected call of KeepAlive.
|
||||
func (mr *MockManagerClientMockRecorder) KeepAlive(ctx interface{}, opts ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx}, opts...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeepAlive", reflect.TypeOf((*MockManagerClient)(nil).KeepAlive), varargs...)
|
||||
}
|
||||
|
||||
// ListApplications mocks base method.
|
||||
func (m *MockManagerClient) ListApplications(ctx context.Context, in *manager.ListApplicationsRequest, opts ...grpc.CallOption) (*manager.ListApplicationsResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -238,143 +237,6 @@ func (mr *MockManagerClientMockRecorder) UpdateSeedPeer(ctx, in interface{}, opt
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSeedPeer", reflect.TypeOf((*MockManagerClient)(nil).UpdateSeedPeer), varargs...)
|
||||
}
|
||||
|
||||
// MockManager_KeepAliveClient is a mock of Manager_KeepAliveClient interface.
|
||||
type MockManager_KeepAliveClient struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockManager_KeepAliveClientMockRecorder
|
||||
}
|
||||
|
||||
// MockManager_KeepAliveClientMockRecorder is the mock recorder for MockManager_KeepAliveClient.
|
||||
type MockManager_KeepAliveClientMockRecorder struct {
|
||||
mock *MockManager_KeepAliveClient
|
||||
}
|
||||
|
||||
// NewMockManager_KeepAliveClient creates a new mock instance.
|
||||
func NewMockManager_KeepAliveClient(ctrl *gomock.Controller) *MockManager_KeepAliveClient {
|
||||
mock := &MockManager_KeepAliveClient{ctrl: ctrl}
|
||||
mock.recorder = &MockManager_KeepAliveClientMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockManager_KeepAliveClient) EXPECT() *MockManager_KeepAliveClientMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// CloseAndRecv mocks base method.
|
||||
func (m *MockManager_KeepAliveClient) CloseAndRecv() (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CloseAndRecv")
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// CloseAndRecv indicates an expected call of CloseAndRecv.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) CloseAndRecv() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseAndRecv", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).CloseAndRecv))
|
||||
}
|
||||
|
||||
// CloseSend mocks base method.
|
||||
func (m *MockManager_KeepAliveClient) CloseSend() error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CloseSend")
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// CloseSend indicates an expected call of CloseSend.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) CloseSend() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).CloseSend))
|
||||
}
|
||||
|
||||
// Context mocks base method.
|
||||
func (m *MockManager_KeepAliveClient) Context() context.Context {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Context")
|
||||
ret0, _ := ret[0].(context.Context)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Context indicates an expected call of Context.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) Context() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Context))
|
||||
}
|
||||
|
||||
// Header mocks base method.
|
||||
func (m *MockManager_KeepAliveClient) Header() (metadata.MD, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Header")
|
||||
ret0, _ := ret[0].(metadata.MD)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Header indicates an expected call of Header.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) Header() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Header))
|
||||
}
|
||||
|
||||
// RecvMsg mocks base method.
|
||||
func (m_2 *MockManager_KeepAliveClient) RecvMsg(m interface{}) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "RecvMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// RecvMsg indicates an expected call of RecvMsg.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) RecvMsg(m interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).RecvMsg), m)
|
||||
}
|
||||
|
||||
// Send mocks base method.
|
||||
func (m *MockManager_KeepAliveClient) Send(arg0 *manager.KeepAliveRequest) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Send", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Send indicates an expected call of Send.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) Send(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Send), arg0)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m_2 *MockManager_KeepAliveClient) SendMsg(m interface{}) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "SendMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) SendMsg(m interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).SendMsg), m)
|
||||
}
|
||||
|
||||
// Trailer mocks base method.
|
||||
func (m *MockManager_KeepAliveClient) Trailer() metadata.MD {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Trailer")
|
||||
ret0, _ := ret[0].(metadata.MD)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Trailer indicates an expected call of Trailer.
|
||||
func (mr *MockManager_KeepAliveClientMockRecorder) Trailer() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Trailer))
|
||||
}
|
||||
|
||||
// MockManagerServer is a mock of ManagerServer interface.
|
||||
type MockManagerServer struct {
|
||||
ctrl *gomock.Controller
|
||||
|
@ -413,6 +275,21 @@ func (mr *MockManagerServerMockRecorder) CreateModel(arg0, arg1 interface{}) *go
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateModel", reflect.TypeOf((*MockManagerServer)(nil).CreateModel), arg0, arg1)
|
||||
}
|
||||
|
||||
// DeleteSeedPeer mocks base method.
|
||||
func (m *MockManagerServer) DeleteSeedPeer(arg0 context.Context, arg1 *manager.DeleteSeedPeerRequest) (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DeleteSeedPeer", arg0, arg1)
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// DeleteSeedPeer indicates an expected call of DeleteSeedPeer.
|
||||
func (mr *MockManagerServerMockRecorder) DeleteSeedPeer(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSeedPeer", reflect.TypeOf((*MockManagerServer)(nil).DeleteSeedPeer), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetObjectStorage mocks base method.
|
||||
func (m *MockManagerServer) GetObjectStorage(arg0 context.Context, arg1 *manager.GetObjectStorageRequest) (*manager.ObjectStorage, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -458,20 +335,6 @@ func (mr *MockManagerServerMockRecorder) GetSeedPeer(arg0, arg1 interface{}) *go
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSeedPeer", reflect.TypeOf((*MockManagerServer)(nil).GetSeedPeer), arg0, arg1)
|
||||
}
|
||||
|
||||
// KeepAlive mocks base method.
|
||||
func (m *MockManagerServer) KeepAlive(arg0 manager.Manager_KeepAliveServer) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "KeepAlive", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// KeepAlive indicates an expected call of KeepAlive.
|
||||
func (mr *MockManagerServerMockRecorder) KeepAlive(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeepAlive", reflect.TypeOf((*MockManagerServer)(nil).KeepAlive), arg0)
|
||||
}
|
||||
|
||||
// ListApplications mocks base method.
|
||||
func (m *MockManagerServer) ListApplications(arg0 context.Context, arg1 *manager.ListApplicationsRequest) (*manager.ListApplicationsResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -581,137 +444,3 @@ func (mr *MockUnsafeManagerServerMockRecorder) mustEmbedUnimplementedManagerServ
|
|||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedManagerServer", reflect.TypeOf((*MockUnsafeManagerServer)(nil).mustEmbedUnimplementedManagerServer))
|
||||
}
|
||||
|
||||
// MockManager_KeepAliveServer is a mock of Manager_KeepAliveServer interface.
|
||||
type MockManager_KeepAliveServer struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockManager_KeepAliveServerMockRecorder
|
||||
}
|
||||
|
||||
// MockManager_KeepAliveServerMockRecorder is the mock recorder for MockManager_KeepAliveServer.
|
||||
type MockManager_KeepAliveServerMockRecorder struct {
|
||||
mock *MockManager_KeepAliveServer
|
||||
}
|
||||
|
||||
// NewMockManager_KeepAliveServer creates a new mock instance.
|
||||
func NewMockManager_KeepAliveServer(ctrl *gomock.Controller) *MockManager_KeepAliveServer {
|
||||
mock := &MockManager_KeepAliveServer{ctrl: ctrl}
|
||||
mock.recorder = &MockManager_KeepAliveServerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockManager_KeepAliveServer) EXPECT() *MockManager_KeepAliveServerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Context mocks base method.
|
||||
func (m *MockManager_KeepAliveServer) Context() context.Context {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Context")
|
||||
ret0, _ := ret[0].(context.Context)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Context indicates an expected call of Context.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) Context() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).Context))
|
||||
}
|
||||
|
||||
// Recv mocks base method.
|
||||
func (m *MockManager_KeepAliveServer) Recv() (*manager.KeepAliveRequest, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Recv")
|
||||
ret0, _ := ret[0].(*manager.KeepAliveRequest)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Recv indicates an expected call of Recv.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) Recv() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).Recv))
|
||||
}
|
||||
|
||||
// RecvMsg mocks base method.
|
||||
func (m_2 *MockManager_KeepAliveServer) RecvMsg(m interface{}) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "RecvMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// RecvMsg indicates an expected call of RecvMsg.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) RecvMsg(m interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).RecvMsg), m)
|
||||
}
|
||||
|
||||
// SendAndClose mocks base method.
|
||||
func (m *MockManager_KeepAliveServer) SendAndClose(arg0 *emptypb.Empty) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendAndClose", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendAndClose indicates an expected call of SendAndClose.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) SendAndClose(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendAndClose", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SendAndClose), arg0)
|
||||
}
|
||||
|
||||
// SendHeader mocks base method.
|
||||
func (m *MockManager_KeepAliveServer) SendHeader(arg0 metadata.MD) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendHeader", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendHeader indicates an expected call of SendHeader.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SendHeader), arg0)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m_2 *MockManager_KeepAliveServer) SendMsg(m interface{}) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "SendMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) SendMsg(m interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SendMsg), m)
|
||||
}
|
||||
|
||||
// SetHeader mocks base method.
|
||||
func (m *MockManager_KeepAliveServer) SetHeader(arg0 metadata.MD) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetHeader", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetHeader indicates an expected call of SetHeader.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SetHeader), arg0)
|
||||
}
|
||||
|
||||
// SetTrailer mocks base method.
|
||||
func (m *MockManager_KeepAliveServer) SetTrailer(arg0 metadata.MD) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetTrailer", arg0)
|
||||
}
|
||||
|
||||
// SetTrailer indicates an expected call of SetTrailer.
|
||||
func (mr *MockManager_KeepAliveServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SetTrailer), arg0)
|
||||
}
|
||||
|
|
|
@ -109,6 +109,18 @@ message UpdateSeedPeerRequest {
|
|||
int32 object_storage_port = 10;
|
||||
}
|
||||
|
||||
// DeleteSeedPeerRequest represents request of DeleteSeedPeer.
|
||||
message DeleteSeedPeerRequest {
|
||||
// Request source type.
|
||||
SourceType source_type = 1;
|
||||
// Source service hostname.
|
||||
string hostname = 2;
|
||||
// Source service ip.
|
||||
string ip = 3;
|
||||
// ID of the cluster to which the source service belongs.
|
||||
uint64 cluster_id = 4;
|
||||
}
|
||||
|
||||
// SeedPeerCluster represents cluster of scheduler.
|
||||
message SchedulerCluster {
|
||||
// Cluster id.
|
||||
|
@ -337,18 +349,6 @@ message CreateModelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
// KeepAliveRequest represents request of KeepAlive.
|
||||
message KeepAliveRequest {
|
||||
// Request source type.
|
||||
SourceType source_type = 1;
|
||||
// Source service hostname.
|
||||
string hostname = 2;
|
||||
// ID of the cluster to which the source service belongs.
|
||||
uint64 cluster_id = 3;
|
||||
// Source service ip.
|
||||
string ip = 4;
|
||||
}
|
||||
|
||||
// Manager RPC Service.
|
||||
service Manager {
|
||||
// Get SeedPeer and SeedPeer cluster configuration.
|
||||
|
@ -357,6 +357,9 @@ service Manager {
|
|||
// Update SeedPeer configuration.
|
||||
rpc UpdateSeedPeer(UpdateSeedPeerRequest) returns(SeedPeer);
|
||||
|
||||
// Delete SeedPeer configuration.
|
||||
rpc DeleteSeedPeer(DeleteSeedPeerRequest) returns(google.protobuf.Empty);
|
||||
|
||||
// Get Scheduler and Scheduler cluster configuration.
|
||||
rpc GetScheduler(GetSchedulerRequest)returns(Scheduler);
|
||||
|
||||
|
@ -377,7 +380,4 @@ service Manager {
|
|||
|
||||
// Create model and update data of model to object storage.
|
||||
rpc CreateModel(CreateModelRequest)returns(google.protobuf.Empty);
|
||||
|
||||
// KeepAlive with manager.
|
||||
rpc KeepAlive(stream KeepAliveRequest)returns(google.protobuf.Empty);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -111,6 +111,23 @@ pub struct UpdateSeedPeerRequest {
|
|||
#[prost(int32, tag = "10")]
|
||||
pub object_storage_port: i32,
|
||||
}
|
||||
/// DeleteSeedPeerRequest represents request of DeleteSeedPeer.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DeleteSeedPeerRequest {
|
||||
/// Request source type.
|
||||
#[prost(enumeration = "SourceType", tag = "1")]
|
||||
pub source_type: i32,
|
||||
/// Source service hostname.
|
||||
#[prost(string, tag = "2")]
|
||||
pub hostname: ::prost::alloc::string::String,
|
||||
/// Source service ip.
|
||||
#[prost(string, tag = "3")]
|
||||
pub ip: ::prost::alloc::string::String,
|
||||
/// ID of the cluster to which the source service belongs.
|
||||
#[prost(uint64, tag = "4")]
|
||||
pub cluster_id: u64,
|
||||
}
|
||||
/// SeedPeerCluster represents cluster of scheduler.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
@ -440,23 +457,6 @@ pub mod create_model_request {
|
|||
CreateMlpRequest(super::CreateMlpRequest),
|
||||
}
|
||||
}
|
||||
/// KeepAliveRequest represents request of KeepAlive.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct KeepAliveRequest {
|
||||
/// Request source type.
|
||||
#[prost(enumeration = "SourceType", tag = "1")]
|
||||
pub source_type: i32,
|
||||
/// Source service hostname.
|
||||
#[prost(string, tag = "2")]
|
||||
pub hostname: ::prost::alloc::string::String,
|
||||
/// ID of the cluster to which the source service belongs.
|
||||
#[prost(uint64, tag = "3")]
|
||||
pub cluster_id: u64,
|
||||
/// Source service ip.
|
||||
#[prost(string, tag = "4")]
|
||||
pub ip: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Request source type.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
|
@ -622,6 +622,29 @@ pub mod manager_client {
|
|||
.insert(GrpcMethod::new("manager.v2.Manager", "UpdateSeedPeer"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Delete SeedPeer configuration.
|
||||
pub async fn delete_seed_peer(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::DeleteSeedPeerRequest>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
|
||||
self.inner
|
||||
.ready()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tonic::Status::new(
|
||||
tonic::Code::Unknown,
|
||||
format!("Service was not ready: {}", e.into()),
|
||||
)
|
||||
})?;
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(
|
||||
"/manager.v2.Manager/DeleteSeedPeer",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(GrpcMethod::new("manager.v2.Manager", "DeleteSeedPeer"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Get Scheduler and Scheduler cluster configuration.
|
||||
pub async fn get_scheduler(
|
||||
&mut self,
|
||||
|
@ -792,29 +815,6 @@ pub mod manager_client {
|
|||
.insert(GrpcMethod::new("manager.v2.Manager", "CreateModel"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// KeepAlive with manager.
|
||||
pub async fn keep_alive(
|
||||
&mut self,
|
||||
request: impl tonic::IntoStreamingRequest<Message = super::KeepAliveRequest>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
|
||||
self.inner
|
||||
.ready()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tonic::Status::new(
|
||||
tonic::Code::Unknown,
|
||||
format!("Service was not ready: {}", e.into()),
|
||||
)
|
||||
})?;
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(
|
||||
"/manager.v2.Manager/KeepAlive",
|
||||
);
|
||||
let mut req = request.into_streaming_request();
|
||||
req.extensions_mut()
|
||||
.insert(GrpcMethod::new("manager.v2.Manager", "KeepAlive"));
|
||||
self.inner.client_streaming(req, path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Generated server implementations.
|
||||
|
@ -834,6 +834,11 @@ pub mod manager_server {
|
|||
&self,
|
||||
request: tonic::Request<super::UpdateSeedPeerRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::SeedPeer>, tonic::Status>;
|
||||
/// Delete SeedPeer configuration.
|
||||
async fn delete_seed_peer(
|
||||
&self,
|
||||
request: tonic::Request<super::DeleteSeedPeerRequest>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
||||
/// Get Scheduler and Scheduler cluster configuration.
|
||||
async fn get_scheduler(
|
||||
&self,
|
||||
|
@ -878,11 +883,6 @@ pub mod manager_server {
|
|||
&self,
|
||||
request: tonic::Request<super::CreateModelRequest>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
||||
/// KeepAlive with manager.
|
||||
async fn keep_alive(
|
||||
&self,
|
||||
request: tonic::Request<tonic::Streaming<super::KeepAliveRequest>>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
||||
}
|
||||
/// Manager RPC Service.
|
||||
#[derive(Debug)]
|
||||
|
@ -1056,6 +1056,52 @@ pub mod manager_server {
|
|||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/manager.v2.Manager/DeleteSeedPeer" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct DeleteSeedPeerSvc<T: Manager>(pub Arc<T>);
|
||||
impl<
|
||||
T: Manager,
|
||||
> tonic::server::UnaryService<super::DeleteSeedPeerRequest>
|
||||
for DeleteSeedPeerSvc<T> {
|
||||
type Response = ();
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::DeleteSeedPeerRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
(*inner).delete_seed_peer(request).await
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
}
|
||||
let accept_compression_encodings = self.accept_compression_encodings;
|
||||
let send_compression_encodings = self.send_compression_encodings;
|
||||
let max_decoding_message_size = self.max_decoding_message_size;
|
||||
let max_encoding_message_size = self.max_encoding_message_size;
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let inner = inner.0;
|
||||
let method = DeleteSeedPeerSvc(inner);
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec)
|
||||
.apply_compression_config(
|
||||
accept_compression_encodings,
|
||||
send_compression_encodings,
|
||||
)
|
||||
.apply_max_message_size_config(
|
||||
max_decoding_message_size,
|
||||
max_encoding_message_size,
|
||||
);
|
||||
let res = grpc.unary(method, req).await;
|
||||
Ok(res)
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/manager.v2.Manager/GetScheduler" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetSchedulerSvc<T: Manager>(pub Arc<T>);
|
||||
|
@ -1378,52 +1424,6 @@ pub mod manager_server {
|
|||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/manager.v2.Manager/KeepAlive" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct KeepAliveSvc<T: Manager>(pub Arc<T>);
|
||||
impl<
|
||||
T: Manager,
|
||||
> tonic::server::ClientStreamingService<super::KeepAliveRequest>
|
||||
for KeepAliveSvc<T> {
|
||||
type Response = ();
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<
|
||||
tonic::Streaming<super::KeepAliveRequest>,
|
||||
>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move { (*inner).keep_alive(request).await };
|
||||
Box::pin(fut)
|
||||
}
|
||||
}
|
||||
let accept_compression_encodings = self.accept_compression_encodings;
|
||||
let send_compression_encodings = self.send_compression_encodings;
|
||||
let max_decoding_message_size = self.max_decoding_message_size;
|
||||
let max_encoding_message_size = self.max_encoding_message_size;
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let inner = inner.0;
|
||||
let method = KeepAliveSvc(inner);
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec)
|
||||
.apply_compression_config(
|
||||
accept_compression_encodings,
|
||||
send_compression_encodings,
|
||||
)
|
||||
.apply_max_message_size_config(
|
||||
max_decoding_message_size,
|
||||
max_encoding_message_size,
|
||||
);
|
||||
let res = grpc.client_streaming(method, req).await;
|
||||
Ok(res)
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
_ => {
|
||||
Box::pin(async move {
|
||||
Ok(
|
||||
|
|
Loading…
Reference in New Issue