type APIResponse struct {
Headers http.Header `json:"headers"`
Body []byte `json:"body"`
StatusCode int `json:"status_code"`
}
type FaasApiResponse struct {
Headers http.Header
Body []byte
StatusCode int
}
type Load struct {
// general info
SchedulerName string `json:"scheduler_name"`
// functions-related
FunctionsDeployed uint `json:"functions_deployed"`
FunctionsTotalReplicas uint `json:"functions_total_replicas"`
FunctionsRunning uint `json:"functions_running"`
FunctionsRunningMax uint `json:"functions_running_max"`
// queue-related
QueueLengthMax uint `json:"queue_max_length"`
QueueFill int `json:"queue_fill"`
}
type PeerJobRequest struct {
// Function faas_containers-openfaas.Function `json:"function"` // the function that we want to execute
ServiceIdRequest uint64 `json:"service_id_request"` // the service request id
ServiceIdTracing string `json:"service_id_tracing"` // the service request tracing id
FunctionName string `json:"function_name"` // the function name to execute
Hops int `json:"hops"` // number of times the job is forwarded
PeersList []PeersListMember `json:"peers_list"` // list of peers that handled the job
Payload string `json:"payload"` // the payload of the request in base64 string
ContentType string `json:"content_type"` // the mime type of the payload
Headers map[string]string `json:"headers"` // the headers to add to the peer job request
}
type PeerJobResponse struct {
PeersList []PeersListMember `json:"peers_list"` // list of peers that handled the job
Body string `json:"body"` // base64 encoded
StatusCode int `json:"status_code"` // job response status code
}
type PeersListMember struct {
MachineId string `json:"machine_id"`
MachineIp string `json:"machine_ip"`
Timings Timings `json:"timings"` // timing referred to the passage in that machine
}
type SchedulerDescriptor struct {
Name string `json:"name"`
Parameters []string `json:"parameters"`
}
type ServiceRequest struct {
Id uint64 // unique id assigned to the request
IdTracing string
ServiceName string // Name of the function to be executed
ServiceType int64 // type of the task to be executed
Payload []byte
PayloadContentType string
Headers *map[string]string
External bool // If the service request comes from another node and not user
ExternalJobRequest *PeerJobRequest
}
type Timings struct {
ExecutionTime *float64 `json:"execution_time,omitempty"` // the time of executing the job comprising the GET to openfaas
TotalTime *float64 `json:"total_time,omitempty"` // elapsed time from job arrival til its completed execution
SchedulingTime *float64 `json:"scheduling_time,omitempty"` // elapsed time for a job to be scheduled
ProbingTime *float64 `json:"probing_time,omitempty"` // elapsed time for a job to probe other nodes
}
type TimingsStart struct {
ArrivedAt *time.Time `json:"arrived_at,omitempty"` // time at which job arrives
ProbingStartedAt *time.Time `json:"started_probing_at,omitempty"` // time at which probing is started
ProbingEndedAt *time.Time `json:"ended_probing_at,omitempty"` // time at which probing is ended
ScheduledAt *time.Time `json:"scheduled_at,omitempty"` // time at which job is scheduled internally or externally
}