...

Package utils

import "scheduler/utils"
Overview
Index

Overview ▾

Package utils implement utilities functions

Index ▾

Constants
func ArrayFloatToStringCommas(array []float64) string
func ComputeTimings(start *types.TimingsStart, timings *types.Timings)
func GetRandomInteger(max int) int
func GetTimeNow() *time.Time
func HttpAddHeadersToResponse(w *http.ResponseWriter, customHeaders *map[string]string)
func HttpGet(url string) (*http.Response, error)
func HttpGetWithHeaders(url string, headers []HttpHeader) (*http.Response, error)
func HttpMachineGet(url string) (*http.Response, error)
func HttpMachinePostJSON(url string, json string) (*http.Response, error)
func HttpMachinePostJSONWithHeaders(url string, json string, headers *[]HttpHeader) (*http.Response, error)
func HttpParseXHeaders(headers http.Header) *map[string]string
func HttpPost(url string, payload []byte, contentType string) (*http.Response, error)
func HttpPostJSON(url string, json string) (*http.Response, error)
func HttpSendJSONResponse(w *http.ResponseWriter, code int, body string, customHeaders *map[string]string)
func HttpSendJSONResponseByte(w *http.ResponseWriter, code int, body []byte, customHeaders *map[string]string)
func LoadsBelowSpecificLoad(slots []uint, threshold uint) []uint
func MapsMerge(ms ...map[string]string) map[string]string
func MaxOfArrayFloat(array []float64) (float64, int)
func MaxOfArrayUint(array []uint) (uint, int)
func MinOfArrayUint(array []uint) (uint, int)
func SlotsAboveSpecificFreeSlots(slots []uint, threshold uint) []uint
type ErrorHttpCannotCreateRequest
    func (e ErrorHttpCannotCreateRequest) Error() string
type HttpHeader
type Semaphore
    func (s Semaphore) Lock()
    func (s Semaphore) P(n int)
    func (s Semaphore) Signal()
    func (s Semaphore) Unlock()
    func (s Semaphore) V(n int)
    func (s Semaphore) Wait(n int)

Package files

arrays.go filesystem.go http.go maps.go random.go semaphore.go timings.go utils.go

Constants

const HttpHeaderP2PFaaSExecutionTime = "X-P2pfaas-Timing-Execution-Time-Seconds"
const HttpHeaderP2PFaaSExternallyExecuted = "X-P2pfaas-Externally-Executed"
const HttpHeaderP2PFaaSHops = "X-P2pfaas-Hops"
const HttpHeaderP2PFaaSPeersListId = "X-P2pfaas-Peers-List-Id"
const HttpHeaderP2PFaaSPeersListIp = "X-P2pfaas-Peers-List-Ip"
const HttpHeaderP2PFaaSProbeMessagesTime = "X-P2pfaas-Timing-Probe-Messages"
const HttpHeaderP2PFaaSProbingTime = "X-P2pfaas-Timing-Probing-Time-Seconds"
const HttpHeaderP2PFaaSProbingTimingsList = "X-P2pfaas-Timing-Probing-Seconds-List"
const HttpHeaderP2PFaaSScheduler = "X-P2pfaas-Scheduler"

HttpHeaderP2PFaaSSchedulerBypass when set to request will always schedule the request internally

const HttpHeaderP2PFaaSSchedulerBypass = "X-P2pfaas-Scheduler-Bypass"

HttpHeaderP2PFaaSSchedulerForward when set to request will always forward the request to a random neighbour

const HttpHeaderP2PFaaSSchedulerForward = "X-P2pfaas-Scheduler-Forward"

HttpHeaderP2PFaaSSchedulerReject when set to request will always reject the request

const HttpHeaderP2PFaaSSchedulerReject = "X-P2pfaas-Scheduler-Reject"
const HttpHeaderP2PFaaSSchedulerTracingId = "X-P2pfaas-Scheduler-Task-Tracing-Id"
const HttpHeaderP2PFaaSSchedulingTime = "X-P2pfaas-Timing-Scheduling-Time-Seconds"
const HttpHeaderP2PFaaSSchedulingTimingsList = "X-P2pfaas-Timing-Scheduling-Seconds-List"
const HttpHeaderP2PFaaSTotalTime = "X-P2pfaas-Timing-Total-Time-Seconds"
const HttpHeaderP2PFaaSTotalTimingsList = "X-P2pfaas-Timing-Total-Seconds-List"
const HttpHeaderP2PFaaSVersion = "X-P2pfaas-Version"

func ArrayFloatToStringCommas

func ArrayFloatToStringCommas(array []float64) string

func ComputeTimings

func ComputeTimings(start *types.TimingsStart, timings *types.Timings)

func GetRandomInteger

func GetRandomInteger(max int) int

func GetTimeNow

func GetTimeNow() *time.Time

func HttpAddHeadersToResponse

func HttpAddHeadersToResponse(w *http.ResponseWriter, customHeaders *map[string]string)

func HttpGet

func HttpGet(url string) (*http.Response, error)

func HttpGetWithHeaders

func HttpGetWithHeaders(url string, headers []HttpHeader) (*http.Response, error)

func HttpMachineGet

func HttpMachineGet(url string) (*http.Response, error)

HttpMachineGet performs and http get setting as user agent Machine

func HttpMachinePostJSON

func HttpMachinePostJSON(url string, json string) (*http.Response, error)

func HttpMachinePostJSONWithHeaders

func HttpMachinePostJSONWithHeaders(url string, json string, headers *[]HttpHeader) (*http.Response, error)

func HttpParseXHeaders

func HttpParseXHeaders(headers http.Header) *map[string]string

func HttpPost

func HttpPost(url string, payload []byte, contentType string) (*http.Response, error)

func HttpPostJSON

func HttpPostJSON(url string, json string) (*http.Response, error)

func HttpSendJSONResponse

func HttpSendJSONResponse(w *http.ResponseWriter, code int, body string, customHeaders *map[string]string)

func HttpSendJSONResponseByte

func HttpSendJSONResponseByte(w *http.ResponseWriter, code int, body []byte, customHeaders *map[string]string)

func LoadsBelowSpecificLoad

func LoadsBelowSpecificLoad(slots []uint, threshold uint) []uint

func MapsMerge

func MapsMerge(ms ...map[string]string) map[string]string

func MaxOfArrayFloat

func MaxOfArrayFloat(array []float64) (float64, int)

func MaxOfArrayUint

func MaxOfArrayUint(array []uint) (uint, int)

func MinOfArrayUint

func MinOfArrayUint(array []uint) (uint, int)

func SlotsAboveSpecificFreeSlots

func SlotsAboveSpecificFreeSlots(slots []uint, threshold uint) []uint

type ErrorHttpCannotCreateRequest

type ErrorHttpCannotCreateRequest struct{}

func (ErrorHttpCannotCreateRequest) Error

func (e ErrorHttpCannotCreateRequest) Error() string

type HttpHeader

type HttpHeader struct {
    Key   string
    Value string
}

type Semaphore

type Semaphore chan empty

func (Semaphore) Lock

func (s Semaphore) Lock()

func (Semaphore) P

func (s Semaphore) P(n int)

P acquires n resources

func (Semaphore) Signal

func (s Semaphore) Signal()

func (Semaphore) Unlock

func (s Semaphore) Unlock()

func (Semaphore) V

func (s Semaphore) V(n int)

V releases n resources

func (Semaphore) Wait

func (s Semaphore) Wait(n int)