experiment

package
v0.0.0-...-80cf7ea Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ExpectedDBVersion int64 = 1

Variables

This section is empty.

Functions

func CheckIfFatal

func CheckIfFatal(inErr error) (err error)

CheckIfFatal is used to handle the errors being returned from the Postgres driver. If errors exist that are not recoverable that relate to schema issues, such as missing columns, indexes and generally expected Database artifacts then this function will kill the task in which they are running.

func CloseDB

func CloseDB() error

CloseDB is used to close any existing database connections to the Experiment DB

func DBShowAllTrace

func DBShowAllTrace() (output []string, err kv.Error)

showAllTrace is a utility function useful for when the database comes up to dump information about the session and other parameters that can be useful in debugging issues with parameters set by the operational side of the system. Its output is generally intended for engineering and thrid level support personnel

func DeactivateExperiment

func DeactivateExperiment(ctx context.Context, uid string) (err kv.Error)

DeactivateExperiment is used to conceal experiments from future operations unless special flags are set. It is used where otherwise the experiment would be delete but we need to retain a record of it having existed.

func GetDBStatus

func GetDBStatus() (err kv.Error)

Status is used to retrieve the main eco system status from a server. This function will return an error value of nil if the DB is running for a useful error for why it might not be running

func InsertExperiment

func InsertExperiment(ctx context.Context, data *grpc.Experiment) (result *grpc.Experiment, err kv.Error)

InsertExperiment is used to insert a single dataset record into the postgres database. A unique ID will be generated by the insertion operation and this ID will be placed into the returned record so that the caller has a unique reference to the inserted data for use in either performing other database operations or making reference to the project from other records.

The result returned this function does not share memory with the input data parameter and is a deep copy. This is slight less efficent than returning the mutated input structure but safer in regards to potential side effects as a result of assumptions made by the caller.

func SaveLog

func SaveLog(log *Log) (err kv.Error)

SaveLog is used to insert a logging record either originating from the master, or from a client into the logging table

func SelectExperiment

func SelectExperiment(ctx context.Context, rowId uint64, uid string) (result *grpc.Experiment, err kv.Error)

SelectExperiment is used to retrieve one or more experiments that have been registered with the service.

If the rowId is specified, that is not 0, then the database specific row identifier will be used to retrieve a single row. If the rowId is not specified then the application unique identifier will be used to retrieve the experiment.

The function will return a nil the first returned parameter, along with a nil for the error in the case the SQL query works but returns no data.

This function will NOT return layer information.

func SelectExperimentWide

func SelectExperimentWide(ctx context.Context, uid string) (result *grpc.Experiment, err kv.Error)

SelectExperimentWide is used to retrieve one or more experiments that have been registered with the service along with all of the layer details.

The application unique identifier will be used to retrieve the experiment.

The function can return both a nil, or an empty array for the first result, along with a nil for the error in the case the SQL query works but returns no data.

For a single experiment this function will return one row for every layer that was found.

func StartDB

func StartDB(ctx context.Context) (msgC chan string, errorC chan *DBErrorMsg, err kv.Error)

StartDB is used to open and then attempt to test the connection to the database, which contains state information for components of the platform ecosystem

Types

type DBErr

type DBErr struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type DBErrorMsg

type DBErrorMsg struct {
	Fatal bool
	Err   kv.Error
}

type ExperimentData

type ExperimentData struct {
	ID          int64     `db:"id"`
	UID         int64     `db:"uid"`
	Created     time.Time `db:"created"`
	Name        string    `db:"name"`
	Description string    `db:"description"`
}

ExperimentData will hold data ready for being handled by the SQL layer for experiments.

type Log

type Log struct {
	Priority    syslog.Priority
	Nanoseconds int64
	Source      string
	Msg         string
}

Log is used to hold unstructured log entries that will be marshalled

Jump to

Keyboard shortcuts

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