renderer

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrUseSpec = "use-spec"

	AttrAllowExpired = "allow-expired"
	AttrCachedFile   = "cached-file"

	AttrCacheData = "cache-data"
)

Variables

This section is empty.

Functions

func HandleRenderingRequestWithRemoteFetch added in v0.5.0

func HandleRenderingRequestWithRemoteFetch(
	cache *cache.TwoTierCache,
	obj cache.IdentifiableObject,
	fetchRemote cache.RemoteCacheRefreshFunc,
	attributes []dukkha.RendererAttribute,
) ([]byte, error)

func ResolveInputSpec added in v0.7.0

func ResolveInputSpec(rc rs.RenderingHandler, rawBytes []byte, out rs.Field) (rs.Field, error)

Types

type BaseInMemCachedRenderer added in v0.7.0

type BaseInMemCachedRenderer struct {
	rs.BaseField `yaml:"-"`

	BaseRenderer `yaml:",inline"`

	CacheConfig CacheConfig `yaml:"cache"`

	// CacheFS provided when calling Init
	CacheFS *fshelper.OSFS `yaml:"-"`

	// Cache is the in memory cache, nil if not enabled in CacheConfig
	Cache *cache.Cache `yaml:"-"`
}

func (*BaseInMemCachedRenderer) Init added in v0.7.0

func (d *BaseInMemCachedRenderer) Init(cacheFS *fshelper.OSFS) error

type BaseRenderer added in v0.7.0

type BaseRenderer struct {
	rs.BaseField `yaml:"-"`

	RendererAlias string `yaml:"alias"`

	DefaultAttributes []dukkha.RendererAttribute `yaml:"attributes"`
}

func (*BaseRenderer) Alias added in v0.7.0

func (r *BaseRenderer) Alias() string

func (*BaseRenderer) Attributes added in v0.7.0

func (r *BaseRenderer) Attributes(override []dukkha.RendererAttribute) []dukkha.RendererAttribute

func (*BaseRenderer) Init added in v0.7.0

func (r *BaseRenderer) Init(cacheFS *fshelper.OSFS) error

type BaseTwoTierCachedRenderer added in v0.7.0

type BaseTwoTierCachedRenderer struct {
	rs.BaseField `yaml:"-"`

	BaseRenderer `yaml:",inline"`

	CacheConfig CacheConfig `yaml:"cache"`

	// Cache is always not nil after Init
	Cache *cache.TwoTierCache `yaml:"-"`
}

func (*BaseTwoTierCachedRenderer) Init added in v0.7.0

func (d *BaseTwoTierCachedRenderer) Init(cacheFS *fshelper.OSFS) error

type CacheConfig

type CacheConfig struct {
	rs.BaseField `yaml:"-"`

	// Enabled activates data caching
	//
	// * for renderers reading data directly from local disk (e.g. file):
	//     will cache content in memory with size limit applied
	// * for renderers doing remote fetch (e.g. http, git, af):
	//     will cache data on local disk first (cache size limiting is not effective at this time)
	// 	   then cache data in memory with size limit applied
	//
	// Defaults to `false`
	Enabled bool `yaml:"enabled"`

	// MaxItemSize is the maximum size limit an item can be cached in memory
	//
	// Format: <number><unit>
	// 	where unit can be one of: [ , B, KB, MB, GB, TB, PB]
	//
	// Defaults to `0` (no size limit for single item)
	MaxItemSize utils.Size `yaml:"max_item_size"`

	// Size limits maximum in memory size of cached content
	//
	// Format: <number><unit>
	// 	where unit can be one of: [ , B, KB, MB, GB, TB, PB]
	//
	// Defaults to `0` (no size limit)
	Size utils.Size `yaml:"size"`

	// Timeout is the data caching duration
	//
	// if caching is enabled and this option is set to 0:
	//  in memory cache will never expire during runtime
	// 	file cache for remote content will expire immediately (probably that's not what you want)
	//
	// Defaults to `0`
	Timeout time.Duration `yaml:"timeout"`
}

CacheConfig is the config for data caching

Directories

Path Synopsis
Package af (archivefile) provides a renderer generating value by extracting file content from archive directly
Package af (archivefile) provides a renderer generating value by extracting file content from archive directly

Jump to

Keyboard shortcuts

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