image

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package image is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

type CacheService interface {
	// Get returns the screenshot for the options or false if a screenshot with these
	// options does not exist.
	Get(ctx context.Context, k string) (models.Image, bool)
	// Set the screenshot for the options. If another screenshot exists with these
	// options then it will be replaced.
	Set(ctx context.Context, k string, image models.Image) error
}

CacheService caches images.

func NewInmemCacheService

func NewInmemCacheService(expiration time.Duration, r prometheus.Registerer) CacheService

type DeleteExpiredService

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

DeleteExpiredService is a service to delete expired images.

func ProvideDeleteExpiredService

func ProvideDeleteExpiredService(store *store.DBstore) *DeleteExpiredService

func (*DeleteExpiredService) DeleteExpired

func (s *DeleteExpiredService) DeleteExpired(ctx context.Context) (int64, error)

type ImageService

type ImageService interface {
	// NewImage returns a new image for the alert instance.
	NewImage(ctx context.Context, r *models.AlertRule) (*models.Image, error)
}

func NewScreenshotImageService

func NewScreenshotImageService(
	cache CacheService,
	limiter screenshot.RateLimiter,
	logger log.Logger,
	screenshots screenshot.ScreenshotService,
	screenshotTimeout time.Duration,
	store store.ImageStore,
	uploads *UploadingService) ImageService

NewScreenshotImageService returns a new ScreenshotImageService.

func NewScreenshotImageServiceFromCfg

func NewScreenshotImageServiceFromCfg(cfg *setting.Cfg, db *store.DBstore, ds dashboards.DashboardService,
	rs rendering.Service, r prometheus.Registerer) (ImageService, error)

NewScreenshotImageServiceFromCfg returns a new ScreenshotImageService from the configuration.

type InmemCacheService

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

InmemCacheService is an in-mem screenshot cache.

func (*InmemCacheService) Get

func (*InmemCacheService) Set

func (s *InmemCacheService) Set(_ context.Context, k string, screenshot models.Image) error

type MockCacheService

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

MockCacheService is a mock of CacheService interface.

func NewMockCacheService

func NewMockCacheService(ctrl *gomock.Controller) *MockCacheService

NewMockCacheService creates a new mock instance.

func (*MockCacheService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCacheService) Get

func (m *MockCacheService) Get(arg0 context.Context, arg1 string) (models.Image, bool)

Get mocks base method.

func (*MockCacheService) Set

func (m *MockCacheService) Set(arg0 context.Context, arg1 string, arg2 models.Image) error

Set mocks base method.

type MockCacheServiceMockRecorder

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

MockCacheServiceMockRecorder is the mock recorder for MockCacheService.

func (*MockCacheServiceMockRecorder) Get

func (mr *MockCacheServiceMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockCacheServiceMockRecorder) Set

func (mr *MockCacheServiceMockRecorder) Set(arg0, arg1, arg2 interface{}) *gomock.Call

Set indicates an expected call of Set.

type NoOpCacheService

type NoOpCacheService struct{}

func (*NoOpCacheService) Get

func (*NoOpCacheService) Set

type ScreenshotImageService

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

ScreenshotImageService takes screenshots of the alert rule and saves the image in the store. The image contains a unique token that can be passed as an annotation or label to the Alertmanager. This service cannot take screenshots of alert rules that are not associated with a dashboard panel.

func (*ScreenshotImageService) NewImage

NewImage returns a screenshot of the alert rule or an error.

The alert rule must be associated with a dashboard panel for a screenshot to be taken. If the alert rule does not have a Dashboard UID in its annotations, or the dashboard does not exist, a models.ErrNoDashboard error is returned. If the alert rule has a Dashboard UID and the dashboard exists, but does not have a Panel ID in its annotations then a models.ErrNoPanel error is returned.

type UploadingService

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

func (*UploadingService) Upload

func (s *UploadingService) Upload(ctx context.Context, image ngmodels.Image) (ngmodels.Image, error)

Upload uploads an image and returns a new image with the unmodified path and a URL. It returns the unmodified image on error.

Jump to

Keyboard shortcuts

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