storage

package
v0.0.0-...-0701c2b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_DB_FORECAST            = "Forecast"
	DEFAULT_DB_COLLECTION_FORECAST = "Forecast"
)
View Source
const (
	DEFAULT_DB_POLICIES            = "Policies"
	DEFAULT_DB_COLLECTION_POLICIES = "Policies"
)
View Source
const (
	DEFAULT_DB_PROFILES            = "ServiceProfiles"
	DEFAULT_DB_COLLECTION_PROFILES = "PerformanceProfiles"
)
View Source
const (
	DEFAULT_DB_COLLECTION_VM_PROFILES = "VM_Booting_Profile"
)

Variables

View Source
var DEFAULT_DB_SERVER_PROFILES = os.Getenv("PROFILESDB_HOST")
View Source
var DEFAULT_DB_SERVER_VM_BOOTING = os.Getenv("PROFILESDB_HOST")

Functions

This section is empty.

Types

type ForecastDAO

type ForecastDAO struct {
	Server     string
	Database   string
	Collection string
	// contains filtered or unexported fields
}
var (
	ForecastDB *ForecastDAO

	DEFAULT_DB_SERVER_FORECAST = os.Getenv("FORECASTDB_HOST")
)

func GetForecastDAO

func GetForecastDAO(serviceName string) *ForecastDAO

func (*ForecastDAO) Connect

func (p *ForecastDAO) Connect() (*mgo.Database, error)

Connect to the database

func (*ForecastDAO) Delete

func (p *ForecastDAO) Delete(forecast types.Forecast) error

Delete the specified item

func (*ForecastDAO) DeleteAllBeforeDate

func (p *ForecastDAO) DeleteAllBeforeDate(timestamp time.Time) error

Delete all forecast older than a timestamp

func (*ForecastDAO) FindAll

func (p *ForecastDAO) FindAll() ([]types.Forecast, error)

Retrieve all the stored elements

func (*ForecastDAO) FindByID

func (p *ForecastDAO) FindByID(id string) (types.Forecast, error)

Retrieve the item with the specified ID

func (*ForecastDAO) FindOneByTimeWindow

func (p *ForecastDAO) FindOneByTimeWindow(startTime time.Time, endTime time.Time) (types.Forecast, error)

Retrieve all policies for start time greater than or equal to time t

func (*ForecastDAO) Insert

func (p *ForecastDAO) Insert(forecast types.Forecast) error

Insert a new forecast

func (*ForecastDAO) Update

func (p *ForecastDAO) Update(id bson.ObjectId, forecast types.Forecast) error

Delete the specified item

type PerformanceProfileDAO

type PerformanceProfileDAO struct {
	Server     string
	Database   string
	Collection string

	Session *mgo.Session
	// contains filtered or unexported fields
}
var PerformanceProfileDB *PerformanceProfileDAO

func GetPerformanceProfileDAO

func GetPerformanceProfileDAO(serviceName string) *PerformanceProfileDAO

func (*PerformanceProfileDAO) Connect

func (p *PerformanceProfileDAO) Connect() (*mgo.Database, error)

Connect to the database

func (*PerformanceProfileDAO) Delete

func (p *PerformanceProfileDAO) Delete(performanceProfile types.PerformanceProfile) error

Delete the specified item

func (*PerformanceProfileDAO) DeleteAll

func (p *PerformanceProfileDAO) DeleteAll() error

Delete the specified item

func (*PerformanceProfileDAO) FindAll

Retrieve all the stored elements

func (*PerformanceProfileDAO) FindAllUnderLimits

func (p *PerformanceProfileDAO) FindAllUnderLimits(cores float64, memory float64) ([]types.PerformanceProfile, error)

Bring limits for which are profiles available in:

@cores float64
@memory float64

out:

@ContainersConfig []types.ContainersConfig
@error

func (*PerformanceProfileDAO) FindByID

Retrieve the item with the specified ID

func (*PerformanceProfileDAO) FindByLimitsAndReplicas

func (p *PerformanceProfileDAO) FindByLimitsAndReplicas(cores float64, memory float64, replicas int) (types.PerformanceProfile, error)

func (*PerformanceProfileDAO) FindProfileByLimits

func (p *PerformanceProfileDAO) FindProfileByLimits(limit types.Limit) (types.PerformanceProfile, error)

func (*PerformanceProfileDAO) Insert

func (p *PerformanceProfileDAO) Insert(performanceProfile types.PerformanceProfile) error

Insert a new Performance Profile

func (*PerformanceProfileDAO) MatchProfileFitLimitsOver

func (p *PerformanceProfileDAO) MatchProfileFitLimitsOver(cores float64, memory float64, requests float64) ([]types.ContainersConfig, error)

Matches the profiles which fit into the specified limits and that provide a MSCPerSecond greater or equal than than the number of requests needed in:

@requests float64

out:

@ContainersConfig []types.ContainersConfig
@error

func (*PerformanceProfileDAO) MatchProfileFitLimitsUnder

func (p *PerformanceProfileDAO) MatchProfileFitLimitsUnder(cores float64, memory float64, requests float64) ([]types.ContainersConfig, error)

Matches the profiles which fit into the specified limits and that provide a MSCPerSecond less than than the number of requests needed in:

@requests float64

out:

@ContainersConfig []types.ContainersConfig
@error

func (*PerformanceProfileDAO) UpdateById

func (p *PerformanceProfileDAO) UpdateById(id bson.ObjectId, performanceProfile types.PerformanceProfile) error

Update by id

type PolicyDAO

type PolicyDAO struct {
	Server     string
	Database   string
	Collection string
	// contains filtered or unexported fields
}
var (
	PolicyDB                   *PolicyDAO
	DEFAULT_DB_SERVER_POLICIES = os.Getenv("POLICIESDB_HOST")
)

func GetPolicyDAO

func GetPolicyDAO(serviceName string) *PolicyDAO

func (*PolicyDAO) Connect

func (p *PolicyDAO) Connect() (*mgo.Database, error)

Connect to the database

func (*PolicyDAO) DeleteAllByTimeWindow

func (p *PolicyDAO) DeleteAllByTimeWindow(startTime time.Time, endTime time.Time) error

Delete all policies for the time window

func (*PolicyDAO) DeleteById

func (p *PolicyDAO) DeleteById(id string) error

Delete policy by id

func (*PolicyDAO) FindAll

func (p *PolicyDAO) FindAll() ([]types.Policy, error)

Retrieve all the stored elements

func (*PolicyDAO) FindAllByTimeWindow

func (p *PolicyDAO) FindAllByTimeWindow(startTime time.Time, endTime time.Time) ([]types.Policy, error)

Retrieve all policies for start time greater than or equal to time t

func (*PolicyDAO) FindByEndTime

func (p *PolicyDAO) FindByEndTime(time time.Time) ([]types.Policy, error)

Retrieve all policies for start time less than or equal to time t

func (*PolicyDAO) FindByID

func (p *PolicyDAO) FindByID(id string) (types.Policy, error)

Retrieve the item with the specified ID

func (*PolicyDAO) FindByStartTime

func (p *PolicyDAO) FindByStartTime(time time.Time) ([]types.Policy, error)

Retrieve all policies for start time greater than or equal to time t

func (*PolicyDAO) FindOneByTimeWindow

func (p *PolicyDAO) FindOneByTimeWindow(startTime time.Time, endTime time.Time) (types.Policy, error)

Retrieve all policies for start time greater than or equal to time t

func (*PolicyDAO) FindSelectedByTimeWindow

func (p *PolicyDAO) FindSelectedByTimeWindow(startTime time.Time, endTime time.Time) (types.Policy, error)

Retrieve the policy selected for the given time window

func (*PolicyDAO) Insert

func (p *PolicyDAO) Insert(policies types.Policy) error

Insert a new Performance Profile

func (*PolicyDAO) UpdateById

func (p *PolicyDAO) UpdateById(id bson.ObjectId, policy types.Policy) error

Update policy by id

type VMBootingProfileDAO

type VMBootingProfileDAO struct {
	Server     string
	Database   string
	Collection string

	Session *mgo.Session
	// contains filtered or unexported fields
}
var VMBootingProfileDB *VMBootingProfileDAO

func GetVMBootingProfileDAO

func GetVMBootingProfileDAO() *VMBootingProfileDAO

func (*VMBootingProfileDAO) BootingShutdownTime

func (p *VMBootingProfileDAO) BootingShutdownTime(vmType string, numInstances int) (types.BootShutDownTime, error)

Search booting and shutdown time for a vm type and number of instances

func (*VMBootingProfileDAO) Connect

func (p *VMBootingProfileDAO) Connect() (*mgo.Database, error)

Connect to the database

func (*VMBootingProfileDAO) DeleteAll

func (p *VMBootingProfileDAO) DeleteAll() error

Delete the specified item

func (*VMBootingProfileDAO) FindAll

Retrieve all the stored elements

func (*VMBootingProfileDAO) FindByType

Retrieve the item with the specified ID

func (*VMBootingProfileDAO) Insert

func (p *VMBootingProfileDAO) Insert(vmBootingProfile types.InstancesBootShutdownTime) error

Insert a new Performance Profile

func (*VMBootingProfileDAO) InstanceVMBootingShutdown

func (p *VMBootingProfileDAO) InstanceVMBootingShutdown(vmType string) (types.InstancesBootShutdownTime, error)

Search booting and shutdown time for a vm type

func (*VMBootingProfileDAO) UpdateByType

func (p *VMBootingProfileDAO) UpdateByType(vmType string, vmBootingProfile types.InstancesBootShutdownTime) error

Update by type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL