mirror of https://github.com/dragonflyoss/api.git
feat: update DownloadPieceFailedRequest and DownloadPieceBackToSourceFailedRequest (#95)
Add piece information to DownloadPeerFailedRequest and DownloadPieceBackToSourceFailedRequest. Add responses of different protocols to DownloadPieceBackToSourceFailedRequest. Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
212b3aba4b
commit
65661525ff
File diff suppressed because it is too large
Load Diff
|
|
@ -1331,30 +1331,48 @@ func (m *DownloadPieceFailedRequest) validate(all bool) error {
|
|||
|
||||
var errors []error
|
||||
|
||||
if m.GetPiece() == nil {
|
||||
err := DownloadPieceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "value is required",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetPiece()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadPieceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadPieceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadPieceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no validation rules for Temporary
|
||||
|
||||
if m.GetPieceNumber() < 0 {
|
||||
err := DownloadPieceFailedRequestValidationError{
|
||||
field: "PieceNumber",
|
||||
reason: "value must be greater than or equal to 0",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(m.GetParentId()) < 1 {
|
||||
err := DownloadPieceFailedRequestValidationError{
|
||||
field: "ParentId",
|
||||
reason: "value length must be at least 1 runes",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return DownloadPieceFailedRequestMultiError(errors)
|
||||
}
|
||||
|
|
@ -1435,6 +1453,426 @@ var _ interface {
|
|||
ErrorName() string
|
||||
} = DownloadPieceFailedRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on HTTPResponse 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 *HTTPResponse) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on HTTPResponse 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 HTTPResponseMultiError, or
|
||||
// nil if none found.
|
||||
func (m *HTTPResponse) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *HTTPResponse) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Header
|
||||
|
||||
if val := m.GetStatusCode(); val < 100 || val >= 599 {
|
||||
err := HTTPResponseValidationError{
|
||||
field: "StatusCode",
|
||||
reason: "value must be inside range [100, 599)",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(m.GetStatus()) < 1 {
|
||||
err := HTTPResponseValidationError{
|
||||
field: "Status",
|
||||
reason: "value length must be at least 1 runes",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return HTTPResponseMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// HTTPResponseMultiError is an error wrapping multiple validation errors
|
||||
// returned by HTTPResponse.ValidateAll() if the designated constraints aren't met.
|
||||
type HTTPResponseMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m HTTPResponseMultiError) 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 HTTPResponseMultiError) AllErrors() []error { return m }
|
||||
|
||||
// HTTPResponseValidationError is the validation error returned by
|
||||
// HTTPResponse.Validate if the designated constraints aren't met.
|
||||
type HTTPResponseValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e HTTPResponseValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e HTTPResponseValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e HTTPResponseValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e HTTPResponseValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e HTTPResponseValidationError) ErrorName() string { return "HTTPResponseValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e HTTPResponseValidationError) 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 %sHTTPResponse.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = HTTPResponseValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = HTTPResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on HDFSResponse 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 *HDFSResponse) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on HDFSResponse 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 HDFSResponseMultiError, or
|
||||
// nil if none found.
|
||||
func (m *HDFSResponse) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *HDFSResponse) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if len(errors) > 0 {
|
||||
return HDFSResponseMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// HDFSResponseMultiError is an error wrapping multiple validation errors
|
||||
// returned by HDFSResponse.ValidateAll() if the designated constraints aren't met.
|
||||
type HDFSResponseMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m HDFSResponseMultiError) 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 HDFSResponseMultiError) AllErrors() []error { return m }
|
||||
|
||||
// HDFSResponseValidationError is the validation error returned by
|
||||
// HDFSResponse.Validate if the designated constraints aren't met.
|
||||
type HDFSResponseValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e HDFSResponseValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e HDFSResponseValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e HDFSResponseValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e HDFSResponseValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e HDFSResponseValidationError) ErrorName() string { return "HDFSResponseValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e HDFSResponseValidationError) 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 %sHDFSResponse.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = HDFSResponseValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = HDFSResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on S3Response 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 *S3Response) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on S3Response 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 S3ResponseMultiError, or
|
||||
// nil if none found.
|
||||
func (m *S3Response) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *S3Response) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if len(errors) > 0 {
|
||||
return S3ResponseMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// S3ResponseMultiError is an error wrapping multiple validation errors
|
||||
// returned by S3Response.ValidateAll() if the designated constraints aren't met.
|
||||
type S3ResponseMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m S3ResponseMultiError) 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 S3ResponseMultiError) AllErrors() []error { return m }
|
||||
|
||||
// S3ResponseValidationError is the validation error returned by
|
||||
// S3Response.Validate if the designated constraints aren't met.
|
||||
type S3ResponseValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e S3ResponseValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e S3ResponseValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e S3ResponseValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e S3ResponseValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e S3ResponseValidationError) ErrorName() string { return "S3ResponseValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e S3ResponseValidationError) 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 %sS3Response.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = S3ResponseValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = S3ResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on OSSResponse 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 *OSSResponse) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on OSSResponse 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 OSSResponseMultiError, or
|
||||
// nil if none found.
|
||||
func (m *OSSResponse) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *OSSResponse) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if len(errors) > 0 {
|
||||
return OSSResponseMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// OSSResponseMultiError is an error wrapping multiple validation errors
|
||||
// returned by OSSResponse.ValidateAll() if the designated constraints aren't met.
|
||||
type OSSResponseMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m OSSResponseMultiError) 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 OSSResponseMultiError) AllErrors() []error { return m }
|
||||
|
||||
// OSSResponseValidationError is the validation error returned by
|
||||
// OSSResponse.Validate if the designated constraints aren't met.
|
||||
type OSSResponseValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e OSSResponseValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e OSSResponseValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e OSSResponseValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e OSSResponseValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e OSSResponseValidationError) ErrorName() string { return "OSSResponseValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e OSSResponseValidationError) 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 %sOSSResponse.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = OSSResponseValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = OSSResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on DownloadPieceBackToSourceFailedRequest
|
||||
// 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
|
||||
|
|
@ -1459,10 +1897,10 @@ func (m *DownloadPieceBackToSourceFailedRequest) validate(all bool) error {
|
|||
|
||||
var errors []error
|
||||
|
||||
if m.GetPieceNumber() < 0 {
|
||||
if m.GetPiece() == nil {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "PieceNumber",
|
||||
reason: "value must be greater than or equal to 0",
|
||||
field: "Piece",
|
||||
reason: "value is required",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
|
|
@ -1470,23 +1908,212 @@ func (m *DownloadPieceBackToSourceFailedRequest) validate(all bool) error {
|
|||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Header
|
||||
|
||||
if val := m.GetStatusCode(); val < 100 || val >= 599 {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "StatusCode",
|
||||
reason: "value must be inside range [100, 599)",
|
||||
if all {
|
||||
switch v := interface{}(m.GetPiece()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
} else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(m.GetStatus()) < 1 {
|
||||
oneofResponsePresent := false
|
||||
switch v := m.Response.(type) {
|
||||
case *DownloadPieceBackToSourceFailedRequest_HttpResponse:
|
||||
if v == nil {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Response",
|
||||
reason: "oneof value cannot be a typed-nil",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
oneofResponsePresent = true
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetHttpResponse()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "HttpResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "HttpResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetHttpResponse()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "HttpResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case *DownloadPieceBackToSourceFailedRequest_HdfsResponse:
|
||||
if v == nil {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Response",
|
||||
reason: "oneof value cannot be a typed-nil",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
oneofResponsePresent = true
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetHdfsResponse()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "HdfsResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "HdfsResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetHdfsResponse()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "HdfsResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case *DownloadPieceBackToSourceFailedRequest_S3Response:
|
||||
if v == nil {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Response",
|
||||
reason: "oneof value cannot be a typed-nil",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
oneofResponsePresent = true
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetS3Response()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "S3Response",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "S3Response",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetS3Response()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "S3Response",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case *DownloadPieceBackToSourceFailedRequest_OssResponse:
|
||||
if v == nil {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Response",
|
||||
reason: "oneof value cannot be a typed-nil",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
oneofResponsePresent = true
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetOssResponse()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "OssResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "OssResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetOssResponse()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "OssResponse",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
_ = v // ensures v is used
|
||||
}
|
||||
if !oneofResponsePresent {
|
||||
err := DownloadPieceBackToSourceFailedRequestValidationError{
|
||||
field: "Status",
|
||||
reason: "value length must be at least 1 runes",
|
||||
field: "Response",
|
||||
reason: "value is required",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -90,24 +90,47 @@ message DownloadPieceBackToSourceFinishedRequest {
|
|||
|
||||
// DownloadPieceFailedRequest downloads piece failed request of AnnouncePeerRequest.
|
||||
message DownloadPieceFailedRequest {
|
||||
// Piece info.
|
||||
common.v2.Piece piece = 1 [(validate.rules).message.required = true];
|
||||
// Temporary indicates whether the error is temporary.
|
||||
bool temporary = 1;
|
||||
// The number of piece.
|
||||
uint32 piece_number = 2 [(validate.rules).uint32.gte = 0];
|
||||
// Piece is information of piece.
|
||||
string parent_id = 3 [(validate.rules).string.min_len = 1];
|
||||
bool temporary = 2;
|
||||
}
|
||||
|
||||
// HTTPResponse represents http protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message HTTPResponse {
|
||||
// HTTP Response Header.
|
||||
map<string, string> header = 1;
|
||||
// HTTP Status Code.
|
||||
int32 status_code = 2 [(validate.rules).int32 = {gte: 100, lt: 599}];
|
||||
// HTTP Status.
|
||||
string status = 3 [(validate.rules).string.min_len = 1];
|
||||
}
|
||||
|
||||
// HDFSResponse represents hdfs protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message HDFSResponse {
|
||||
}
|
||||
|
||||
// S3Response represents s3 protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message S3Response {
|
||||
}
|
||||
|
||||
// OSSResponse represents oss protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message OSSResponse {
|
||||
}
|
||||
|
||||
// DownloadPieceBackToSourceFailedRequest downloads piece back-to-source failed request of AnnouncePeerRequest.
|
||||
message DownloadPieceBackToSourceFailedRequest {
|
||||
// The number of piece.
|
||||
uint32 piece_number = 1 [(validate.rules).uint32.gte = 0];
|
||||
// HTTP Response Header.
|
||||
map<string, string> header = 2;
|
||||
// HTTP Status Code.
|
||||
int32 status_code = 3 [(validate.rules).int32 = {gte: 100, lt: 599}];
|
||||
// HTTP Status.
|
||||
string status = 4 [(validate.rules).string.min_len = 1];
|
||||
// Piece info.
|
||||
common.v2.Piece piece = 1 [(validate.rules).message.required = true];
|
||||
|
||||
oneof response {
|
||||
option (validate.required) = true;
|
||||
|
||||
HTTPResponse http_response = 2;
|
||||
HDFSResponse hdfs_response = 3;
|
||||
S3Response s3_response = 4;
|
||||
OSSResponse oss_response = 5;
|
||||
}
|
||||
}
|
||||
|
||||
// SyncPiecesFailedRequest syncs pieces failed request of AnnouncePeerRequest.
|
||||
|
|
|
|||
|
|
@ -87,24 +87,45 @@ message DownloadPieceBackToSourceFinishedRequest {
|
|||
|
||||
// DownloadPieceFailedRequest downloads piece failed request of AnnouncePeerRequest.
|
||||
message DownloadPieceFailedRequest {
|
||||
// Piece info.
|
||||
common.Piece piece = 1;
|
||||
// Temporary indicates whether the error is temporary.
|
||||
bool temporary = 1;
|
||||
// The number of piece.
|
||||
uint32 piece_number = 2;
|
||||
// Piece is information of piece.
|
||||
string parent_id = 3;
|
||||
bool temporary = 2;
|
||||
}
|
||||
|
||||
// HTTPResponse represents http protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message HTTPResponse {
|
||||
// HTTP Response Header.
|
||||
map<string, string> header = 1;
|
||||
// HTTP Status Code.
|
||||
int32 status_code = 2;
|
||||
// HTTP Status.
|
||||
string status = 3;
|
||||
}
|
||||
|
||||
// HDFSResponse represents hdfs protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message HDFSResponse {
|
||||
}
|
||||
|
||||
// S3Response represents s3 protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message S3Response {
|
||||
}
|
||||
|
||||
// OSSResponse represents oss protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
message OSSResponse {
|
||||
}
|
||||
|
||||
// DownloadPieceBackToSourceFailedRequest downloads piece back-to-source failed request of AnnouncePeerRequest.
|
||||
message DownloadPieceBackToSourceFailedRequest {
|
||||
// The number of piece.
|
||||
uint32 piece_number = 1;
|
||||
// HTTP Response Header.
|
||||
map<string, string> header = 2;
|
||||
// HTTP Status Code.
|
||||
int32 status_code = 3;
|
||||
// HTTP Status.
|
||||
string status = 4;
|
||||
// Piece info.
|
||||
common.Piece piece = 1;
|
||||
|
||||
oneof response {
|
||||
HTTPResponse http_response = 2;
|
||||
HDFSResponse hdfs_response = 3;
|
||||
S3Response s3_response = 4;
|
||||
OSSResponse oss_response = 5;
|
||||
}
|
||||
}
|
||||
|
||||
// SyncPiecesFailedRequest syncs pieces failed request of AnnouncePeerRequest.
|
||||
|
|
|
|||
|
|
@ -84,36 +84,72 @@ pub struct DownloadPieceBackToSourceFinishedRequest {
|
|||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DownloadPieceFailedRequest {
|
||||
/// Piece info.
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub piece: ::core::option::Option<super::common::Piece>,
|
||||
/// Temporary indicates whether the error is temporary.
|
||||
#[prost(bool, tag = "1")]
|
||||
#[prost(bool, tag = "2")]
|
||||
pub temporary: bool,
|
||||
/// The number of piece.
|
||||
#[prost(uint32, tag = "2")]
|
||||
pub piece_number: u32,
|
||||
/// Piece is information of piece.
|
||||
#[prost(string, tag = "3")]
|
||||
pub parent_id: ::prost::alloc::string::String,
|
||||
}
|
||||
/// DownloadPieceBackToSourceFailedRequest downloads piece back-to-source failed request of AnnouncePeerRequest.
|
||||
/// HTTPResponse represents http protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DownloadPieceBackToSourceFailedRequest {
|
||||
/// The number of piece.
|
||||
#[prost(uint32, tag = "1")]
|
||||
pub piece_number: u32,
|
||||
pub struct HttpResponse {
|
||||
/// HTTP Response Header.
|
||||
#[prost(map = "string, string", tag = "2")]
|
||||
#[prost(map = "string, string", tag = "1")]
|
||||
pub header: ::std::collections::HashMap<
|
||||
::prost::alloc::string::String,
|
||||
::prost::alloc::string::String,
|
||||
>,
|
||||
/// HTTP Status Code.
|
||||
#[prost(int32, tag = "3")]
|
||||
#[prost(int32, tag = "2")]
|
||||
pub status_code: i32,
|
||||
/// HTTP Status.
|
||||
#[prost(string, tag = "4")]
|
||||
#[prost(string, tag = "3")]
|
||||
pub status: ::prost::alloc::string::String,
|
||||
}
|
||||
/// HDFSResponse represents hdfs protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct HdfsResponse {}
|
||||
/// S3Response represents s3 protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct S3Response {}
|
||||
/// OSSResponse represents oss protocol response of DownloadPieceBackToSourceFailedRequest.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct OssResponse {}
|
||||
/// DownloadPieceBackToSourceFailedRequest downloads piece back-to-source failed request of AnnouncePeerRequest.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DownloadPieceBackToSourceFailedRequest {
|
||||
/// Piece info.
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub piece: ::core::option::Option<super::common::Piece>,
|
||||
#[prost(
|
||||
oneof = "download_piece_back_to_source_failed_request::Response",
|
||||
tags = "2, 3, 4, 5"
|
||||
)]
|
||||
pub response: ::core::option::Option<
|
||||
download_piece_back_to_source_failed_request::Response,
|
||||
>,
|
||||
}
|
||||
/// Nested message and enum types in `DownloadPieceBackToSourceFailedRequest`.
|
||||
pub mod download_piece_back_to_source_failed_request {
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
||||
pub enum Response {
|
||||
#[prost(message, tag = "2")]
|
||||
HttpResponse(super::HttpResponse),
|
||||
#[prost(message, tag = "3")]
|
||||
HdfsResponse(super::HdfsResponse),
|
||||
#[prost(message, tag = "4")]
|
||||
S3Response(super::S3Response),
|
||||
#[prost(message, tag = "5")]
|
||||
OssResponse(super::OssResponse),
|
||||
}
|
||||
}
|
||||
/// SyncPiecesFailedRequest syncs pieces failed request of AnnouncePeerRequest.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue