...

Package config

import "scheduler/config"
Overview
Index

Overview ▾

Package config implements all the configuration parameters of the system and their handling.

Constants

const AppName = "p2pfaas-scheduler"
const AppVersion = "0.3.0b"
const AppVersionCommit = "xxx"

const ConfigurationFilePath = "/config"

const ConfigurationFileName = "p2p_faas-scheduler.json"
const ConfigurationSchedulerFileName = "p2p_faas-scheduler-config.json"
const DataPath = "/data"
const DefaultDataPath = "/data"
const DefaultFunctionsRunningMax = 10
const DefaultListeningPort = 18080
const DefaultOpenFaaSListeningHost = "faas_containers-openfaas-swarm"
const DefaultOpenFaaSListeningPort = 8080
const DefaultQueueLengthMax = 100
const DefaultRunningEnvironment = RunningEnvironmentProduction
const DefaultServiceDiscoveryListeningHost = "discovery"
const DefaultServiceDiscoveryListeningPort = 19000
const DefaultServiceLearningListeningHost = "learner"
const DefaultServiceLearningListeningPort = 19020
const EnvDataPath = "P2PFAAS_DATA_PATH"
const EnvFunctionsList = "P2PFAAS_FNS_LIST"
const EnvOpenFaasEnabled = "P2PFAAS_OPENFAAS_ENABLED"
const EnvOpenFaasListeningHost = "P2PFAAS_OPENFAAS_HOST"
const EnvOpenFaasListeningPort = "P2PFAAS_OPENFAAS_PORT"
const EnvProfiling = "P2PFAAS_PROF"

env

const EnvRunningEnvironment = "P2PFAAS_DEV_ENV"
const EnvServiceDiscoveryListeningHost = "P2PFAAS_SERVICE_DISCOVERY_HOST"
const EnvServiceDiscoveryListeningPort = "P2PFAAS_SERVICE_DISCOVERY_PORT"
const EnvServiceLearningListeningHost = "P2PFAAS_SERVICE_LEARNING_HOST"
const EnvServiceLearningListeningPort = "P2PFAAS_SERVICE_LEARNING_PORT"
const RunningEnvironmentDevelopment = "development"
const RunningEnvironmentProduction = "production"
const UserAgentMachine = "Machine"

Variables

var OpenFaaSPassword = "admin"
var OpenFaaSUsername = "admin"

func CreateDataFolder

func CreateDataFolder() error

func GetConfigFilePath

func GetConfigFilePath() string

func GetConfigSchedulerFilePath

func GetConfigSchedulerFilePath() string

func GetDataPath

func GetDataPath() string

func GetFunctionsList

func GetFunctionsList() []string

GetFunctionsList is currently unused!

func GetListeningPort

func GetListeningPort() uint

func GetOpenFaasEnabled

func GetOpenFaasEnabled() bool

func GetOpenFaasListeningHost

func GetOpenFaasListeningHost() string

func GetOpenFaasListeningPort

func GetOpenFaasListeningPort() uint

func GetQueueEnabled

func GetQueueEnabled() bool

func GetQueueLengthMax

func GetQueueLengthMax() uint

func GetRunningEnvironment

func GetRunningEnvironment() string

func GetRunningFunctionMax

func GetRunningFunctionMax() uint

func GetServiceDiscoveryListeningHost

func GetServiceDiscoveryListeningHost() string

func GetServiceDiscoveryListeningPort

func GetServiceDiscoveryListeningPort() uint

func GetServiceLearningListeningHost

func GetServiceLearningListeningHost() string

func GetServiceLearningListeningPort

func GetServiceLearningListeningPort() uint

func InitConfigurationDynamic

func InitConfigurationDynamic()

InitConfigurationDynamic prepare the configuration object, returns if config is read from file

func InitConfigurationStatic

func InitConfigurationStatic()

InitConfigurationStatic prepares and inits the static configuration by loading it from env vars.

func IsConfigurationDynamicReadFromFile

func IsConfigurationDynamicReadFromFile() bool

func IsRunningEnvironmentDevelopment

func IsRunningEnvironmentDevelopment() bool

func SaveConfigurationDynamicToConfigFile

func SaveConfigurationDynamicToConfigFile() error

func SaveConfigurationSchedulerToConfigFile

func SaveConfigurationSchedulerToConfigFile(descriptor *types.SchedulerDescriptor) error

func SetQueueEnabled

func SetQueueEnabled(b bool)

func SetQueueLengthMax

func SetQueueLengthMax(n uint)

func SetRunningFunctionMax

func SetRunningFunctionMax(n uint)

func Start

func Start()

type ConfigError

type ConfigError struct{}

func (ConfigError) Error

func (ConfigError) Error() string

type ConfigurationDynamic

type ConfigurationDynamic struct {
    ParallelRunningFunctionsMax uint `json:"parallel_running_functions_max" bson:"parallel_running_functions_max"`
    QueueLengthMax              uint `json:"queue_length_max" bson:"queue_length_max"`
    QueueEnabled                bool `json:"queue_enabled" bson:"queue_enabled"`
}

func GetConfigurationDynamicCopy

func GetConfigurationDynamicCopy() *ConfigurationDynamic

func GetDefaultConfigurationDynamic

func GetDefaultConfigurationDynamic() *ConfigurationDynamic

GetDefaultConfigurationDynamic returns the dynamic configuration object with default values

func ReadConfigurationDynamicFromFile

func ReadConfigurationDynamicFromFile() (*ConfigurationDynamic, error)

ReadConfigurationDynamicFromFile reads the configuration from a file

type ConfigurationStatic

type ConfigurationStatic struct {
    // contains filtered or unexported fields
}

func GetDefaultConfigurationStatic

func GetDefaultConfigurationStatic() *ConfigurationStatic

GetDefaultConfigurationStatic returns the static configuration object with default values