diff --git a/pkg/rpc/base/base.pb.go b/pkg/rpc/base/base.pb.go index 74097bcb1d4..1533f919414 100644 --- a/pkg/rpc/base/base.pb.go +++ b/pkg/rpc/base/base.pb.go @@ -15,14 +15,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.17.3 +// protoc-gen-go v1.26.0 +// protoc v3.15.8 // source: pkg/rpc/base/base.proto package base import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -36,10 +35,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type Code int32 const ( diff --git a/pkg/rpc/base/base.pb.validate.go b/pkg/rpc/base/base.pb.validate.go index e0ae9d0e949..5c4ac414089 100644 --- a/pkg/rpc/base/base.pb.validate.go +++ b/pkg/rpc/base/base.pb.validate.go @@ -34,53 +34,20 @@ var ( ) // Validate checks the field values on GrpcDfError 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *GrpcDfError) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcDfError 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 GrpcDfErrorMultiError, or -// nil if none found. -func (m *GrpcDfError) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcDfError) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Code // no validation rules for Message - if len(errors) > 0 { - return GrpcDfErrorMultiError(errors) - } return nil } -// GrpcDfErrorMultiError is an error wrapping multiple validation errors -// returned by GrpcDfError.ValidateAll() if the designated constraints aren't met. -type GrpcDfErrorMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcDfErrorMultiError) 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 GrpcDfErrorMultiError) AllErrors() []error { return m } - // GrpcDfErrorValidationError is the validation error returned by // GrpcDfError.Validate if the designated constraints aren't met. type GrpcDfErrorValidationError struct { @@ -136,26 +103,12 @@ var _ interface { } = GrpcDfErrorValidationError{} // Validate checks the field values on UrlMeta 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *UrlMeta) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UrlMeta 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 UrlMetaMultiError, or nil if none found. -func (m *UrlMeta) ValidateAll() error { - return m.validate(true) -} - -func (m *UrlMeta) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Digest // no validation rules for Tag @@ -166,28 +119,9 @@ func (m *UrlMeta) validate(all bool) error { // no validation rules for Header - if len(errors) > 0 { - return UrlMetaMultiError(errors) - } return nil } -// UrlMetaMultiError is an error wrapping multiple validation errors returned -// by UrlMeta.ValidateAll() if the designated constraints aren't met. -type UrlMetaMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UrlMetaMultiError) 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 UrlMetaMultiError) AllErrors() []error { return m } - // UrlMetaValidationError is the validation error returned by UrlMeta.Validate // if the designated constraints aren't met. type UrlMetaValidationError struct { @@ -243,55 +177,21 @@ var _ interface { } = UrlMetaValidationError{} // Validate checks the field values on HostLoad 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *HostLoad) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HostLoad 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 HostLoadMultiError, or nil -// if none found. -func (m *HostLoad) ValidateAll() error { - return m.validate(true) -} - -func (m *HostLoad) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for CpuRatio // no validation rules for MemRatio // no validation rules for DiskRatio - if len(errors) > 0 { - return HostLoadMultiError(errors) - } return nil } -// HostLoadMultiError is an error wrapping multiple validation errors returned -// by HostLoad.ValidateAll() if the designated constraints aren't met. -type HostLoadMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HostLoadMultiError) 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 HostLoadMultiError) AllErrors() []error { return m } - // HostLoadValidationError is the validation error returned by // HostLoad.Validate if the designated constraints aren't met. type HostLoadValidationError struct { @@ -347,27 +247,13 @@ var _ interface { } = HostLoadValidationError{} // Validate checks the field values on PieceTaskRequest 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. +// in the proto definition for this message. If any rules are violated, an +// error is returned. func (m *PieceTaskRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PieceTaskRequest 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 -// PieceTaskRequestMultiError, or nil if none found. -func (m *PieceTaskRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *PieceTaskRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for SrcPid @@ -378,29 +264,9 @@ func (m *PieceTaskRequest) validate(all bool) error { // no validation rules for Limit - if len(errors) > 0 { - return PieceTaskRequestMultiError(errors) - } return nil } -// PieceTaskRequestMultiError is an error wrapping multiple validation errors -// returned by PieceTaskRequest.ValidateAll() if the designated constraints -// aren't met. -type PieceTaskRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PieceTaskRequestMultiError) 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 PieceTaskRequestMultiError) AllErrors() []error { return m } - // PieceTaskRequestValidationError is the validation error returned by // PieceTaskRequest.Validate if the designated constraints aren't met. type PieceTaskRequestValidationError struct { @@ -456,27 +322,12 @@ var _ interface { } = PieceTaskRequestValidationError{} // Validate checks the field values on PieceInfo 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *PieceInfo) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PieceInfo 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 PieceInfoMultiError, or nil -// if none found. -func (m *PieceInfo) ValidateAll() error { - return m.validate(true) -} - -func (m *PieceInfo) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for PieceNum // no validation rules for RangeStart @@ -489,28 +340,9 @@ func (m *PieceInfo) validate(all bool) error { // no validation rules for PieceStyle - if len(errors) > 0 { - return PieceInfoMultiError(errors) - } return nil } -// PieceInfoMultiError is an error wrapping multiple validation errors returned -// by PieceInfo.ValidateAll() if the designated constraints aren't met. -type PieceInfoMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PieceInfoMultiError) 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 PieceInfoMultiError) AllErrors() []error { return m } - // PieceInfoValidationError is the validation error returned by // PieceInfo.Validate if the designated constraints aren't met. type PieceInfoValidationError struct { @@ -566,27 +398,13 @@ var _ interface { } = PieceInfoValidationError{} // Validate checks the field values on PiecePacket 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *PiecePacket) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PiecePacket 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 PiecePacketMultiError, or -// nil if none found. -func (m *PiecePacket) ValidateAll() error { - return m.validate(true) -} - -func (m *PiecePacket) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for DstPid @@ -596,26 +414,7 @@ func (m *PiecePacket) validate(all bool) error { for idx, item := range m.GetPieceInfos() { _, _ = idx, item - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PiecePacketValidationError{ - field: fmt.Sprintf("PieceInfos[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PiecePacketValidationError{ - field: fmt.Sprintf("PieceInfos[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PiecePacketValidationError{ field: fmt.Sprintf("PieceInfos[%v]", idx), @@ -633,28 +432,9 @@ func (m *PiecePacket) validate(all bool) error { // no validation rules for PieceMd5Sign - if len(errors) > 0 { - return PiecePacketMultiError(errors) - } return nil } -// PiecePacketMultiError is an error wrapping multiple validation errors -// returned by PiecePacket.ValidateAll() if the designated constraints aren't met. -type PiecePacketMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PiecePacketMultiError) 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 PiecePacketMultiError) AllErrors() []error { return m } - // PiecePacketValidationError is the validation error returned by // PiecePacket.Validate if the designated constraints aren't met. type PiecePacketValidationError struct { diff --git a/pkg/rpc/cdnsystem/cdnsystem.pb.go b/pkg/rpc/cdnsystem/cdnsystem.pb.go index bed8ecfd7ff..745e7723825 100644 --- a/pkg/rpc/cdnsystem/cdnsystem.pb.go +++ b/pkg/rpc/cdnsystem/cdnsystem.pb.go @@ -15,15 +15,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.17.3 +// protoc-gen-go v1.26.0 +// protoc v3.15.8 // source: pkg/rpc/cdnsystem/cdnsystem.proto package cdnsystem import ( base "d7y.io/dragonfly/v2/pkg/rpc/base" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -37,10 +36,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type SeedRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/rpc/cdnsystem/cdnsystem.pb.validate.go b/pkg/rpc/cdnsystem/cdnsystem.pb.validate.go index 4d1818cdc8e..c2604189c76 100644 --- a/pkg/rpc/cdnsystem/cdnsystem.pb.validate.go +++ b/pkg/rpc/cdnsystem/cdnsystem.pb.validate.go @@ -34,53 +34,20 @@ var ( ) // Validate checks the field values on SeedRequest 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *SeedRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SeedRequest 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 SeedRequestMultiError, or -// nil if none found. -func (m *SeedRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *SeedRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for Url // no validation rules for Filter - if all { - switch v := interface{}(m.GetUrlMeta()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SeedRequestValidationError{ - field: "UrlMeta", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SeedRequestValidationError{ - field: "UrlMeta", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SeedRequestValidationError{ field: "UrlMeta", @@ -90,28 +57,9 @@ func (m *SeedRequest) validate(all bool) error { } } - if len(errors) > 0 { - return SeedRequestMultiError(errors) - } return nil } -// SeedRequestMultiError is an error wrapping multiple validation errors -// returned by SeedRequest.ValidateAll() if the designated constraints aren't met. -type SeedRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SeedRequestMultiError) 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 SeedRequestMultiError) AllErrors() []error { return m } - // SeedRequestValidationError is the validation error returned by // SeedRequest.Validate if the designated constraints aren't met. type SeedRequestValidationError struct { @@ -167,51 +115,17 @@ var _ interface { } = SeedRequestValidationError{} // Validate checks the field values on PieceSeed 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *PieceSeed) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PieceSeed 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 PieceSeedMultiError, or nil -// if none found. -func (m *PieceSeed) ValidateAll() error { - return m.validate(true) -} - -func (m *PieceSeed) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for PeerId // no validation rules for HostUuid - if all { - switch v := interface{}(m.GetPieceInfo()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PieceSeedValidationError{ - field: "PieceInfo", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PieceSeedValidationError{ - field: "PieceInfo", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PieceSeedValidationError{ field: "PieceInfo", @@ -227,28 +141,9 @@ func (m *PieceSeed) validate(all bool) error { // no validation rules for TotalPieceCount - if len(errors) > 0 { - return PieceSeedMultiError(errors) - } return nil } -// PieceSeedMultiError is an error wrapping multiple validation errors returned -// by PieceSeed.ValidateAll() if the designated constraints aren't met. -type PieceSeedMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PieceSeedMultiError) 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 PieceSeedMultiError) AllErrors() []error { return m } - // PieceSeedValidationError is the validation error returned by // PieceSeed.Validate if the designated constraints aren't met. type PieceSeedValidationError struct { diff --git a/pkg/rpc/dfdaemon/dfdaemon.pb.go b/pkg/rpc/dfdaemon/dfdaemon.pb.go index 78b0ea7aeba..2cf15322e05 100644 --- a/pkg/rpc/dfdaemon/dfdaemon.pb.go +++ b/pkg/rpc/dfdaemon/dfdaemon.pb.go @@ -15,15 +15,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.17.3 +// protoc-gen-go v1.26.0 +// protoc v3.15.8 // source: pkg/rpc/dfdaemon/dfdaemon.proto package dfdaemon import ( base "d7y.io/dragonfly/v2/pkg/rpc/base" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -38,10 +37,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type DownRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/rpc/dfdaemon/dfdaemon.pb.validate.go b/pkg/rpc/dfdaemon/dfdaemon.pb.validate.go index d716a2d6793..82ec8c63a95 100644 --- a/pkg/rpc/dfdaemon/dfdaemon.pb.validate.go +++ b/pkg/rpc/dfdaemon/dfdaemon.pb.validate.go @@ -34,27 +34,13 @@ var ( ) // Validate checks the field values on DownRequest 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *DownRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DownRequest 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 DownRequestMultiError, or -// nil if none found. -func (m *DownRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DownRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Uuid // no validation rules for Url @@ -67,26 +53,7 @@ func (m *DownRequest) validate(all bool) error { // no validation rules for DisableBackSource - if all { - switch v := interface{}(m.GetUrlMeta()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DownRequestValidationError{ - field: "UrlMeta", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DownRequestValidationError{ - field: "UrlMeta", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownRequestValidationError{ field: "UrlMeta", @@ -104,28 +71,9 @@ func (m *DownRequest) validate(all bool) error { // no validation rules for Gid - if len(errors) > 0 { - return DownRequestMultiError(errors) - } return nil } -// DownRequestMultiError is an error wrapping multiple validation errors -// returned by DownRequest.ValidateAll() if the designated constraints aren't met. -type DownRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DownRequestMultiError) 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 DownRequestMultiError) AllErrors() []error { return m } - // DownRequestValidationError is the validation error returned by // DownRequest.Validate if the designated constraints aren't met. type DownRequestValidationError struct { @@ -181,27 +129,12 @@ var _ interface { } = DownRequestValidationError{} // Validate checks the field values on DownResult 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *DownResult) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DownResult 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 DownResultMultiError, or -// nil if none found. -func (m *DownResult) ValidateAll() error { - return m.validate(true) -} - -func (m *DownResult) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for PeerId @@ -210,28 +143,9 @@ func (m *DownResult) validate(all bool) error { // no validation rules for Done - if len(errors) > 0 { - return DownResultMultiError(errors) - } return nil } -// DownResultMultiError is an error wrapping multiple validation errors -// returned by DownResult.ValidateAll() if the designated constraints aren't met. -type DownResultMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DownResultMultiError) 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 DownResultMultiError) AllErrors() []error { return m } - // DownResultValidationError is the validation error returned by // DownResult.Validate if the designated constraints aren't met. type DownResultValidationError struct { diff --git a/pkg/rpc/manager/manager.pb.go b/pkg/rpc/manager/manager.pb.go index 55cc26775a1..1335791a054 100644 --- a/pkg/rpc/manager/manager.pb.go +++ b/pkg/rpc/manager/manager.pb.go @@ -15,15 +15,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.17.3 +// protoc-gen-go v1.26.0 +// protoc v3.15.8 // source: pkg/rpc/manager/manager.proto package manager import ( _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -38,10 +37,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type SourceType int32 const ( diff --git a/pkg/rpc/manager/manager.pb.validate.go b/pkg/rpc/manager/manager.pb.validate.go index cddf6b168af..6024806014d 100644 --- a/pkg/rpc/manager/manager.pb.validate.go +++ b/pkg/rpc/manager/manager.pb.validate.go @@ -34,27 +34,12 @@ var ( ) // Validate checks the field values on CDNCluster 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *CDNCluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CDNCluster 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 CDNClusterMultiError, or -// nil if none found. -func (m *CDNCluster) ValidateAll() error { - return m.validate(true) -} - -func (m *CDNCluster) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Id // no validation rules for Name @@ -63,26 +48,7 @@ func (m *CDNCluster) validate(all bool) error { // no validation rules for Config - if all { - switch v := interface{}(m.GetSecurityGroup()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CDNClusterValidationError{ - field: "SecurityGroup", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CDNClusterValidationError{ - field: "SecurityGroup", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CDNClusterValidationError{ field: "SecurityGroup", @@ -92,28 +58,9 @@ func (m *CDNCluster) validate(all bool) error { } } - if len(errors) > 0 { - return CDNClusterMultiError(errors) - } return nil } -// CDNClusterMultiError is an error wrapping multiple validation errors -// returned by CDNCluster.ValidateAll() if the designated constraints aren't met. -type CDNClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CDNClusterMultiError) 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 CDNClusterMultiError) AllErrors() []error { return m } - // CDNClusterValidationError is the validation error returned by // CDNCluster.Validate if the designated constraints aren't met. type CDNClusterValidationError struct { @@ -169,27 +116,13 @@ var _ interface { } = CDNClusterValidationError{} // Validate checks the field values on SecurityGroup 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *SecurityGroup) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SecurityGroup 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 SecurityGroupMultiError, or -// nil if none found. -func (m *SecurityGroup) ValidateAll() error { - return m.validate(true) -} - -func (m *SecurityGroup) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Id // no validation rules for Name @@ -200,29 +133,9 @@ func (m *SecurityGroup) validate(all bool) error { // no validation rules for ProxyDomain - if len(errors) > 0 { - return SecurityGroupMultiError(errors) - } return nil } -// SecurityGroupMultiError is an error wrapping multiple validation errors -// returned by SecurityGroup.ValidateAll() if the designated constraints -// aren't met. -type SecurityGroupMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SecurityGroupMultiError) 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 SecurityGroupMultiError) AllErrors() []error { return m } - // SecurityGroupValidationError is the validation error returned by // SecurityGroup.Validate if the designated constraints aren't met. type SecurityGroupValidationError struct { @@ -278,26 +191,12 @@ var _ interface { } = SecurityGroupValidationError{} // Validate checks the field values on CDN 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. +// definition for this message. If any rules are violated, an error is returned. func (m *CDN) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CDN 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 CDNMultiError, or nil if none found. -func (m *CDN) ValidateAll() error { - return m.validate(true) -} - -func (m *CDN) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Id // no validation rules for HostName @@ -314,26 +213,7 @@ func (m *CDN) validate(all bool) error { // no validation rules for Status - if all { - switch v := interface{}(m.GetCdnCluster()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CDNValidationError{ - field: "CdnCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CDNValidationError{ - field: "CdnCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCdnCluster()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetCdnCluster()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CDNValidationError{ field: "CdnCluster", @@ -343,28 +223,9 @@ func (m *CDN) validate(all bool) error { } } - if len(errors) > 0 { - return CDNMultiError(errors) - } return nil } -// CDNMultiError is an error wrapping multiple validation errors returned by -// CDN.ValidateAll() if the designated constraints aren't met. -type CDNMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CDNMultiError) 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 CDNMultiError) AllErrors() []error { return m } - // CDNValidationError is the validation error returned by CDN.Validate if the // designated constraints aren't met. type CDNValidationError struct { @@ -420,53 +281,28 @@ var _ interface { } = CDNValidationError{} // Validate checks the field values on GetCDNRequest 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *GetCDNRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetCDNRequest 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 GetCDNRequestMultiError, or -// nil if none found. -func (m *GetCDNRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetCDNRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := GetCDNRequestValidationError{ + return GetCDNRequestValidationError{ 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 = GetCDNRequestValidationError{ + return GetCDNRequestValidationError{ field: "HostName", reason: "value must be a valid hostname", cause: err, } - if !all { - return err - } - errors = append(errors, err) } - if len(errors) > 0 { - return GetCDNRequestMultiError(errors) - } return nil } @@ -500,23 +336,6 @@ func (m *GetCDNRequest) _validateHostname(host string) error { return nil } -// GetCDNRequestMultiError is an error wrapping multiple validation errors -// returned by GetCDNRequest.ValidateAll() if the designated constraints -// aren't met. -type GetCDNRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetCDNRequestMultiError) 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 GetCDNRequestMultiError) AllErrors() []error { return m } - // GetCDNRequestValidationError is the validation error returned by // GetCDNRequest.Validate if the designated constraints aren't met. type GetCDNRequestValidationError struct { @@ -572,61 +391,35 @@ var _ interface { } = GetCDNRequestValidationError{} // Validate checks the field values on UpdateCDNRequest 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. +// in the proto definition for this message. If any rules are violated, an +// error is returned. func (m *UpdateCDNRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateCDNRequest 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 -// UpdateCDNRequestMultiError, or nil if none found. -func (m *UpdateCDNRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateCDNRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ 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 = UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ field: "HostName", reason: "value must be a valid hostname", cause: err, } - if !all { - return err - } - errors = append(errors, err) } if m.GetIdc() != "" { if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { - err := UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ field: "Idc", reason: "value length must be between 1 and 1024 runes, inclusive", } - if !all { - return err - } - errors = append(errors, err) } } @@ -634,54 +427,35 @@ func (m *UpdateCDNRequest) validate(all bool) error { if m.GetLocation() != "" { if utf8.RuneCountInString(m.GetLocation()) > 1024 { - err := UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ field: "Location", reason: "value length must be at most 1024 runes", } - if !all { - return err - } - errors = append(errors, err) } } if ip := net.ParseIP(m.GetIp()); ip == nil { - err := UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } - if !all { - return err - } - errors = append(errors, err) } if val := m.GetPort(); val < 1024 || val >= 65535 { - err := UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ field: "Port", reason: "value must be inside range [1024, 65535)", } - if !all { - return err - } - errors = append(errors, err) } if val := m.GetDownloadPort(); val < 1024 || val >= 65535 { - err := UpdateCDNRequestValidationError{ + return UpdateCDNRequestValidationError{ field: "DownloadPort", reason: "value must be inside range [1024, 65535)", } - if !all { - return err - } - errors = append(errors, err) } - if len(errors) > 0 { - return UpdateCDNRequestMultiError(errors) - } return nil } @@ -715,23 +489,6 @@ func (m *UpdateCDNRequest) _validateHostname(host string) error { return nil } -// UpdateCDNRequestMultiError is an error wrapping multiple validation errors -// returned by UpdateCDNRequest.ValidateAll() if the designated constraints -// aren't met. -type UpdateCDNRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateCDNRequestMultiError) 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 UpdateCDNRequestMultiError) AllErrors() []error { return m } - // UpdateCDNRequestValidationError is the validation error returned by // UpdateCDNRequest.Validate if the designated constraints aren't met. type UpdateCDNRequestValidationError struct { @@ -788,35 +545,17 @@ var _ interface { // Validate checks the field values on AddCDNToCDNClusterRequest 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. +// violated, an error is returned. func (m *AddCDNToCDNClusterRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddCDNToCDNClusterRequest 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 -// AddCDNToCDNClusterRequestMultiError, or nil if none found. -func (m *AddCDNToCDNClusterRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddCDNToCDNClusterRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := AddCDNToCDNClusterRequestValidationError{ + return AddCDNToCDNClusterRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } - if !all { - return err - } - errors = append(errors, err) } if m.GetCdnId() != 0 { @@ -827,29 +566,9 @@ func (m *AddCDNToCDNClusterRequest) validate(all bool) error { } - if len(errors) > 0 { - return AddCDNToCDNClusterRequestMultiError(errors) - } return nil } -// AddCDNToCDNClusterRequestMultiError is an error wrapping multiple validation -// errors returned by AddCDNToCDNClusterRequest.ValidateAll() if the -// designated constraints aren't met. -type AddCDNToCDNClusterRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddCDNToCDNClusterRequestMultiError) 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 AddCDNToCDNClusterRequestMultiError) AllErrors() []error { return m } - // AddCDNToCDNClusterRequestValidationError is the validation error returned by // AddCDNToCDNClusterRequest.Validate if the designated constraints aren't met. type AddCDNToCDNClusterRequestValidationError struct { @@ -907,27 +626,13 @@ var _ interface { } = AddCDNToCDNClusterRequestValidationError{} // 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. +// in the proto definition for this message. If any rules are violated, an +// error is returned. func (m *SchedulerCluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SchedulerCluster 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 -// SchedulerClusterMultiError, or nil if none found. -func (m *SchedulerCluster) ValidateAll() error { - return m.validate(true) -} - -func (m *SchedulerCluster) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Id // no validation rules for Name @@ -938,26 +643,7 @@ func (m *SchedulerCluster) validate(all bool) error { // no validation rules for ClientConfig - if all { - switch v := interface{}(m.GetSecurityGroup()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SchedulerClusterValidationError{ - field: "SecurityGroup", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SchedulerClusterValidationError{ - field: "SecurityGroup", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SchedulerClusterValidationError{ field: "SecurityGroup", @@ -967,29 +653,9 @@ func (m *SchedulerCluster) validate(all bool) error { } } - if len(errors) > 0 { - return SchedulerClusterMultiError(errors) - } return nil } -// SchedulerClusterMultiError is an error wrapping multiple validation errors -// returned by SchedulerCluster.ValidateAll() if the designated constraints -// aren't met. -type SchedulerClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SchedulerClusterMultiError) 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 SchedulerClusterMultiError) AllErrors() []error { return m } - // SchedulerClusterValidationError is the validation error returned by // SchedulerCluster.Validate if the designated constraints aren't met. type SchedulerClusterValidationError struct { @@ -1045,27 +711,12 @@ var _ interface { } = SchedulerClusterValidationError{} // Validate checks the field values on Scheduler 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *Scheduler) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Scheduler 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 SchedulerMultiError, or nil -// if none found. -func (m *Scheduler) ValidateAll() error { - return m.validate(true) -} - -func (m *Scheduler) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Id // no validation rules for HostName @@ -1084,26 +735,7 @@ func (m *Scheduler) validate(all bool) error { // no validation rules for Status - if all { - switch v := interface{}(m.GetSchedulerCluster()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SchedulerValidationError{ - field: "SchedulerCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SchedulerValidationError{ - field: "SchedulerCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSchedulerCluster()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetSchedulerCluster()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SchedulerValidationError{ field: "SchedulerCluster", @@ -1116,26 +748,7 @@ func (m *Scheduler) validate(all bool) error { for idx, item := range m.GetCdns() { _, _ = idx, item - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SchedulerValidationError{ - field: fmt.Sprintf("Cdns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SchedulerValidationError{ - field: fmt.Sprintf("Cdns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SchedulerValidationError{ field: fmt.Sprintf("Cdns[%v]", idx), @@ -1147,28 +760,9 @@ func (m *Scheduler) validate(all bool) error { } - if len(errors) > 0 { - return SchedulerMultiError(errors) - } return nil } -// SchedulerMultiError is an error wrapping multiple validation errors returned -// by Scheduler.ValidateAll() if the designated constraints aren't met. -type SchedulerMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SchedulerMultiError) 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 SchedulerMultiError) AllErrors() []error { return m } - // SchedulerValidationError is the validation error returned by // Scheduler.Validate if the designated constraints aren't met. type SchedulerValidationError struct { @@ -1225,52 +819,27 @@ var _ interface { // Validate checks the field values on GetSchedulerRequest 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. +// violated, an error is returned. func (m *GetSchedulerRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetSchedulerRequest 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 -// GetSchedulerRequestMultiError, or nil if none found. -func (m *GetSchedulerRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetSchedulerRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := GetSchedulerRequestValidationError{ + return GetSchedulerRequestValidationError{ 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 = GetSchedulerRequestValidationError{ + return GetSchedulerRequestValidationError{ field: "HostName", reason: "value must be a valid hostname", cause: err, } - if !all { - return err - } - errors = append(errors, err) } - if len(errors) > 0 { - return GetSchedulerRequestMultiError(errors) - } return nil } @@ -1304,23 +873,6 @@ func (m *GetSchedulerRequest) _validateHostname(host string) error { return nil } -// GetSchedulerRequestMultiError is an error wrapping multiple validation -// errors returned by GetSchedulerRequest.ValidateAll() if the designated -// constraints aren't met. -type GetSchedulerRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetSchedulerRequestMultiError) 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 GetSchedulerRequestMultiError) AllErrors() []error { return m } - // GetSchedulerRequestValidationError is the validation error returned by // GetSchedulerRequest.Validate if the designated constraints aren't met. type GetSchedulerRequestValidationError struct { @@ -1379,60 +931,34 @@ var _ interface { // Validate checks the field values on UpdateSchedulerRequest 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. +// violated, an error is returned. func (m *UpdateSchedulerRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateSchedulerRequest 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 -// UpdateSchedulerRequestMultiError, or nil if none found. -func (m *UpdateSchedulerRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateSchedulerRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ 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 = UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "HostName", reason: "value must be a valid hostname", cause: err, } - if !all { - return err - } - errors = append(errors, err) } if m.GetVips() != "" { if l := utf8.RuneCountInString(m.GetVips()); l < 1 || l > 1024 { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "Vips", reason: "value length must be between 1 and 1024 runes, inclusive", } - if !all { - return err - } - errors = append(errors, err) } } @@ -1440,14 +966,10 @@ func (m *UpdateSchedulerRequest) validate(all bool) error { if m.GetIdc() != "" { if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "Idc", reason: "value length must be between 1 and 1024 runes, inclusive", } - if !all { - return err - } - errors = append(errors, err) } } @@ -1455,14 +977,10 @@ func (m *UpdateSchedulerRequest) validate(all bool) error { if m.GetLocation() != "" { if utf8.RuneCountInString(m.GetLocation()) > 1024 { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "Location", reason: "value length must be at most 1024 runes", } - if !all { - return err - } - errors = append(errors, err) } } @@ -1470,43 +988,28 @@ func (m *UpdateSchedulerRequest) validate(all bool) error { if len(m.GetNetConfig()) > 0 { if len(m.GetNetConfig()) < 1 { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "NetConfig", reason: "value length must be at least 1 bytes", } - if !all { - return err - } - errors = append(errors, err) } } if ip := net.ParseIP(m.GetIp()); ip == nil { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } - if !all { - return err - } - errors = append(errors, err) } if val := m.GetPort(); val < 1024 || val >= 65535 { - err := UpdateSchedulerRequestValidationError{ + return UpdateSchedulerRequestValidationError{ field: "Port", reason: "value must be inside range [1024, 65535)", } - if !all { - return err - } - errors = append(errors, err) } - if len(errors) > 0 { - return UpdateSchedulerRequestMultiError(errors) - } return nil } @@ -1540,23 +1043,6 @@ func (m *UpdateSchedulerRequest) _validateHostname(host string) error { return nil } -// UpdateSchedulerRequestMultiError is an error wrapping multiple validation -// errors returned by UpdateSchedulerRequest.ValidateAll() if the designated -// constraints aren't met. -type UpdateSchedulerRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateSchedulerRequestMultiError) 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 UpdateSchedulerRequestMultiError) AllErrors() []error { return m } - // UpdateSchedulerRequestValidationError is the validation error returned by // UpdateSchedulerRequest.Validate if the designated constraints aren't met. type UpdateSchedulerRequestValidationError struct { @@ -1615,37 +1101,17 @@ var _ interface { // Validate checks the field values on // AddSchedulerClusterToSchedulerClusterRequest 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *AddSchedulerClusterToSchedulerClusterRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// AddSchedulerClusterToSchedulerClusterRequest 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 -// AddSchedulerClusterToSchedulerClusterRequestMultiError, or nil if none found. -func (m *AddSchedulerClusterToSchedulerClusterRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddSchedulerClusterToSchedulerClusterRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := AddSchedulerClusterToSchedulerClusterRequestValidationError{ + return AddSchedulerClusterToSchedulerClusterRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } - if !all { - return err - } - errors = append(errors, err) } if m.GetSchedulerId() != 0 { @@ -1656,30 +1122,9 @@ func (m *AddSchedulerClusterToSchedulerClusterRequest) validate(all bool) error } - if len(errors) > 0 { - return AddSchedulerClusterToSchedulerClusterRequestMultiError(errors) - } return nil } -// AddSchedulerClusterToSchedulerClusterRequestMultiError is an error wrapping -// multiple validation errors returned by -// AddSchedulerClusterToSchedulerClusterRequest.ValidateAll() if the -// designated constraints aren't met. -type AddSchedulerClusterToSchedulerClusterRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddSchedulerClusterToSchedulerClusterRequestMultiError) 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 AddSchedulerClusterToSchedulerClusterRequestMultiError) AllErrors() []error { return m } - // AddSchedulerClusterToSchedulerClusterRequestValidationError is the // validation error returned by // AddSchedulerClusterToSchedulerClusterRequest.Validate if the designated @@ -1740,67 +1185,38 @@ var _ interface { // Validate checks the field values on ListSchedulersRequest 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. +// violated, an error is returned. func (m *ListSchedulersRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListSchedulersRequest 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 -// ListSchedulersRequestMultiError, or nil if none found. -func (m *ListSchedulersRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListSchedulersRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { - err := ListSchedulersRequestValidationError{ + return ListSchedulersRequestValidationError{ 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 = ListSchedulersRequestValidationError{ + return ListSchedulersRequestValidationError{ field: "HostName", reason: "value must be a valid hostname", cause: err, } - if !all { - return err - } - errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { - err := ListSchedulersRequestValidationError{ + return ListSchedulersRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } - if !all { - return err - } - errors = append(errors, err) } if len(m.GetHostInfo()) > 0 { } - if len(errors) > 0 { - return ListSchedulersRequestMultiError(errors) - } return nil } @@ -1834,23 +1250,6 @@ func (m *ListSchedulersRequest) _validateHostname(host string) error { return nil } -// ListSchedulersRequestMultiError is an error wrapping multiple validation -// errors returned by ListSchedulersRequest.ValidateAll() if the designated -// constraints aren't met. -type ListSchedulersRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListSchedulersRequestMultiError) 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 ListSchedulersRequestMultiError) AllErrors() []error { return m } - // ListSchedulersRequestValidationError is the validation error returned by // ListSchedulersRequest.Validate if the designated constraints aren't met. type ListSchedulersRequestValidationError struct { @@ -1909,49 +1308,16 @@ var _ interface { // Validate checks the field values on ListSchedulersResponse 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. +// violated, an error is returned. func (m *ListSchedulersResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListSchedulersResponse 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 -// ListSchedulersResponseMultiError, or nil if none found. -func (m *ListSchedulersResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListSchedulersResponse) validate(all bool) error { if m == nil { return nil } - var errors []error - for idx, item := range m.GetSchedulers() { _, _ = idx, item - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListSchedulersResponseValidationError{ - field: fmt.Sprintf("Schedulers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListSchedulersResponseValidationError{ - field: fmt.Sprintf("Schedulers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListSchedulersResponseValidationError{ field: fmt.Sprintf("Schedulers[%v]", idx), @@ -1963,29 +1329,9 @@ func (m *ListSchedulersResponse) validate(all bool) error { } - if len(errors) > 0 { - return ListSchedulersResponseMultiError(errors) - } return nil } -// ListSchedulersResponseMultiError is an error wrapping multiple validation -// errors returned by ListSchedulersResponse.ValidateAll() if the designated -// constraints aren't met. -type ListSchedulersResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListSchedulersResponseMultiError) 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 ListSchedulersResponseMultiError) AllErrors() []error { return m } - // ListSchedulersResponseValidationError is the validation error returned by // ListSchedulersResponse.Validate if the designated constraints aren't met. type ListSchedulersResponseValidationError struct { @@ -2043,53 +1389,28 @@ var _ interface { } = ListSchedulersResponseValidationError{} // 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. +// in the proto definition for this message. If any rules are violated, an +// error is returned. 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{ + return 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{ + return KeepAliveRequestValidationError{ field: "HostName", reason: "value must be a valid hostname", cause: err, } - if !all { - return err - } - errors = append(errors, err) } - if len(errors) > 0 { - return KeepAliveRequestMultiError(errors) - } return nil } @@ -2123,23 +1444,6 @@ func (m *KeepAliveRequest) _validateHostname(host string) error { 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 { diff --git a/pkg/rpc/scheduler/scheduler.pb.go b/pkg/rpc/scheduler/scheduler.pb.go index 4a9768bddfc..8bb21c5f927 100644 --- a/pkg/rpc/scheduler/scheduler.pb.go +++ b/pkg/rpc/scheduler/scheduler.pb.go @@ -15,15 +15,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.17.3 +// protoc-gen-go v1.26.0 +// protoc v3.15.8 // source: pkg/rpc/scheduler/scheduler.proto package scheduler import ( base "d7y.io/dragonfly/v2/pkg/rpc/base" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -38,10 +37,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type PeerTaskRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/rpc/scheduler/scheduler.pb.validate.go b/pkg/rpc/scheduler/scheduler.pb.validate.go index 2a2483589ce..390d5b2a5e0 100644 --- a/pkg/rpc/scheduler/scheduler.pb.validate.go +++ b/pkg/rpc/scheduler/scheduler.pb.validate.go @@ -44,53 +44,20 @@ var ( ) // Validate checks the field values on PeerTaskRequest 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. +// in the proto definition for this message. If any rules are violated, an +// error is returned. func (m *PeerTaskRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PeerTaskRequest 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 -// PeerTaskRequestMultiError, or nil if none found. -func (m *PeerTaskRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *PeerTaskRequest) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Url // no validation rules for Filter // no validation rules for BizId - if all { - switch v := interface{}(m.GetUrlMeta()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PeerTaskRequestValidationError{ - field: "UrlMeta", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PeerTaskRequestValidationError{ - field: "UrlMeta", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PeerTaskRequestValidationError{ field: "UrlMeta", @@ -102,26 +69,7 @@ func (m *PeerTaskRequest) validate(all bool) error { // no validation rules for PeerId - if all { - switch v := interface{}(m.GetPeerHost()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PeerTaskRequestValidationError{ - field: "PeerHost", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PeerTaskRequestValidationError{ - field: "PeerHost", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPeerHost()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetPeerHost()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PeerTaskRequestValidationError{ field: "PeerHost", @@ -131,26 +79,7 @@ func (m *PeerTaskRequest) validate(all bool) error { } } - if all { - switch v := interface{}(m.GetHostLoad()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PeerTaskRequestValidationError{ - field: "HostLoad", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PeerTaskRequestValidationError{ - field: "HostLoad", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PeerTaskRequestValidationError{ field: "HostLoad", @@ -162,29 +91,9 @@ func (m *PeerTaskRequest) validate(all bool) error { // no validation rules for IsMigrating - if len(errors) > 0 { - return PeerTaskRequestMultiError(errors) - } return nil } -// PeerTaskRequestMultiError is an error wrapping multiple validation errors -// returned by PeerTaskRequest.ValidateAll() if the designated constraints -// aren't met. -type PeerTaskRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PeerTaskRequestMultiError) 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 PeerTaskRequestMultiError) AllErrors() []error { return m } - // PeerTaskRequestValidationError is the validation error returned by // PeerTaskRequest.Validate if the designated constraints aren't met. type PeerTaskRequestValidationError struct { @@ -240,27 +149,13 @@ var _ interface { } = PeerTaskRequestValidationError{} // Validate checks the field values on RegisterResult 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *RegisterResult) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegisterResult 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 RegisterResultMultiError, -// or nil if none found. -func (m *RegisterResult) ValidateAll() error { - return m.validate(true) -} - -func (m *RegisterResult) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for SizeScope @@ -269,26 +164,7 @@ func (m *RegisterResult) validate(all bool) error { case *RegisterResult_SinglePiece: - if all { - switch v := interface{}(m.GetSinglePiece()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegisterResultValidationError{ - field: "SinglePiece", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegisterResultValidationError{ - field: "SinglePiece", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSinglePiece()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetSinglePiece()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterResultValidationError{ field: "SinglePiece", @@ -303,29 +179,9 @@ func (m *RegisterResult) validate(all bool) error { } - if len(errors) > 0 { - return RegisterResultMultiError(errors) - } return nil } -// RegisterResultMultiError is an error wrapping multiple validation errors -// returned by RegisterResult.ValidateAll() if the designated constraints -// aren't met. -type RegisterResultMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegisterResultMultiError) 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 RegisterResultMultiError) AllErrors() []error { return m } - // RegisterResultValidationError is the validation error returned by // RegisterResult.Validate if the designated constraints aren't met. type RegisterResultValidationError struct { @@ -381,51 +237,18 @@ var _ interface { } = RegisterResultValidationError{} // Validate checks the field values on SinglePiece 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *SinglePiece) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SinglePiece 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 SinglePieceMultiError, or -// nil if none found. -func (m *SinglePiece) ValidateAll() error { - return m.validate(true) -} - -func (m *SinglePiece) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for DstPid // no validation rules for DstAddr - if all { - switch v := interface{}(m.GetPieceInfo()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SinglePieceValidationError{ - field: "PieceInfo", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SinglePieceValidationError{ - field: "PieceInfo", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SinglePieceValidationError{ field: "PieceInfo", @@ -435,28 +258,9 @@ func (m *SinglePiece) validate(all bool) error { } } - if len(errors) > 0 { - return SinglePieceMultiError(errors) - } return nil } -// SinglePieceMultiError is an error wrapping multiple validation errors -// returned by SinglePiece.ValidateAll() if the designated constraints aren't met. -type SinglePieceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SinglePieceMultiError) 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 SinglePieceMultiError) AllErrors() []error { return m } - // SinglePieceValidationError is the validation error returned by // SinglePiece.Validate if the designated constraints aren't met. type SinglePieceValidationError struct { @@ -512,27 +316,12 @@ var _ interface { } = SinglePieceValidationError{} // Validate checks the field values on PeerHost 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *PeerHost) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PeerHost 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 PeerHostMultiError, or nil -// if none found. -func (m *PeerHost) ValidateAll() error { - return m.validate(true) -} - -func (m *PeerHost) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Uuid // no validation rules for Ip @@ -551,28 +340,9 @@ func (m *PeerHost) validate(all bool) error { // no validation rules for NetTopology - if len(errors) > 0 { - return PeerHostMultiError(errors) - } return nil } -// PeerHostMultiError is an error wrapping multiple validation errors returned -// by PeerHost.ValidateAll() if the designated constraints aren't met. -type PeerHostMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PeerHostMultiError) 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 PeerHostMultiError) AllErrors() []error { return m } - // PeerHostValidationError is the validation error returned by // PeerHost.Validate if the designated constraints aren't met. type PeerHostValidationError struct { @@ -628,27 +398,13 @@ var _ interface { } = PeerHostValidationError{} // Validate checks the field values on PieceResult 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. +// the proto definition for this message. If any rules are violated, an error +// is returned. func (m *PieceResult) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PieceResult 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 PieceResultMultiError, or -// nil if none found. -func (m *PieceResult) ValidateAll() error { - return m.validate(true) -} - -func (m *PieceResult) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for SrcPid @@ -665,26 +421,7 @@ func (m *PieceResult) validate(all bool) error { // no validation rules for Code - if all { - switch v := interface{}(m.GetHostLoad()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PieceResultValidationError{ - field: "HostLoad", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PieceResultValidationError{ - field: "HostLoad", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PieceResultValidationError{ field: "HostLoad", @@ -696,28 +433,9 @@ func (m *PieceResult) validate(all bool) error { // no validation rules for FinishedCount - if len(errors) > 0 { - return PieceResultMultiError(errors) - } return nil } -// PieceResultMultiError is an error wrapping multiple validation errors -// returned by PieceResult.ValidateAll() if the designated constraints aren't met. -type PieceResultMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PieceResultMultiError) 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 PieceResultMultiError) AllErrors() []error { return m } - // PieceResultValidationError is the validation error returned by // PieceResult.Validate if the designated constraints aren't met. type PieceResultValidationError struct { @@ -773,53 +491,19 @@ var _ interface { } = PieceResultValidationError{} // Validate checks the field values on PeerPacket 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *PeerPacket) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PeerPacket 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 PeerPacketMultiError, or -// nil if none found. -func (m *PeerPacket) ValidateAll() error { - return m.validate(true) -} - -func (m *PeerPacket) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for SrcPid // no validation rules for ParallelCount - if all { - switch v := interface{}(m.GetMainPeer()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PeerPacketValidationError{ - field: "MainPeer", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PeerPacketValidationError{ - field: "MainPeer", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMainPeer()).(interface{ Validate() error }); ok { + if v, ok := interface{}(m.GetMainPeer()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PeerPacketValidationError{ field: "MainPeer", @@ -832,26 +516,7 @@ func (m *PeerPacket) validate(all bool) error { for idx, item := range m.GetStealPeers() { _, _ = idx, item - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PeerPacketValidationError{ - field: fmt.Sprintf("StealPeers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PeerPacketValidationError{ - field: fmt.Sprintf("StealPeers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PeerPacketValidationError{ field: fmt.Sprintf("StealPeers[%v]", idx), @@ -865,28 +530,9 @@ func (m *PeerPacket) validate(all bool) error { // no validation rules for Code - if len(errors) > 0 { - return PeerPacketMultiError(errors) - } return nil } -// PeerPacketMultiError is an error wrapping multiple validation errors -// returned by PeerPacket.ValidateAll() if the designated constraints aren't met. -type PeerPacketMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PeerPacketMultiError) 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 PeerPacketMultiError) AllErrors() []error { return m } - // PeerPacketValidationError is the validation error returned by // PeerPacket.Validate if the designated constraints aren't met. type PeerPacketValidationError struct { @@ -942,27 +588,12 @@ var _ interface { } = PeerPacketValidationError{} // Validate checks the field values on PeerResult 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *PeerResult) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PeerResult 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 PeerResultMultiError, or -// nil if none found. -func (m *PeerResult) ValidateAll() error { - return m.validate(true) -} - -func (m *PeerResult) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for PeerId @@ -985,28 +616,9 @@ func (m *PeerResult) validate(all bool) error { // no validation rules for Code - if len(errors) > 0 { - return PeerResultMultiError(errors) - } return nil } -// PeerResultMultiError is an error wrapping multiple validation errors -// returned by PeerResult.ValidateAll() if the designated constraints aren't met. -type PeerResultMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PeerResultMultiError) 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 PeerResultMultiError) AllErrors() []error { return m } - // PeerResultValidationError is the validation error returned by // PeerResult.Validate if the designated constraints aren't met. type PeerResultValidationError struct { @@ -1062,53 +674,19 @@ var _ interface { } = PeerResultValidationError{} // Validate checks the field values on PeerTarget 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. +// proto definition for this message. If any rules are violated, an error is returned. func (m *PeerTarget) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PeerTarget 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 PeerTargetMultiError, or -// nil if none found. -func (m *PeerTarget) ValidateAll() error { - return m.validate(true) -} - -func (m *PeerTarget) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for TaskId // no validation rules for PeerId - if len(errors) > 0 { - return PeerTargetMultiError(errors) - } return nil } -// PeerTargetMultiError is an error wrapping multiple validation errors -// returned by PeerTarget.ValidateAll() if the designated constraints aren't met. -type PeerTargetMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PeerTargetMultiError) 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 PeerTargetMultiError) AllErrors() []error { return m } - // PeerTargetValidationError is the validation error returned by // PeerTarget.Validate if the designated constraints aren't met. type PeerTargetValidationError struct { @@ -1165,55 +743,21 @@ var _ interface { // Validate checks the field values on PeerPacket_DestPeer 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. +// violated, an error is returned. func (m *PeerPacket_DestPeer) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PeerPacket_DestPeer 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 -// PeerPacket_DestPeerMultiError, or nil if none found. -func (m *PeerPacket_DestPeer) ValidateAll() error { - return m.validate(true) -} - -func (m *PeerPacket_DestPeer) validate(all bool) error { if m == nil { return nil } - var errors []error - // no validation rules for Ip // no validation rules for RpcPort // no validation rules for PeerId - if len(errors) > 0 { - return PeerPacket_DestPeerMultiError(errors) - } return nil } -// PeerPacket_DestPeerMultiError is an error wrapping multiple validation -// errors returned by PeerPacket_DestPeer.ValidateAll() if the designated -// constraints aren't met. -type PeerPacket_DestPeerMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PeerPacket_DestPeerMultiError) 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 PeerPacket_DestPeerMultiError) AllErrors() []error { return m } - // PeerPacket_DestPeerValidationError is the validation error returned by // PeerPacket_DestPeer.Validate if the designated constraints aren't met. type PeerPacket_DestPeerValidationError struct {