rendering

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

Documentation

Overview

Package rendering is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrConcurrentLimitReached = errors.New("rendering concurrent limit reached")
View Source
var ErrInvalidPluginVersion = errors.New("invalid plugin version")
View Source
var ErrRenderUnavailable = errors.New("rendering plugin not available")
View Source
var ErrServerTimeout = errutil.NewBase(errutil.StatusUnknown, "rendering.serverTimeout", errutil.WithPublicMessage("error trying to connect to image-renderer service"))
View Source
var ErrTimeout = errors.New("timeout error - you can set timeout in seconds with &timeout url parameter")
View Source
var ErrUnknownCapability = errors.New("unknown capability")

Functions

This section is empty.

Types

type AuthOpts

type AuthOpts struct {
	OrgID   int64
	UserID  int64
	OrgRole org.RoleType
}

type CSVOpts

type CSVOpts struct {
	TimeoutOpts
	AuthOpts
	Path            string
	Encoding        string
	Timezone        string
	ConcurrentLimit int
	Headers         map[string][]string
}

type Capability

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

type CapabilityName

type CapabilityName string
const (
	ScalingDownImages CapabilityName = "ScalingDownImages"
	FullHeightImages  CapabilityName = "FullHeightImages"
	SvgSanitization   CapabilityName = "SvgSanitization"
)

type CapabilitySupportRequestResult

type CapabilitySupportRequestResult struct {
	IsSupported      bool
	SemverConstraint string
}

type ErrorOpts

type ErrorOpts struct {
	// ErrorConcurrentLimitReached returns an ErrConcurrentLimitReached
	// error instead of a rendering limit exceeded image.
	ErrorConcurrentLimitReached bool
	// ErrorRenderUnavailable returns an ErrRunderUnavailable error
	// instead of a rendering unavailable image.
	ErrorRenderUnavailable bool
}

type MockService

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

MockService is a mock of Service interface.

func NewMockService

func NewMockService(ctrl *gomock.Controller) *MockService

NewMockService creates a new mock instance.

func (*MockService) CreateRenderingSession

func (m *MockService) CreateRenderingSession(arg0 context.Context, arg1 AuthOpts, arg2 SessionOpts) (Session, error)

CreateRenderingSession mocks base method.

func (*MockService) EXPECT

func (m *MockService) EXPECT() *MockServiceMockRecorder

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

func (*MockService) GetRenderUser

func (m *MockService) GetRenderUser(arg0 context.Context, arg1 string) (*RenderUser, bool)

GetRenderUser mocks base method.

func (*MockService) HasCapability

HasCapability mocks base method.

func (*MockService) IsAvailable

func (m *MockService) IsAvailable(arg0 context.Context) bool

IsAvailable mocks base method.

func (*MockService) Render

func (m *MockService) Render(arg0 context.Context, arg1 Opts, arg2 Session) (*RenderResult, error)

Render mocks base method.

func (*MockService) RenderCSV

func (m *MockService) RenderCSV(arg0 context.Context, arg1 CSVOpts, arg2 Session) (*RenderCSVResult, error)

RenderCSV mocks base method.

func (*MockService) RenderErrorImage

func (m *MockService) RenderErrorImage(arg0 models.Theme, arg1 error) (*RenderResult, error)

RenderErrorImage mocks base method.

func (*MockService) SanitizeSVG

func (m *MockService) SanitizeSVG(arg0 context.Context, arg1 *SanitizeSVGRequest) (*SanitizeSVGResponse, error)

SanitizeSVG mocks base method.

func (*MockService) Version

func (m *MockService) Version() string

Version mocks base method.

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService.

func (*MockServiceMockRecorder) CreateRenderingSession

func (mr *MockServiceMockRecorder) CreateRenderingSession(arg0, arg1, arg2 interface{}) *gomock.Call

CreateRenderingSession indicates an expected call of CreateRenderingSession.

func (*MockServiceMockRecorder) GetRenderUser

func (mr *MockServiceMockRecorder) GetRenderUser(arg0, arg1 interface{}) *gomock.Call

GetRenderUser indicates an expected call of GetRenderUser.

func (*MockServiceMockRecorder) HasCapability

func (mr *MockServiceMockRecorder) HasCapability(arg0, arg1 interface{}) *gomock.Call

HasCapability indicates an expected call of HasCapability.

func (*MockServiceMockRecorder) IsAvailable

func (mr *MockServiceMockRecorder) IsAvailable(arg0 interface{}) *gomock.Call

IsAvailable indicates an expected call of IsAvailable.

func (*MockServiceMockRecorder) Render

func (mr *MockServiceMockRecorder) Render(arg0, arg1, arg2 interface{}) *gomock.Call

Render indicates an expected call of Render.

func (*MockServiceMockRecorder) RenderCSV

func (mr *MockServiceMockRecorder) RenderCSV(arg0, arg1, arg2 interface{}) *gomock.Call

RenderCSV indicates an expected call of RenderCSV.

func (*MockServiceMockRecorder) RenderErrorImage

func (mr *MockServiceMockRecorder) RenderErrorImage(arg0, arg1 interface{}) *gomock.Call

RenderErrorImage indicates an expected call of RenderErrorImage.

func (*MockServiceMockRecorder) SanitizeSVG

func (mr *MockServiceMockRecorder) SanitizeSVG(arg0, arg1 interface{}) *gomock.Call

SanitizeSVG indicates an expected call of SanitizeSVG.

func (*MockServiceMockRecorder) Version

func (mr *MockServiceMockRecorder) Version() *gomock.Call

Version indicates an expected call of Version.

type Opts

type Opts struct {
	TimeoutOpts
	AuthOpts
	ErrorOpts
	Width             int
	Height            int
	Path              string
	Encoding          string
	Timezone          string
	ConcurrentLimit   int
	DeviceScaleFactor float64
	Headers           map[string][]string
	Theme             models.Theme
}

type RenderCSVResult

type RenderCSVResult struct {
	FilePath string
	FileName string
}

type RenderResult

type RenderResult struct {
	FilePath string
}

type RenderType

type RenderType string
const (
	RenderCSV RenderType = "csv"
	RenderPNG RenderType = "png"
)

type RenderUser

type RenderUser struct {
	OrgID   int64  `json:"org_id"`
	UserID  int64  `json:"user_id"`
	OrgRole string `json:"org_role"`
}

type RenderingService

type RenderingService struct {
	Cfg *setting.Cfg

	RemoteCacheService    *remotecache.RemoteCache
	RendererPluginManager plugins.RendererManager
	// contains filtered or unexported fields
}

func (*RenderingService) CreateRenderingSession

func (rs *RenderingService) CreateRenderingSession(ctx context.Context, opts AuthOpts, sessionOpts SessionOpts) (Session, error)

func (*RenderingService) GetRenderUser

func (rs *RenderingService) GetRenderUser(ctx context.Context, key string) (*RenderUser, bool)

func (*RenderingService) HasCapability

func (*RenderingService) IsAvailable

func (rs *RenderingService) IsAvailable(ctx context.Context) bool

func (*RenderingService) Render

func (rs *RenderingService) Render(ctx context.Context, opts Opts, session Session) (*RenderResult, error)

func (*RenderingService) RenderCSV

func (rs *RenderingService) RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error)

func (*RenderingService) RenderErrorImage

func (rs *RenderingService) RenderErrorImage(theme models.Theme, err error) (*RenderResult, error)

func (*RenderingService) Run

func (rs *RenderingService) Run(ctx context.Context) error

func (*RenderingService) SanitizeSVG

func (*RenderingService) Version

func (rs *RenderingService) Version() string

type SanitizeSVGRequest

type SanitizeSVGRequest struct {
	Filename string
	Content  []byte
}

type SanitizeSVGResponse

type SanitizeSVGResponse struct {
	Sanitized []byte
}

type Service

type Service interface {
	IsAvailable(ctx context.Context) bool
	Version() string
	Render(ctx context.Context, opts Opts, session Session) (*RenderResult, error)
	RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error)
	RenderErrorImage(theme models.Theme, error error) (*RenderResult, error)
	GetRenderUser(ctx context.Context, key string) (*RenderUser, bool)
	HasCapability(ctx context.Context, capability CapabilityName) (CapabilitySupportRequestResult, error)
	CreateRenderingSession(ctx context.Context, authOpts AuthOpts, sessionOpts SessionOpts) (Session, error)
	SanitizeSVG(ctx context.Context, req *SanitizeSVGRequest) (*SanitizeSVGResponse, error)
}

type Session

type Session interface {
	Dispose(ctx context.Context)
	// contains filtered or unexported methods
}

type SessionOpts

type SessionOpts struct {
	Expiry                     time.Duration
	RefreshExpiryOnEachRequest bool
}

type TimeoutOpts

type TimeoutOpts struct {
	Timeout                  time.Duration // Timeout param passed to image-renderer service
	RequestTimeoutMultiplier time.Duration // RequestTimeoutMultiplier used for plugin/HTTP request context timeout
}

Jump to

Keyboard shortcuts

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