database

package
v0.2.9-beta.28 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const COLLECTIONNAME = "jobs"

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

type Handler

type Handler struct {
	DB             *mongo.Client
	Collection     *mongo.Collection
	BaseKey        string
	UserDataBucket string
	DBBucket       string
	ExpiryTime     int64
}

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(repliconTypeAPI api.RepliconTableType) (*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) GetJobs

func (handler *Handler) GetJobs(jobIDs []*api.JobAuth) ([]Job, error)

GetJobsStatus Returns the status of a list of jobs

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, isDeleted bool) error

UpdateStatus Updates the status of a job

type Job

type Job struct {
	JobID       string
	Secret      string
	K8sID       string
	Updated     primitive.Timestamp
	Created     primitive.Timestamp
	Status      string
	DataBucket  string
	FastaKey    string
	ProdigalKey string
	RepliconKey string
	ResultKey   string
	Error       string
	ExpiryDate  primitive.Timestamp
	ConfString  string
	IsDeleted   bool
	// contains filtered or unexported fields
}

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
	RepliconCSV UploadFileType = "repliconcsv"
	RepliconTSV UploadFileType = "replicontsv"
	//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