Documentation ¶
Index ¶
Constants ¶
View Source
const ( PostgresDriverName = "postgres" MysqlDriverName = "mysql" PolicyDb = "policy_db" BindingDb = "binding_db" StoredProcedureDb = "storedprocedure_db" )
View Source
const ( DESCSTR string = "DESC" ASCSTR string = "ASC" )
Variables ¶
View Source
var ErrAlreadyExists = fmt.Errorf("already exists")
View Source
var ErrConflict = fmt.Errorf("conflicting entry exists")
View Source
var ErrDoesNotExist = fmt.Errorf("doesn't exist")
Functions ¶
This section is empty.
Types ¶
type AppMetricDB ¶
type AppMetricDB interface { DatabaseStatus SaveAppMetric(appMetric *models.AppMetric) error SaveAppMetricsInBulk(metrics []*models.AppMetric) error RetrieveAppMetrics(appId string, metricType string, start int64, end int64, orderType OrderType) ([]*models.AppMetric, error) PruneAppMetrics(before int64) error Close() error }
type BindingDB ¶
type BindingDB interface { DatabaseStatus CreateServiceInstance(serviceInstance models.ServiceInstance) error GetServiceInstance(serviceInstanceId string) (*models.ServiceInstance, error) GetServiceInstanceByAppId(appId string) (*models.ServiceInstance, error) UpdateServiceInstance(serviceInstance models.ServiceInstance) error DeleteServiceInstance(serviceInstanceId string) error CreateServiceBinding(bindingId string, serviceInstanceId string, appId string) error DeleteServiceBinding(bindingId string) error DeleteServiceBindingByAppId(appId string) error CheckServiceBinding(appId string) bool GetAppIdByBindingId(bindingId string) (string, error) GetAppIdsByInstanceId(instanceId string) ([]string, error) CountServiceInstancesInOrg(orgId string) (int, error) GetBindingIdsByInstanceId(instanceId string) ([]string, error) Close() error }
type Database ¶
func GetConnection ¶
*
This function is used to generate db connection info, for example, For mysql: input dbUrl: 'username:password@tcp(localhost:3306)/autoscaler?tls=custom&sslrootcert=db_ca.crt' return: &Database{DriverName: "mysql", DSN:"username:password@tcp(localhost:3306)/autoscaler?parseTime=true&tls=custom"}
For postgres:
input dbUrl: postgres://postgres:password@localhost:5432/autoscaler?sslmode=disable return: &Database{DriverName: "postgres", DSN:"postgres://postgres:password@localhost:5432/autoscaler?sslmode=disable" *
type DatabaseConfig ¶
type DatabaseStatus ¶
type InstanceMetricsDB ¶
type InstanceMetricsDB interface { DatabaseStatus RetrieveInstanceMetrics(appid string, instanceIndex int, name string, start int64, end int64, orderType OrderType) ([]*models.AppInstanceMetric, error) SaveMetric(metric *models.AppInstanceMetric) error SaveMetricsInBulk(metrics []*models.AppInstanceMetric) error PruneInstanceMetrics(before int64) error Close() error }
type MySQLConfig ¶
type MySQLConfig struct {
// contains filtered or unexported fields
}
type PolicyDB ¶
type PolicyDB interface { DatabaseStatus GetAppIds() (map[string]bool, error) GetAppPolicy(appId string) (*models.ScalingPolicy, error) SaveAppPolicy(appId string, policy string, policyGuid string) error SetOrUpdateDefaultAppPolicy(appIds []string, oldPolicyGuid string, newPolicy string, newPolicyGuid string) ([]string, error) DeletePoliciesByPolicyGuid(policyGuid string) ([]string, error) RetrievePolicies() ([]*models.PolicyJson, error) Close() error DeletePolicy(appId string) error SaveCredential(appId string, cred models.Credential) error DeleteCredential(appId string) error GetCredential(appId string) (*models.Credential, error) }
type ScalingEngineDB ¶
type ScalingEngineDB interface { DatabaseStatus SaveScalingHistory(history *models.AppScalingHistory) error RetrieveScalingHistories(appId string, start int64, end int64, orderType OrderType, includeAll bool) ([]*models.AppScalingHistory, error) PruneScalingHistories(before int64) error UpdateScalingCooldownExpireTime(appId string, expireAt int64) error CanScaleApp(appId string) (bool, int64, error) GetActiveSchedule(appId string) (*models.ActiveSchedule, error) GetActiveSchedules() (map[string]string, error) SetActiveSchedule(appId string, schedule *models.ActiveSchedule) error RemoveActiveSchedule(appId string) error Close() error }
type SchedulerDB ¶
type SchedulerDB interface { DatabaseStatus GetActiveSchedules() (map[string]*models.ActiveSchedule, error) Close() error }
type StoredProcedureDB ¶
type StoredProcedureDB interface { Close() error CreateCredentials(credOptions models.CredentialsOptions) (*models.Credential, error) DeleteCredentials(credOptions models.CredentialsOptions) error DeleteAllInstanceCredentials(instanceId string) error ValidateCredentials(creds models.Credential) (*models.CredentialsOptions, error) }
Click to show internal directories.
Click to hide internal directories.