worker

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 8 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 WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context 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(context.Context) error
	// CreateWorkerTable defines a function that creates the workers table.
	CreateWorkerTable(context.Context, string) error

	// CountWorkers defines a function that gets the count of all workers.
	CountWorkers(context.Context) (int64, error)
	// CreateWorker defines a function that creates a new worker.
	CreateWorker(context.Context, *library.Worker) (*library.Worker, error)
	// DeleteWorker defines a function that deletes an existing worker.
	DeleteWorker(context.Context, *library.Worker) error
	// GetWorker defines a function that gets a worker by ID.
	GetWorker(context.Context, int64) (*library.Worker, error)
	// GetWorkerForHostname defines a function that gets a worker by hostname.
	GetWorkerForHostname(context.Context, string) (*library.Worker, error)
	// ListWorkers defines a function that gets a list of all workers.
	ListWorkers(context.Context, string, int64, int64) ([]*library.Worker, error)
	// UpdateWorker defines a function that updates an existing worker.
	UpdateWorker(context.Context, *library.Worker) (*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