dragonfly/pkg/rpc/base/base.pb.validate.go

711 lines
18 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/rpc/base/base.proto
package base
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
)
// 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.
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 {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GrpcDfErrorValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GrpcDfErrorValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GrpcDfErrorValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GrpcDfErrorValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GrpcDfErrorValidationError) ErrorName() string { return "GrpcDfErrorValidationError" }
// Error satisfies the builtin error interface
func (e GrpcDfErrorValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGrpcDfError.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GrpcDfErrorValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = 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.
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
// no validation rules for Range
// no validation rules for Filter
// 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 {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UrlMetaValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UrlMetaValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UrlMetaValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UrlMetaValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UrlMetaValidationError) ErrorName() string { return "UrlMetaValidationError" }
// Error satisfies the builtin error interface
func (e UrlMetaValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUrlMeta.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UrlMetaValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = 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.
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 {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e HostLoadValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e HostLoadValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e HostLoadValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e HostLoadValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e HostLoadValidationError) ErrorName() string { return "HostLoadValidationError" }
// Error satisfies the builtin error interface
func (e HostLoadValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sHostLoad.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = HostLoadValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = 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.
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
// no validation rules for DstPid
// no validation rules for StartNum
// 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 {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PieceTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PieceTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PieceTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PieceTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PieceTaskRequestValidationError) ErrorName() string { return "PieceTaskRequestValidationError" }
// Error satisfies the builtin error interface
func (e PieceTaskRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPieceTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PieceTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = 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.
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
// no validation rules for RangeSize
// no validation rules for PieceMd5
// no validation rules for PieceOffset
// 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 {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PieceInfoValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PieceInfoValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PieceInfoValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PieceInfoValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PieceInfoValidationError) ErrorName() string { return "PieceInfoValidationError" }
// Error satisfies the builtin error interface
func (e PieceInfoValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPieceInfo.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PieceInfoValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = 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.
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
// no validation rules for DstAddr
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 err := v.Validate(); err != nil {
return PiecePacketValidationError{
field: fmt.Sprintf("PieceInfos[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for TotalPiece
// no validation rules for ContentLength
// 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 {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PiecePacketValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PiecePacketValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PiecePacketValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PiecePacketValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PiecePacketValidationError) ErrorName() string { return "PiecePacketValidationError" }
// Error satisfies the builtin error interface
func (e PiecePacketValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPiecePacket.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PiecePacketValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PiecePacketValidationError{}