...

Source file src/scheduler/scheduler/errors.go

Documentation: scheduler/scheduler

     1  /*
     2   * P2PFaaS - A framework for FaaS Load Balancing
     3   * Copyright (c) 2019 - 2022. Gabriele Proietti Mattia <pm.gabriele@outlook.com>
     4   *
     5   * This program is free software: you can redistribute it and/or modify
     6   * it under the terms of the GNU General Public License as published by
     7   * the Free Software Foundation, either version 3 of the License, or
     8   * (at your option) any later version.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <https://www.gnu.org/licenses/>.
    17   */
    18  
    19  package scheduler
    20  
    21  import "fmt"
    22  
    23  type JobCannotBeScheduled struct {
    24  	reason string
    25  }
    26  
    27  func (e JobCannotBeScheduled) Error() string {
    28  	return fmt.Sprintf("Job cannot be scheduled: %s", e.reason)
    29  }
    30  
    31  type JobCannotBeForwarded struct {
    32  	neighborHost string
    33  	reason       string
    34  }
    35  
    36  func (e JobCannotBeForwarded) Error() string {
    37  	return fmt.Sprintf("Job cannot be forwarded to neighbor %s: %s", e.neighborHost, e.reason)
    38  }
    39  
    40  type PeerResponseNil struct {
    41  	neighborHost string
    42  }
    43  
    44  func (e PeerResponseNil) Error() string {
    45  	return fmt.Sprintf("Peer %s response is nil", e.neighborHost)
    46  }
    47  
    48  type JobDeliberatelyRejected struct {
    49  }
    50  
    51  func (e JobDeliberatelyRejected) Error() string {
    52  	return fmt.Sprintf("Job has been deliberately rejected")
    53  }
    54  
    55  type CannotChangeScheduler struct{}
    56  
    57  func (e CannotChangeScheduler) Error() string {
    58  	return "SchedulerDescriptor cannot be changed right now"
    59  }
    60  
    61  type CannotRetrieveAction struct {
    62  	err error
    63  }
    64  
    65  func (e CannotRetrieveAction) Error() string {
    66  	return fmt.Sprintf("The action to be taken cannot be retrieved: %s", e.err)
    67  }
    68  
    69  type CannotRetrieveRecipientNode struct {
    70  	err error
    71  }
    72  
    73  func (e CannotRetrieveRecipientNode) Error() string {
    74  	return fmt.Sprintf("The recipient node cannot be retrieved: %s", e.err)
    75  }
    76  
    77  type BadSchedulerParameters struct{}
    78  
    79  func (e BadSchedulerParameters) Error() string {
    80  	return "Bad passed parameters for scheduler"
    81  }
    82  

View as plain text