database

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendType

type BackendType string

BackendType The type of the database backend to use

const (
	//SQLite Use an sqlite database in the backend
	SQLite BackendType = "SQLite"
	//Postgres User a postgres database in the backend
	Postgres BackendType = "Postgres"
)

type Handler

type Handler struct {
	DB             *gorm.DB
	BaseKey        string
	UserDataBucket string
	DBBucket       string
}

Handler Wraps the database with convinence methods

func InitDatabaseHandler

func InitDatabaseHandler() (*Handler, error)

InitDatabaseHandler Initializes the database to store the Job

func (*Handler) CheckSecret

func (handler *Handler) CheckSecret(id string, secretKey string) error

CheckSecret Compares the provided secret/JobID with a job in the database

func (*Handler) CreateJob

func (handler *Handler) CreateJob() (*Job, string, error)

CreateJob Creates a new bakta job in init mode

func (*Handler) GetJob

func (handler *Handler) GetJob(id string) (*Job, error)

GetJob Returns the stored config of a job

func (*Handler) GetJobStatus

func (handler *Handler) GetJobStatus(jobID string) (*Job, error)

GetJobStatus Returns the status of an individual job

func (*Handler) GetJobsStatus

func (handler *Handler) GetJobsStatus(jobIDs []string) ([]Job, error)

GetJobsStatus Returns the status of a list of jobs

func (*Handler) GetRunningJobs added in v0.2.0

func (handler *Handler) GetRunningJobs() ([]*Job, error)

func (*Handler) UpdateK8s

func (handler *Handler) UpdateK8s(id string, k8s string, conf string) error

UpdateK8s Updates a job with its k8s id

func (*Handler) UpdateStatus

func (handler *Handler) UpdateStatus(id string, status api.JobStatusEnum, errorMsg string) error

UpdateStatus Updates the status of a job

type Job

type Job struct {
	JobID       string `gorm:"primaryKey"`
	Secret      string
	K8sID       string `gorm:"index"`
	Updated     int64  `gorm:"autoUpdateTime"` // Use unix milli seconds as updating time
	Created     int64  `gorm:"autoCreateTime"` // Use unix seconds as creating time
	Status      string `gorm:"index"`
	DataBucket  string
	FastaKey    string
	ProdigalKey string
	RepliconKey string
	ResultKey   string
	Error       string
	ExpiryDate  time.Time
	ConfString  string
}

Job The database model for a bakta job

type UploadFileType

type UploadFileType string

UploadFileType type of file to upload

const (
	//Fasta fasta file
	Fasta UploadFileType = "fasta"
	//Replicon replicon file as tsv, see bakta documentation for further details
	Replicon UploadFileType = "replicons"
	//Prodigal Prodigal training file, see bakta documentation for further details
	Prodigal UploadFileType = "prodigal"
)

Jump to

Keyboard shortcuts

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