fix: generate proto file (#483)
This commit is contained in:
parent
7b8aaf6b31
commit
ae777b59eb
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue