postgres

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *sql.DB) error

Migrate ensures that the database has the current schema required for using any of the postgres storage

Types

type JobStore

type JobStore struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

JobStore stores jobs in a Postgres database

func NewJobStore

func NewJobStore(db *sql.DB) (*JobStore, error)

NewJobStore creates a new SQL job store

func (*JobStore) Find

func (s *JobStore) Find(ctx context.Context, filter []*v1.FilterExpression, order []*v1.OrderExpression, start, limit int) (slice []v1.JobStatus, total int, err error)

Find searches for jobs based on their annotations. If filter is empty no filter is applied.

func (*JobStore) GarbageCollect added in v0.2.1

func (s *JobStore) GarbageCollect(olderThan time.Duration) error

GarbageCollect removes all job entries older than the specified duration

func (*JobStore) Get

func (s *JobStore) Get(ctx context.Context, name string) (*v1.JobStatus, error)

Get retrieves a particular job bassd on its name.

func (*JobStore) GetJobSpec

func (s *JobStore) GetJobSpec(name string) (*v1.JobSpec, []byte, error)

GetJobSpec retrieves a particular job bassd on its name.

func (*JobStore) RegisterPrometheusMetrics

func (s *JobStore) RegisterPrometheusMetrics(reg prometheus.Registerer)

RegisterPrometheusMetrics registers metrics on the registerer with MustRegister

func (*JobStore) Store

func (s *JobStore) Store(ctx context.Context, job v1.JobStatus) error

Store stores job information in the store.

func (*JobStore) StoreJobSpec

func (s *JobStore) StoreJobSpec(name string, spec v1.JobSpec, data []byte) error

StoreJobSpec stores job information in the store.

type NumberGroup

type NumberGroup struct {
	DB *sql.DB
}

NumberGroup provides postgres backed number groups

func NewNumberGroup

func NewNumberGroup(db *sql.DB) (*NumberGroup, error)

NewNumberGroup creates a new SQL number group store

func (*NumberGroup) Latest

func (ngrp *NumberGroup) Latest(group string) (nr int, err error)

Latest returns the latest number of a particular number group.

func (*NumberGroup) Next

func (ngrp *NumberGroup) Next(group string) (nr int, err error)

Next returns the next number in the group.

Jump to

Keyboard shortcuts

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