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

816 lines
18 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/rpc/scheduler/scheduler.proto
package scheduler
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
base "d7y.io/dragonfly/v2/pkg/rpc/base"
)
// 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{}
_ = base.SizeScope(0)
_ = base.Code(0)
_ = base.Code(0)
_ = base.Code(0)
)
// Validate checks the field values on PeerTaskRequest with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *PeerTaskRequest) Validate() error {
if m == nil {
return nil
}
// no validation rules for Url
// no validation rules for Filter
// no validation rules for BizId
if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PeerTaskRequestValidationError{
field: "UrlMeta",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for PeerId
if v, ok := interface{}(m.GetPeerHost()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PeerTaskRequestValidationError{
field: "PeerHost",
reason: "embedded message failed validation",
cause: err,
}
}
}
if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PeerTaskRequestValidationError{
field: "HostLoad",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for IsMigrating
return nil
}
// PeerTaskRequestValidationError is the validation error returned by
// PeerTaskRequest.Validate if the designated constraints aren't met.
type PeerTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PeerTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PeerTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PeerTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PeerTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PeerTaskRequestValidationError) ErrorName() string { return "PeerTaskRequestValidationError" }
// Error satisfies the builtin error interface
func (e PeerTaskRequestValidationError) 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 %sPeerTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PeerTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PeerTaskRequestValidationError{}
// Validate checks the field values on RegisterResult with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned.
func (m *RegisterResult) Validate() error {
if m == nil {
return nil
}
// no validation rules for TaskId
// no validation rules for SizeScope
switch m.DirectPiece.(type) {
case *RegisterResult_SinglePiece:
if v, ok := interface{}(m.GetSinglePiece()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RegisterResultValidationError{
field: "SinglePiece",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *RegisterResult_PieceContent:
// no validation rules for PieceContent
}
return nil
}
// RegisterResultValidationError is the validation error returned by
// RegisterResult.Validate if the designated constraints aren't met.
type RegisterResultValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e RegisterResultValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e RegisterResultValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e RegisterResultValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e RegisterResultValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e RegisterResultValidationError) ErrorName() string { return "RegisterResultValidationError" }
// Error satisfies the builtin error interface
func (e RegisterResultValidationError) 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 %sRegisterResult.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = RegisterResultValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = RegisterResultValidationError{}
// Validate checks the field values on SinglePiece with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned.
func (m *SinglePiece) Validate() error {
if m == nil {
return nil
}
// no validation rules for DstPid
// no validation rules for DstAddr
if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SinglePieceValidationError{
field: "PieceInfo",
reason: "embedded message failed validation",
cause: err,
}
}
}
return nil
}
// SinglePieceValidationError is the validation error returned by
// SinglePiece.Validate if the designated constraints aren't met.
type SinglePieceValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SinglePieceValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SinglePieceValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SinglePieceValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SinglePieceValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SinglePieceValidationError) ErrorName() string { return "SinglePieceValidationError" }
// Error satisfies the builtin error interface
func (e SinglePieceValidationError) 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 %sSinglePiece.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SinglePieceValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SinglePieceValidationError{}
// Validate checks the field values on PeerHost with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *PeerHost) Validate() error {
if m == nil {
return nil
}
// no validation rules for Uuid
// no validation rules for Ip
// no validation rules for RpcPort
// no validation rules for DownPort
// no validation rules for HostName
// no validation rules for SecurityDomain
// no validation rules for Location
// no validation rules for Idc
// no validation rules for NetTopology
return nil
}
// PeerHostValidationError is the validation error returned by
// PeerHost.Validate if the designated constraints aren't met.
type PeerHostValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PeerHostValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PeerHostValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PeerHostValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PeerHostValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PeerHostValidationError) ErrorName() string { return "PeerHostValidationError" }
// Error satisfies the builtin error interface
func (e PeerHostValidationError) 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 %sPeerHost.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PeerHostValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PeerHostValidationError{}
// Validate checks the field values on PieceResult with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned.
func (m *PieceResult) Validate() error {
if m == nil {
return nil
}
// no validation rules for TaskId
// no validation rules for SrcPid
// no validation rules for DstPid
// no validation rules for PieceNum
// no validation rules for BeginTime
// no validation rules for EndTime
// no validation rules for Success
// no validation rules for Code
if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PieceResultValidationError{
field: "HostLoad",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for FinishedCount
return nil
}
// PieceResultValidationError is the validation error returned by
// PieceResult.Validate if the designated constraints aren't met.
type PieceResultValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PieceResultValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PieceResultValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PieceResultValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PieceResultValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PieceResultValidationError) ErrorName() string { return "PieceResultValidationError" }
// Error satisfies the builtin error interface
func (e PieceResultValidationError) 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 %sPieceResult.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PieceResultValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PieceResultValidationError{}
// Validate checks the field values on PeerPacket with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *PeerPacket) Validate() error {
if m == nil {
return nil
}
// no validation rules for TaskId
// no validation rules for SrcPid
// no validation rules for ParallelCount
if v, ok := interface{}(m.GetMainPeer()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PeerPacketValidationError{
field: "MainPeer",
reason: "embedded message failed validation",
cause: err,
}
}
}
for idx, item := range m.GetStealPeers() {
_, _ = idx, item
if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PeerPacketValidationError{
field: fmt.Sprintf("StealPeers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Code
return nil
}
// PeerPacketValidationError is the validation error returned by
// PeerPacket.Validate if the designated constraints aren't met.
type PeerPacketValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PeerPacketValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PeerPacketValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PeerPacketValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PeerPacketValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PeerPacketValidationError) ErrorName() string { return "PeerPacketValidationError" }
// Error satisfies the builtin error interface
func (e PeerPacketValidationError) 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 %sPeerPacket.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PeerPacketValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PeerPacketValidationError{}
// Validate checks the field values on PeerResult with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *PeerResult) Validate() error {
if m == nil {
return nil
}
// no validation rules for TaskId
// no validation rules for PeerId
// no validation rules for SrcIp
// no validation rules for SecurityDomain
// no validation rules for Idc
// no validation rules for Url
// no validation rules for ContentLength
// no validation rules for Traffic
// no validation rules for Cost
// no validation rules for Success
// no validation rules for Code
return nil
}
// PeerResultValidationError is the validation error returned by
// PeerResult.Validate if the designated constraints aren't met.
type PeerResultValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PeerResultValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PeerResultValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PeerResultValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PeerResultValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PeerResultValidationError) ErrorName() string { return "PeerResultValidationError" }
// Error satisfies the builtin error interface
func (e PeerResultValidationError) 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 %sPeerResult.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PeerResultValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PeerResultValidationError{}
// Validate checks the field values on PeerTarget with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *PeerTarget) Validate() error {
if m == nil {
return nil
}
// no validation rules for TaskId
// no validation rules for PeerId
return nil
}
// PeerTargetValidationError is the validation error returned by
// PeerTarget.Validate if the designated constraints aren't met.
type PeerTargetValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PeerTargetValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PeerTargetValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PeerTargetValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PeerTargetValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PeerTargetValidationError) ErrorName() string { return "PeerTargetValidationError" }
// Error satisfies the builtin error interface
func (e PeerTargetValidationError) 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 %sPeerTarget.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PeerTargetValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PeerTargetValidationError{}
// Validate checks the field values on PeerPacket_DestPeer with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *PeerPacket_DestPeer) Validate() error {
if m == nil {
return nil
}
// no validation rules for Ip
// no validation rules for RpcPort
// no validation rules for PeerId
return nil
}
// PeerPacket_DestPeerValidationError is the validation error returned by
// PeerPacket_DestPeer.Validate if the designated constraints aren't met.
type PeerPacket_DestPeerValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PeerPacket_DestPeerValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PeerPacket_DestPeerValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PeerPacket_DestPeerValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PeerPacket_DestPeerValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PeerPacket_DestPeerValidationError) ErrorName() string {
return "PeerPacket_DestPeerValidationError"
}
// Error satisfies the builtin error interface
func (e PeerPacket_DestPeerValidationError) 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 %sPeerPacket_DestPeer.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PeerPacket_DestPeerValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PeerPacket_DestPeerValidationError{}