layer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProvider

func RegisterProvider(reg ProviderRegistration)

func RegisteredProviderNames

func RegisteredProviderNames() []string

Types

type Layer

type Layer struct {
	ID             string
	Pattern        []layerSegment
	ParamValidator map[string]*regexp.Regexp
	Config         config.LayerConfig
	Provider       Provider
	Cache          cache.Cache
	ErrorMessages  config.ErrorMessages
	// contains filtered or unexported fields
}

func ConstructLayer

func ConstructLayer(rawConfig config.LayerConfig, defaultClientConfig config.ClientConfig, errorMessages config.ErrorMessages, layerGroup *LayerGroup, secreter secret.Secreter) (*Layer, error)

func (*Layer) MatchesName

func (l *Layer) MatchesName(ctx *pkg.RequestContext, layerName string) bool

func (*Layer) RenderTileNoCache

func (l *Layer) RenderTileNoCache(ctx *pkg.RequestContext, tileRequest pkg.TileRequest) (*pkg.Image, error)

type LayerGroup

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

func ConstructLayerGroup

func ConstructLayerGroup(cfg config.Config, cache cache.Cache, secreter secret.Secreter) (*LayerGroup, error)

func (LayerGroup) FindLayer

func (lg LayerGroup) FindLayer(ctx *pkg.RequestContext, layerName string) *Layer

func (LayerGroup) ListLayerIDs

func (lg LayerGroup) ListLayerIDs() []string

func (LayerGroup) RenderTile

func (lg LayerGroup) RenderTile(ctx *pkg.RequestContext, tileRequest pkg.TileRequest) (*pkg.Image, error)

func (*LayerGroup) RenderTileNoCache

func (lg *LayerGroup) RenderTileNoCache(ctx *pkg.RequestContext, tileRequest pkg.TileRequest) (*pkg.Image, error)

type Provider

type Provider interface {
	// Performs authentication before tiles are ever generated. The calling code ensures this is only called once at a time and only when needed
	// based on the expiration in layergroup.ProviderContext and when an AuthError is returned from GenerateTile
	PreAuth(ctx *pkg.RequestContext, providerContext ProviderContext) (ProviderContext, error)
	GenerateTile(ctx *pkg.RequestContext, providerContext ProviderContext, tileRequest pkg.TileRequest) (*pkg.Image, error)
}

func ConstructProvider

func ConstructProvider(rawConfig map[string]interface{}, clientConfig config.ClientConfig, errorMessages config.ErrorMessages, layerGroup *LayerGroup) (Provider, error)

type ProviderContext

type ProviderContext struct {
	AuthBypass     bool                   // If true, avoids ever calling preauth again
	AuthExpiration time.Time              // When next to trigger preauth
	AuthToken      string                 // The main auth token that comes back from the preauth and is used by the generate method. Details are up to the provider
	Other          map[string]interface{} // A generic holder in cases where a provider needs extra storage - for instance Blend which needs Context for child providers
}

type ProviderRegistration

type ProviderRegistration interface {
	Name() string
	Initialize(config any, clientConfig config.ClientConfig, errorMessages config.ErrorMessages, layerGroup *LayerGroup) (Provider, error)
	InitializeConfig() any
}

func RegisteredProvider

func RegisteredProvider(name string) (ProviderRegistration, bool)

Jump to

Keyboard shortcuts

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