service

package
v0.27.4 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 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 = `` /* 472-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

This section is empty.

Types

type Engine added in v0.27.0

type Engine struct {
	// contains filtered or unexported fields
}

Engine represents the service functionality that implements the ServiceInterface interface.

func New

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

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

func (*Engine) CleanServices added in v0.27.0

func (e *Engine) CleanServices(ctx context.Context, msg string, before int64) (int64, error)

CleanServices updates services to an error with a created timestamp prior to a defined moment.

func (*Engine) CountServices added in v0.27.0

func (e *Engine) CountServices(ctx context.Context) (int64, error)

CountServices gets the count of all services from the database.

func (*Engine) CountServicesForBuild added in v0.27.0

func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error)

CountServicesForBuild gets the count of services by build ID from the database.

func (*Engine) CreateService added in v0.27.0

func (e *Engine) CreateService(ctx context.Context, s *api.Service) (*api.Service, error)

CreateService creates a new service in the database.

func (*Engine) CreateServiceTable added in v0.27.0

func (e *Engine) CreateServiceTable(ctx context.Context, driver string) error

CreateServiceTable creates the services table in the database.

func (*Engine) DeleteService added in v0.27.0

func (e *Engine) DeleteService(ctx context.Context, s *api.Service) error

DeleteService deletes an existing service from the database.

func (*Engine) GetService added in v0.27.0

func (e *Engine) GetService(ctx context.Context, id int64) (*api.Service, error)

GetService gets a service by ID from the database.

func (*Engine) GetServiceForBuild added in v0.27.0

func (e *Engine) GetServiceForBuild(ctx context.Context, b *api.Build, number int32) (*api.Service, error)

GetServiceForBuild gets a service by number and build ID from the database.

func (*Engine) ListServiceImageCount added in v0.27.0

func (e *Engine) ListServiceImageCount(ctx context.Context) (map[string]float64, error)

ListServiceImageCount gets a list of all service images and the count of their occurrence from the database.

func (*Engine) ListServiceStatusCount added in v0.27.0

func (e *Engine) ListServiceStatusCount(ctx context.Context) (map[string]float64, error)

ListServiceStatusCount gets a list of all service statuses and the count of their occurrence from the database.

func (*Engine) ListServices added in v0.27.0

func (e *Engine) ListServices(ctx context.Context) ([]*api.Service, error)

ListServices gets a list of all services from the database.

func (*Engine) ListServicesForBuild added in v0.27.0

func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Service, error)

ListServicesForBuild gets a list of all services from the database.

func (*Engine) UpdateService added in v0.27.0

func (e *Engine) UpdateService(ctx context.Context, s *api.Service) (*api.Service, error)

UpdateService updates an existing service in the database.

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, *api.Build, map[string]interface{}) (int64, error)
	// CreateService defines a function that creates a new service.
	CreateService(context.Context, *api.Service) (*api.Service, error)
	// DeleteService defines a function that deletes an existing service.
	DeleteService(context.Context, *api.Service) error
	// GetService defines a function that gets a service by ID.
	GetService(context.Context, int64) (*api.Service, error)
	// GetServiceForBuild defines a function that gets a service by number and build ID.
	GetServiceForBuild(context.Context, *api.Build, int32) (*api.Service, error)
	// ListServices defines a function that gets a list of all services.
	ListServices(context.Context) ([]*api.Service, error)
	// ListServicesForBuild defines a function that gets a list of services by build ID.
	ListServicesForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Service, 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, *api.Service) (*api.Service, error)
}

Jump to

Keyboard shortcuts

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