rendering

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 28 Imported by: 277

Documentation

Index

Constants

View Source
const ServiceName = "RenderingService"

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 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 models.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"
)

type CapabilitySupportRequestResult

type CapabilitySupportRequestResult struct {
	IsSupported      bool
	SemverConstraint string
}

type Opts

type Opts struct {
	TimeoutOpts
	AuthOpts
	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
	UserID  int64
	OrgRole string
}

type RenderingService

type RenderingService struct {
	Cfg                   *setting.Cfg
	RemoteCacheService    *remotecache.RemoteCache
	RendererPluginManager plugins.RendererManager
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(cfg *setting.Cfg, remoteCache *remotecache.RemoteCache, rm plugins.RendererManager) (*RenderingService, error)

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 (rs *RenderingService) HasCapability(capability CapabilityName) (CapabilitySupportRequestResult, error)

func (*RenderingService) IsAvailable

func (rs *RenderingService) IsAvailable() 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) Version

func (rs *RenderingService) Version() string

type Service

type Service interface {
	IsAvailable() 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(capability CapabilityName) (CapabilitySupportRequestResult, error)
	CreateRenderingSession(ctx context.Context, authOpts AuthOpts, sessionOpts SessionOpts) (Session, 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