fix: generate proto file (#483)

This commit is contained in:
加菲 2021-07-22 13:26:19 +08:00 committed by Gaius
parent 7b8aaf6b31
commit ae777b59eb
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
10 changed files with 101 additions and 1689 deletions

View File

@ -15,14 +15,13 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.26.0
// protoc v3.17.3 // protoc v3.15.8
// source: pkg/rpc/base/base.proto // source: pkg/rpc/base/base.proto
package base package base
import ( import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -36,10 +35,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = 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 type Code int32
const ( const (

View File

@ -34,53 +34,20 @@ var (
) )
// Validate checks the field values on GrpcDfError with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *GrpcDfError) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for Code // no validation rules for Code
// no validation rules for Message // no validation rules for Message
if len(errors) > 0 {
return GrpcDfErrorMultiError(errors)
}
return nil 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 // GrpcDfErrorValidationError is the validation error returned by
// GrpcDfError.Validate if the designated constraints aren't met. // GrpcDfError.Validate if the designated constraints aren't met.
type GrpcDfErrorValidationError struct { type GrpcDfErrorValidationError struct {
@ -136,26 +103,12 @@ var _ interface {
} = GrpcDfErrorValidationError{} } = GrpcDfErrorValidationError{}
// Validate checks the field values on UrlMeta with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *UrlMeta) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for Digest // no validation rules for Digest
// no validation rules for Tag // no validation rules for Tag
@ -166,28 +119,9 @@ func (m *UrlMeta) validate(all bool) error {
// no validation rules for Header // no validation rules for Header
if len(errors) > 0 {
return UrlMetaMultiError(errors)
}
return nil 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 // UrlMetaValidationError is the validation error returned by UrlMeta.Validate
// if the designated constraints aren't met. // if the designated constraints aren't met.
type UrlMetaValidationError struct { type UrlMetaValidationError struct {
@ -243,55 +177,21 @@ var _ interface {
} = UrlMetaValidationError{} } = UrlMetaValidationError{}
// Validate checks the field values on HostLoad with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *HostLoad) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for CpuRatio // no validation rules for CpuRatio
// no validation rules for MemRatio // no validation rules for MemRatio
// no validation rules for DiskRatio // no validation rules for DiskRatio
if len(errors) > 0 {
return HostLoadMultiError(errors)
}
return nil 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 // HostLoadValidationError is the validation error returned by
// HostLoad.Validate if the designated constraints aren't met. // HostLoad.Validate if the designated constraints aren't met.
type HostLoadValidationError struct { type HostLoadValidationError struct {
@ -347,27 +247,13 @@ var _ interface {
} = HostLoadValidationError{} } = HostLoadValidationError{}
// Validate checks the field values on PieceTaskRequest with the rules defined // Validate checks the field values on PieceTaskRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the // in the proto definition for this message. If any rules are violated, an
// first error encountered is returned, or nil if there are no violations. // error is returned.
func (m *PieceTaskRequest) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for SrcPid // no validation rules for SrcPid
@ -378,29 +264,9 @@ func (m *PieceTaskRequest) validate(all bool) error {
// no validation rules for Limit // no validation rules for Limit
if len(errors) > 0 {
return PieceTaskRequestMultiError(errors)
}
return nil 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 // PieceTaskRequestValidationError is the validation error returned by
// PieceTaskRequest.Validate if the designated constraints aren't met. // PieceTaskRequest.Validate if the designated constraints aren't met.
type PieceTaskRequestValidationError struct { type PieceTaskRequestValidationError struct {
@ -456,27 +322,12 @@ var _ interface {
} = PieceTaskRequestValidationError{} } = PieceTaskRequestValidationError{}
// Validate checks the field values on PieceInfo with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *PieceInfo) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for PieceNum // no validation rules for PieceNum
// no validation rules for RangeStart // no validation rules for RangeStart
@ -489,28 +340,9 @@ func (m *PieceInfo) validate(all bool) error {
// no validation rules for PieceStyle // no validation rules for PieceStyle
if len(errors) > 0 {
return PieceInfoMultiError(errors)
}
return nil 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 // PieceInfoValidationError is the validation error returned by
// PieceInfo.Validate if the designated constraints aren't met. // PieceInfo.Validate if the designated constraints aren't met.
type PieceInfoValidationError struct { type PieceInfoValidationError struct {
@ -566,27 +398,13 @@ var _ interface {
} = PieceInfoValidationError{} } = PieceInfoValidationError{}
// Validate checks the field values on PiecePacket with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *PiecePacket) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for DstPid // no validation rules for DstPid
@ -596,26 +414,7 @@ func (m *PiecePacket) validate(all bool) error {
for idx, item := range m.GetPieceInfos() { for idx, item := range m.GetPieceInfos() {
_, _ = idx, item _, _ = idx, item
if all { if v, ok := interface{}(item).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PiecePacketValidationError{ return PiecePacketValidationError{
field: fmt.Sprintf("PieceInfos[%v]", idx), field: fmt.Sprintf("PieceInfos[%v]", idx),
@ -633,28 +432,9 @@ func (m *PiecePacket) validate(all bool) error {
// no validation rules for PieceMd5Sign // no validation rules for PieceMd5Sign
if len(errors) > 0 {
return PiecePacketMultiError(errors)
}
return nil 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 // PiecePacketValidationError is the validation error returned by
// PiecePacket.Validate if the designated constraints aren't met. // PiecePacket.Validate if the designated constraints aren't met.
type PiecePacketValidationError struct { type PiecePacketValidationError struct {

View File

@ -15,15 +15,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.26.0
// protoc v3.17.3 // protoc v3.15.8
// source: pkg/rpc/cdnsystem/cdnsystem.proto // source: pkg/rpc/cdnsystem/cdnsystem.proto
package cdnsystem package cdnsystem
import ( import (
base "d7y.io/dragonfly/v2/pkg/rpc/base" base "d7y.io/dragonfly/v2/pkg/rpc/base"
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -37,10 +36,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = 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 { type SeedRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache

View File

@ -34,53 +34,20 @@ var (
) )
// Validate checks the field values on SeedRequest with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *SeedRequest) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for Url // no validation rules for Url
// no validation rules for Filter // no validation rules for Filter
if all { if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return SeedRequestValidationError{ return SeedRequestValidationError{
field: "UrlMeta", field: "UrlMeta",
@ -90,28 +57,9 @@ func (m *SeedRequest) validate(all bool) error {
} }
} }
if len(errors) > 0 {
return SeedRequestMultiError(errors)
}
return nil 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 // SeedRequestValidationError is the validation error returned by
// SeedRequest.Validate if the designated constraints aren't met. // SeedRequest.Validate if the designated constraints aren't met.
type SeedRequestValidationError struct { type SeedRequestValidationError struct {
@ -167,51 +115,17 @@ var _ interface {
} = SeedRequestValidationError{} } = SeedRequestValidationError{}
// Validate checks the field values on PieceSeed with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *PieceSeed) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for PeerId // no validation rules for PeerId
// no validation rules for HostUuid // no validation rules for HostUuid
if all { if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PieceSeedValidationError{ return PieceSeedValidationError{
field: "PieceInfo", field: "PieceInfo",
@ -227,28 +141,9 @@ func (m *PieceSeed) validate(all bool) error {
// no validation rules for TotalPieceCount // no validation rules for TotalPieceCount
if len(errors) > 0 {
return PieceSeedMultiError(errors)
}
return nil 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 // PieceSeedValidationError is the validation error returned by
// PieceSeed.Validate if the designated constraints aren't met. // PieceSeed.Validate if the designated constraints aren't met.
type PieceSeedValidationError struct { type PieceSeedValidationError struct {

View File

@ -15,15 +15,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.26.0
// protoc v3.17.3 // protoc v3.15.8
// source: pkg/rpc/dfdaemon/dfdaemon.proto // source: pkg/rpc/dfdaemon/dfdaemon.proto
package dfdaemon package dfdaemon
import ( import (
base "d7y.io/dragonfly/v2/pkg/rpc/base" base "d7y.io/dragonfly/v2/pkg/rpc/base"
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb" emptypb "google.golang.org/protobuf/types/known/emptypb"
@ -38,10 +37,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = 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 { type DownRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache

View File

@ -34,27 +34,13 @@ var (
) )
// Validate checks the field values on DownRequest with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *DownRequest) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for Uuid // no validation rules for Uuid
// no validation rules for Url // no validation rules for Url
@ -67,26 +53,7 @@ func (m *DownRequest) validate(all bool) error {
// no validation rules for DisableBackSource // no validation rules for DisableBackSource
if all { if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return DownRequestValidationError{ return DownRequestValidationError{
field: "UrlMeta", field: "UrlMeta",
@ -104,28 +71,9 @@ func (m *DownRequest) validate(all bool) error {
// no validation rules for Gid // no validation rules for Gid
if len(errors) > 0 {
return DownRequestMultiError(errors)
}
return nil 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 // DownRequestValidationError is the validation error returned by
// DownRequest.Validate if the designated constraints aren't met. // DownRequest.Validate if the designated constraints aren't met.
type DownRequestValidationError struct { type DownRequestValidationError struct {
@ -181,27 +129,12 @@ var _ interface {
} = DownRequestValidationError{} } = DownRequestValidationError{}
// Validate checks the field values on DownResult with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *DownResult) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for PeerId // no validation rules for PeerId
@ -210,28 +143,9 @@ func (m *DownResult) validate(all bool) error {
// no validation rules for Done // no validation rules for Done
if len(errors) > 0 {
return DownResultMultiError(errors)
}
return nil 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 // DownResultValidationError is the validation error returned by
// DownResult.Validate if the designated constraints aren't met. // DownResult.Validate if the designated constraints aren't met.
type DownResultValidationError struct { type DownResultValidationError struct {

View File

@ -15,15 +15,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.26.0
// protoc v3.17.3 // protoc v3.15.8
// source: pkg/rpc/manager/manager.proto // source: pkg/rpc/manager/manager.proto
package manager package manager
import ( import (
_ "github.com/envoyproxy/protoc-gen-validate/validate" _ "github.com/envoyproxy/protoc-gen-validate/validate"
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb" emptypb "google.golang.org/protobuf/types/known/emptypb"
@ -38,10 +37,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = 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 type SourceType int32
const ( const (

File diff suppressed because it is too large Load Diff

View File

@ -15,15 +15,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.26.0
// protoc v3.17.3 // protoc v3.15.8
// source: pkg/rpc/scheduler/scheduler.proto // source: pkg/rpc/scheduler/scheduler.proto
package scheduler package scheduler
import ( import (
base "d7y.io/dragonfly/v2/pkg/rpc/base" base "d7y.io/dragonfly/v2/pkg/rpc/base"
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb" emptypb "google.golang.org/protobuf/types/known/emptypb"
@ -38,10 +37,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = 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 { type PeerTaskRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache

View File

@ -44,53 +44,20 @@ var (
) )
// Validate checks the field values on PeerTaskRequest with the rules defined // Validate checks the field values on PeerTaskRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the // in the proto definition for this message. If any rules are violated, an
// first error encountered is returned, or nil if there are no violations. // error is returned.
func (m *PeerTaskRequest) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for Url // no validation rules for Url
// no validation rules for Filter // no validation rules for Filter
// no validation rules for BizId // no validation rules for BizId
if all { if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PeerTaskRequestValidationError{ return PeerTaskRequestValidationError{
field: "UrlMeta", field: "UrlMeta",
@ -102,26 +69,7 @@ func (m *PeerTaskRequest) validate(all bool) error {
// no validation rules for PeerId // no validation rules for PeerId
if all { if v, ok := interface{}(m.GetPeerHost()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PeerTaskRequestValidationError{ return PeerTaskRequestValidationError{
field: "PeerHost", field: "PeerHost",
@ -131,26 +79,7 @@ func (m *PeerTaskRequest) validate(all bool) error {
} }
} }
if all { if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PeerTaskRequestValidationError{ return PeerTaskRequestValidationError{
field: "HostLoad", field: "HostLoad",
@ -162,29 +91,9 @@ func (m *PeerTaskRequest) validate(all bool) error {
// no validation rules for IsMigrating // no validation rules for IsMigrating
if len(errors) > 0 {
return PeerTaskRequestMultiError(errors)
}
return nil 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 // PeerTaskRequestValidationError is the validation error returned by
// PeerTaskRequest.Validate if the designated constraints aren't met. // PeerTaskRequest.Validate if the designated constraints aren't met.
type PeerTaskRequestValidationError struct { type PeerTaskRequestValidationError struct {
@ -240,27 +149,13 @@ var _ interface {
} = PeerTaskRequestValidationError{} } = PeerTaskRequestValidationError{}
// Validate checks the field values on RegisterResult with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *RegisterResult) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for SizeScope // no validation rules for SizeScope
@ -269,26 +164,7 @@ func (m *RegisterResult) validate(all bool) error {
case *RegisterResult_SinglePiece: case *RegisterResult_SinglePiece:
if all { if v, ok := interface{}(m.GetSinglePiece()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return RegisterResultValidationError{ return RegisterResultValidationError{
field: "SinglePiece", field: "SinglePiece",
@ -303,29 +179,9 @@ func (m *RegisterResult) validate(all bool) error {
} }
if len(errors) > 0 {
return RegisterResultMultiError(errors)
}
return nil 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 // RegisterResultValidationError is the validation error returned by
// RegisterResult.Validate if the designated constraints aren't met. // RegisterResult.Validate if the designated constraints aren't met.
type RegisterResultValidationError struct { type RegisterResultValidationError struct {
@ -381,51 +237,18 @@ var _ interface {
} = RegisterResultValidationError{} } = RegisterResultValidationError{}
// Validate checks the field values on SinglePiece with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *SinglePiece) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for DstPid // no validation rules for DstPid
// no validation rules for DstAddr // no validation rules for DstAddr
if all { if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return SinglePieceValidationError{ return SinglePieceValidationError{
field: "PieceInfo", field: "PieceInfo",
@ -435,28 +258,9 @@ func (m *SinglePiece) validate(all bool) error {
} }
} }
if len(errors) > 0 {
return SinglePieceMultiError(errors)
}
return nil 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 // SinglePieceValidationError is the validation error returned by
// SinglePiece.Validate if the designated constraints aren't met. // SinglePiece.Validate if the designated constraints aren't met.
type SinglePieceValidationError struct { type SinglePieceValidationError struct {
@ -512,27 +316,12 @@ var _ interface {
} = SinglePieceValidationError{} } = SinglePieceValidationError{}
// Validate checks the field values on PeerHost with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *PeerHost) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for Uuid // no validation rules for Uuid
// no validation rules for Ip // no validation rules for Ip
@ -551,28 +340,9 @@ func (m *PeerHost) validate(all bool) error {
// no validation rules for NetTopology // no validation rules for NetTopology
if len(errors) > 0 {
return PeerHostMultiError(errors)
}
return nil 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 // PeerHostValidationError is the validation error returned by
// PeerHost.Validate if the designated constraints aren't met. // PeerHost.Validate if the designated constraints aren't met.
type PeerHostValidationError struct { type PeerHostValidationError struct {
@ -628,27 +398,13 @@ var _ interface {
} = PeerHostValidationError{} } = PeerHostValidationError{}
// Validate checks the field values on PieceResult with the rules defined in // 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 // the proto definition for this message. If any rules are violated, an error
// error encountered is returned, or nil if there are no violations. // is returned.
func (m *PieceResult) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for SrcPid // no validation rules for SrcPid
@ -665,26 +421,7 @@ func (m *PieceResult) validate(all bool) error {
// no validation rules for Code // no validation rules for Code
if all { if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PieceResultValidationError{ return PieceResultValidationError{
field: "HostLoad", field: "HostLoad",
@ -696,28 +433,9 @@ func (m *PieceResult) validate(all bool) error {
// no validation rules for FinishedCount // no validation rules for FinishedCount
if len(errors) > 0 {
return PieceResultMultiError(errors)
}
return nil 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 // PieceResultValidationError is the validation error returned by
// PieceResult.Validate if the designated constraints aren't met. // PieceResult.Validate if the designated constraints aren't met.
type PieceResultValidationError struct { type PieceResultValidationError struct {
@ -773,53 +491,19 @@ var _ interface {
} = PieceResultValidationError{} } = PieceResultValidationError{}
// Validate checks the field values on PeerPacket with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *PeerPacket) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for SrcPid // no validation rules for SrcPid
// no validation rules for ParallelCount // no validation rules for ParallelCount
if all { if v, ok := interface{}(m.GetMainPeer()).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PeerPacketValidationError{ return PeerPacketValidationError{
field: "MainPeer", field: "MainPeer",
@ -832,26 +516,7 @@ func (m *PeerPacket) validate(all bool) error {
for idx, item := range m.GetStealPeers() { for idx, item := range m.GetStealPeers() {
_, _ = idx, item _, _ = idx, item
if all { if v, ok := interface{}(item).(interface{ Validate() error }); ok {
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 err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return PeerPacketValidationError{ return PeerPacketValidationError{
field: fmt.Sprintf("StealPeers[%v]", idx), field: fmt.Sprintf("StealPeers[%v]", idx),
@ -865,28 +530,9 @@ func (m *PeerPacket) validate(all bool) error {
// no validation rules for Code // no validation rules for Code
if len(errors) > 0 {
return PeerPacketMultiError(errors)
}
return nil 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 // PeerPacketValidationError is the validation error returned by
// PeerPacket.Validate if the designated constraints aren't met. // PeerPacket.Validate if the designated constraints aren't met.
type PeerPacketValidationError struct { type PeerPacketValidationError struct {
@ -942,27 +588,12 @@ var _ interface {
} = PeerPacketValidationError{} } = PeerPacketValidationError{}
// Validate checks the field values on PeerResult with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *PeerResult) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for PeerId // no validation rules for PeerId
@ -985,28 +616,9 @@ func (m *PeerResult) validate(all bool) error {
// no validation rules for Code // no validation rules for Code
if len(errors) > 0 {
return PeerResultMultiError(errors)
}
return nil 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 // PeerResultValidationError is the validation error returned by
// PeerResult.Validate if the designated constraints aren't met. // PeerResult.Validate if the designated constraints aren't met.
type PeerResultValidationError struct { type PeerResultValidationError struct {
@ -1062,53 +674,19 @@ var _ interface {
} = PeerResultValidationError{} } = PeerResultValidationError{}
// Validate checks the field values on PeerTarget with the rules defined in the // 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 // proto definition for this message. If any rules are violated, an error is returned.
// error encountered is returned, or nil if there are no violations.
func (m *PeerTarget) Validate() error { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for TaskId // no validation rules for TaskId
// no validation rules for PeerId // no validation rules for PeerId
if len(errors) > 0 {
return PeerTargetMultiError(errors)
}
return nil 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 // PeerTargetValidationError is the validation error returned by
// PeerTarget.Validate if the designated constraints aren't met. // PeerTarget.Validate if the designated constraints aren't met.
type PeerTargetValidationError struct { type PeerTargetValidationError struct {
@ -1165,55 +743,21 @@ var _ interface {
// Validate checks the field values on PeerPacket_DestPeer with the rules // Validate checks the field values on PeerPacket_DestPeer with the rules
// defined in the proto definition for this message. If any rules are // 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 { 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 { if m == nil {
return nil return nil
} }
var errors []error
// no validation rules for Ip // no validation rules for Ip
// no validation rules for RpcPort // no validation rules for RpcPort
// no validation rules for PeerId // no validation rules for PeerId
if len(errors) > 0 {
return PeerPacket_DestPeerMultiError(errors)
}
return nil 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_DestPeerValidationError is the validation error returned by
// PeerPacket_DestPeer.Validate if the designated constraints aren't met. // PeerPacket_DestPeer.Validate if the designated constraints aren't met.
type PeerPacket_DestPeerValidationError struct { type PeerPacket_DestPeerValidationError struct {