layer

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 20 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, datastores *datastore.DatastoreRegistry) (*Layer, error)

func (*Layer) MatchesName

func (l *Layer) MatchesName(ctx context.Context, layerName string) bool

func (*Layer) RenderTileNoCache

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

type LayerGroup

type LayerGroup struct {
	DefaultCache cache.Cache
	// contains filtered or unexported fields
}

func ConstructLayerGroup

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

func (LayerGroup) FindLayer

func (lg LayerGroup) FindLayer(ctx context.Context, layerName string) *Layer

func (LayerGroup) ListLayerIDs

func (lg LayerGroup) ListLayerIDs() []string

func (LayerGroup) RenderTile

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

func (*LayerGroup) RenderTileNoCache

func (lg *LayerGroup) RenderTileNoCache(ctx context.Context, 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 context.Context, providerContext ProviderContext) (ProviderContext, error)
	GenerateTile(ctx context.Context, providerContext ProviderContext, tileRequest pkg.TileRequest) (*pkg.Image, error)
}

func ConstructProvider

func ConstructProvider(rawConfig map[string]interface{}, clientConfig config.ClientConfig, errorMessages config.ErrorMessages, layerGroup *LayerGroup, datastores *datastore.DatastoreRegistry) (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, datastores *datastore.DatastoreRegistry) (Provider, error)
	InitializeConfig() any
}

func RegisteredProvider

func RegisteredProvider(name string) (ProviderRegistration, bool)

type ProviderWrapper added in v0.6.0

type ProviderWrapper struct {
	Name     string
	Provider Provider
}

A struct that wraps all other providers in order to add in instrumentation, specifically child spans for tracing the flow between providers. This is used even when telemetry is disabled but OTEL handles no-op'ing in that case so performance impact is minimal

func (ProviderWrapper) GenerateTile added in v0.6.0

func (t ProviderWrapper) GenerateTile(ctx context.Context, providerContext ProviderContext, tileRequest pkg.TileRequest) (*pkg.Image, error)

func (ProviderWrapper) PreAuth added in v0.6.0

func (t ProviderWrapper) PreAuth(ctx context.Context, providerContext ProviderContext) (ProviderContext, error)

Jump to

Keyboard shortcuts

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