service

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: 9 Imported by: 0

Documentation

Index

Constants

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

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

)

Variables

This section is empty.

Functions

func New

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

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

Types

type EngineOpt

type EngineOpt func(*engine) error

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

func WithClient

func WithClient(client *gorm.DB) EngineOpt

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

func WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Services.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

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

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

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

type ServiceInterface

type ServiceInterface interface {

	// CreateServiceTable defines a function that creates the services table.
	CreateServiceTable(context.Context, string) error

	// CleanServices defines a function that sets running or pending services to error status before a given created time.
	CleanServices(context.Context, string, int64) (int64, error)
	// CountServices defines a function that gets the count of all services.
	CountServices(context.Context) (int64, error)
	// CountServicesForBuild defines a function that gets the count of services by build ID.
	CountServicesForBuild(context.Context, *library.Build, map[string]interface{}) (int64, error)
	// CreateService defines a function that creates a new service.
	CreateService(context.Context, *library.Service) (*library.Service, error)
	// DeleteService defines a function that deletes an existing service.
	DeleteService(context.Context, *library.Service) error
	// GetService defines a function that gets a service by ID.
	GetService(context.Context, int64) (*library.Service, error)
	// GetServiceForBuild defines a function that gets a service by number and build ID.
	GetServiceForBuild(context.Context, *library.Build, int) (*library.Service, error)
	// ListServices defines a function that gets a list of all services.
	ListServices(context.Context) ([]*library.Service, error)
	// ListServicesForBuild defines a function that gets a list of services by build ID.
	ListServicesForBuild(context.Context, *library.Build, map[string]interface{}, int, int) ([]*library.Service, int64, error)
	// ListServiceImageCount defines a function that gets a list of all service images and the count of their occurrence.
	ListServiceImageCount(context.Context) (map[string]float64, error)
	// ListServiceStatusCount defines a function that gets a list of all service statuses and the count of their occurrence.
	ListServiceStatusCount(context.Context) (map[string]float64, error)
	// UpdateService defines a function that updates an existing service.
	UpdateService(context.Context, *library.Service) (*library.Service, error)
}

ServiceInterface represents the Vela interface for service functions with the supported Database backends.

Jump to

Keyboard shortcuts

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