worker

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatePostgresTable represents a query to create the Postgres workers table.
	CreatePostgresTable = `` /* 491-byte string literal not displayed */

	// CreateSqliteTable represents a query to create the Sqlite workers table.
	CreateSqliteTable = `` /* 481-byte string literal not displayed */

)
View Source
const (
	// CreateHostnameAddressIndex represents a query to create an
	// index on the workers table for the hostname and address columns.
	CreateHostnameAddressIndex = `
CREATE INDEX
IF NOT EXISTS
workers_hostname_address
ON workers (hostname, address);
`
)

Variables

This section is empty.

Functions

func New

func New(opts ...EngineOpt) (*engine, error)

New creates and returns a Vela service for integrating with workers in the database.

Types

type EngineOpt

type EngineOpt func(*engine) error

EngineOpt represents a configuration option to initialize the database engine for Workers.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for Workers.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Workers.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

WithSkipCreation sets the skip creation logic in the database engine for Workers.

type WorkerInterface added in v0.20.0

type WorkerInterface interface {

	// CreateWorkerIndexes defines a function that creates the indexes for the workers table.
	CreateWorkerIndexes() error
	// CreateWorkerTable defines a function that creates the workers table.
	CreateWorkerTable(string) error

	// CountWorkers defines a function that gets the count of all workers.
	CountWorkers() (int64, error)
	// CreateWorker defines a function that creates a new worker.
	CreateWorker(*library.Worker) error
	// DeleteWorker defines a function that deletes an existing worker.
	DeleteWorker(*library.Worker) error
	// GetWorker defines a function that gets a worker by ID.
	GetWorker(int64) (*library.Worker, error)
	// GetWorkerForHostname defines a function that gets a worker by hostname.
	GetWorkerForHostname(string) (*library.Worker, error)
	// ListWorkers defines a function that gets a list of all workers.
	ListWorkers() ([]*library.Worker, error)
	// UpdateWorker defines a function that updates an existing worker.
	UpdateWorker(*library.Worker) error
}

WorkerInterface represents the Vela interface for worker functions with the supported Database backends.

Jump to

Keyboard shortcuts

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