// IsReturnable checks che
9980
func (o *order) IsReturnable(amount int64) error {
	if o.Status != orderpb.Order_Paid && o.Status != orderpb.Order_Fulfilled && o.Status != orderpb.Order_Canceled {
		return status.Error(codes.Internal, "Order is not paid or fulfilled.")
	}
	// if refund amount is bigger than the order amount return err
	if amount > o.GetAmount() {
		return status.Error(codes.Internal, "Refund amount is greater then order amount.")
	}
	return nil
}
1181945
func (builder *UpdateGSetCommandBuilder) WithReturnBody(returnBody bool) *UpdateGSetCommandBuilder {
	builder.protobuf.ReturnBody = &returnBody
	return builder
}
506471
func IsRetryableAPIError(err error) bool {
	return apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) || apierrs.IsTooManyRequests(err) || apierrs.IsInternalError(err)
}
1285374
func DefaultRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) {
	// do not retry on context.Canceled or context.DeadlineExceeded
	if ctx.Err() != nil {
		return false, ctx.Err()
	}

	if err != nil {
		return true, err
	}
	// Check the response code. We retry on 500-range responses to allow
	// the server time to recover, as 500's are typically not permanent
	// errors and may relate to outages on the server side. This will catch
	// invalid response codes as well, like 0 and 999.
	if resp.StatusCode == 0 || (resp.StatusCode >= 500 && resp.StatusCode != 501) {
		return true, nil
	}

	return false, nil
}
1185650
func (tsv *TabletServer) isMySQLReachable() bool {
	tsv.mu.Lock()
	switch tsv.state {
	case StateServing:
		// Prevent transition out of this state by
		// reserving a request.
		tsv.requests.Add(1)
		defer tsv.requests.Done()
	case StateNotServing:
		// Prevent transition out of this state by
		// temporarily switching to StateTransitioning.
		tsv.setState(StateTransitioning)
		defer func() {
			tsv.transition(StateNotServing)
		}()
	default:
		tsv.mu.Unlock()
		return true
	}
	tsv.mu.Unlock()
	return tsv.qe.IsMySQLReachable()
}
782427
func (s *PutResolverRulePolicyOutput) SetReturnValue(v bool) *PutResolverRulePolicyOutput {
	s.ReturnValue = &v
	return s
}
166811
func canRetry(err error) bool {
	if temp, ok := err.(TemporaryError); ok && temp.Temporary() {
		return true
	}
	return err == ErrRecalculate
}
136444
func (s *DeleteResourceShareOutput) SetReturnValue(v bool) *DeleteResourceShareOutput {
	s.ReturnValue = &v
	return s
}
117468
func isCodeRetryable(statusCode int) bool {
	if _, ok := retryableStatusCodes[statusCode]; ok {
		return true
	}

	return false
}
14316
func (s *ConditionCheck) SetReturnValuesOnConditionCheckFailure(v string) *ConditionCheck {
	s.ReturnValuesOnConditionCheckFailure = &v
	return s
}
373236
func (s *LiteralArrayOptions) SetReturnEnabled(v bool) *LiteralArrayOptions {
	s.ReturnEnabled = &v
	return s
}
18932
func (s *IntOptions) SetReturnEnabled(v bool) *IntOptions {
	s.ReturnEnabled = &v
	return s
}
1113122
func (a *EvaluateOnCallFrameArgs) SetReturnByValue(returnByValue bool) *EvaluateOnCallFrameArgs {
	a.ReturnByValue = &returnByValue
	return a
}
65027
func NewRecoverableError(e error, recoverable bool) error {
	if e == nil {
		return nil
	}

	return &RecoverableError{
		Err:         e.Error(),
		Recoverable: recoverable,
	}
}
1044721
func (s *DoubleArrayOptions) SetReturnEnabled(v bool) *DoubleArrayOptions {
	s.ReturnEnabled = &v
	return s
}
343233
func (s *Put) SetReturnValuesOnConditionCheckFailure(v string) *Put {
	s.ReturnValuesOnConditionCheckFailure = &v
	return s
}
1312595
func IsRetryableError(err error) bool {
	e, ok := err.(JSONError)
	return ok && e.Retry
}