backends

package
v0.0.0-...-764b39c Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDBHost     = "MYSQL_HOST"
	EnvDBPort     = "MYSQL_PORT"
	EnvDBDatabase = "MYSQL_DB_NAME"
	EnvDBUser     = "MYSQL_USER"
	EnvDBPassword = "MYSQL_PASSWORD"
	EnvLogMode    = "MYSQL_LOGMODE"
)

Variables

This section is empty.

Functions

func GetEnvOrDefault

func GetEnvOrDefault(key string, fallback string) string

func GetMysqlDBSource

func GetMysqlDBSource() (dbSource, logMode string, err error)

Types

type MysqlBackend

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

func NewMysqlBackend

func NewMysqlBackend(mockDB *gorm.DB) (*MysqlBackend, error)

func (*MysqlBackend) Close

func (b *MysqlBackend) Close() error

func (*MysqlBackend) GetTrialResult

func (b *MysqlBackend) GetTrialResult(request *api_pb.GetResultRequest) (*api_pb.GetResultReply, error)

func (*MysqlBackend) Initialize

func (b *MysqlBackend) Initialize() error

func (*MysqlBackend) Name

func (b *MysqlBackend) Name() string

func (*MysqlBackend) SaveTrialResult

func (b *MysqlBackend) SaveTrialResult(request *api_pb.SaveResultRequest) error

type StorageBackend

type StorageBackend interface {
	// Initialize initializes a backend storage service with local or remote database.
	Initialize() error
	// Close shutdown backend storage service.
	Close() error
	// Name returns backend name.
	Name() string
	// SaveTrialResult append or update a pod record to backend.
	SaveTrialResult(observationLog *api_pb.SaveResultRequest) error
	// GetTrialResult retrieve a TrialResult from backend.
	GetTrialResult(request *api_pb.GetResultRequest) (*api_pb.GetResultReply, error)
}

StorageBackend provides a collection of abstract methods to interact with different storage backends, write/read pod and job objects.

func NewMysqlBackendService

func NewMysqlBackendService() StorageBackend

type TrialResult

type TrialResult struct {
	//gorm.Model
	Namespace string `gorm:"type:varchar(128);column:namespace" json:"namespace"`
	TrialName string `gorm:"type:varchar(128);column:trial_name" json:"trial_name"`
	//ExperimentName string    `gorm:"type:varchar(128);column:experiment_name" json:"experiment_name"`
	Key   string `gorm:"type:varchar(128);column:key" json:"key"`
	Value string `gorm:"type:varchar(128);column:value" json:"value"`
}

func (*TrialResult) BeforeCreate

func (tr *TrialResult) BeforeCreate(scope *gorm.Scope) error

BeforeCreate update gmt_modified timestamp.

func (*TrialResult) BeforeUpdate

func (tr *TrialResult) BeforeUpdate(scope *gorm.Scope) error

BeforeUpdate update gmt_modified timestamp.

func (TrialResult) TableName

func (tr TrialResult) TableName() string

Jump to

Keyboard shortcuts

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