layers

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigMatchesName added in v0.13.0

func ConfigMatchesName(rawConfig config.LayerConfig, errorMessages config.ErrorMessages, layerName string) bool

For callers working from raw config before layers are built. An unparseable pattern matches nothing; construction reports it

func ConstructProvider added in v0.4.0

func ConstructProvider(rawConfig map[string]interface{}, deps layer.ProviderDeps) (layer.Provider, error)

Types

type CacheControlFacts added in v0.13.0

type CacheControlFacts struct {
	// The layer keeps no tiles itself, which argues against downstream caches keeping them
	Uncacheable bool
	// Tiles appear to vary by requester, so a shared cache must not hand one caller's tile to the next
	PerIdentity bool
	// Zero means the layer's cache enforces no TTL
	TTL time.Duration
}

What a layer's config says about downstream caching, resolved at construction. The server turns these into headers

type Layer

type Layer struct {
	ID             string
	Pattern        []layerSegment
	ParamValidator map[string]*regexp.Regexp
	ParamMap       map[string]paramMapping // Keyed by placeholder name
	Config         config.LayerConfig
	Provider       layer.Provider
	Cache          cache.Cache
	ErrorMessages  config.ErrorMessages
	DataType       config.DataType // The version from the config with auto-resolution applied

	CacheControl CacheControlFacts // What this layer's cache and provider say about caching its tiles downstream
	// contains filtered or unexported fields
}

func ConstructLayer

func ConstructLayer(ctx context.Context, rawConfig config.LayerConfig, defaultClientConfig config.ClientConfig, layerCache cache.Cache, errorMessages config.ErrorMessages, layerGroup *LayerGroup, secreter secret.Secreter, datastoreRegistry *datastores.Registry, clientTransport func(config.ClientConfig) (http.RoundTripper, error)) (*Layer, error)

func (*Layer) BuildTileJSON added in v0.13.0

func (l *Layer) BuildTileJSON(name string, tilesURLs []string, allowedArea *pkg.Bounds) TileJSONDocument

func (*Layer) CheckZoomBounds added in v0.13.0

func (l *Layer) CheckZoomBounds(tileRequest pkg.TileRequest) error

Called before the cache lookup so a cached tile can't bypass a zoom limit added later

func (*Layer) IsPattern added in v0.13.0

func (l *Layer) IsPattern() bool

True when a pattern distinct from the ID means there's no single tile URL, so TileJSON needs Config.Examples

func (*Layer) MatchesName added in v0.13.0

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

func (*Layer) Metadata added in v0.13.0

func (l *Layer) Metadata() ResolvedMetadata

func (*Layer) RenderTileNoCache

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

func (*Layer) TileJSONEligible added in v0.13.0

func (l *Layer) TileJSONEligible() bool

func (*Layer) TileJSONNames added in v0.13.0

func (l *Layer) TileJSONNames() []string

type LayerGroup added in v0.4.0

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

func ConstructLayerGroup added in v0.4.0

func ConstructLayerGroup(ctx context.Context, cfg config.Config, cacheRegistry *caches.CacheRegistry, secreter secret.Secreter, datastoreRegistry *datastores.Registry, clientTransport func(config.ClientConfig) (http.RoundTripper, error)) (*LayerGroup, error)

func (*LayerGroup) CheckAccess added in v0.14.0

func (lg *LayerGroup) CheckAccess(ctx context.Context, tileRequest pkg.TileRequest) (*Layer, error)

The checks RenderTile makes before consulting the cache, for callers that act between the two

func (*LayerGroup) Close added in v0.13.0

func (lg *LayerGroup) Close(ctx context.Context) error

Most notably custom providers

func (*LayerGroup) FindLayer added in v0.4.0

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

func (*LayerGroup) HasLayer added in v0.13.0

func (lg *LayerGroup) HasLayer(ctx context.Context, layerName string) bool

func (*LayerGroup) Layers added in v0.13.0

func (lg *LayerGroup) Layers() []*Layer

func (*LayerGroup) ListLayerIDs added in v0.13.0

func (lg *LayerGroup) ListLayerIDs() []string

func (*LayerGroup) PurgeTile added in v0.13.0

func (lg *LayerGroup) PurgeTile(ctx context.Context, tileRequest pkg.TileRequest) (bool, error)

Resolves the layer and cacheversion like RenderTile so it removes the entry a render would read

func (*LayerGroup) RenderTile added in v0.4.0

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

func (*LayerGroup) RenderTileNoCache added in v0.4.0

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

func (*LayerGroup) WaitForCacheWrites added in v0.13.0

func (lg *LayerGroup) WaitForCacheWrites(ctx context.Context) error

type Limits added in v0.13.0

type Limits struct {
	MinZoom *int
	MaxZoom *int
	Bounds  config.BoundsConfig
}

The operator's restrictions on a layer, and the only metadata enforced on requests

type ProviderWrapper added in v0.13.0

type ProviderWrapper struct {
	Name     string
	Provider layer.Provider
	// contains filtered or unexported fields
}

Adds tracing spans around every provider. Always used since OTEL no-ops when telemetry is disabled

func (ProviderWrapper) Close added in v0.13.0

func (t ProviderWrapper) Close(ctx context.Context) error

Closes the whole tree beneath, so the wrapper is deliberately not a Parent

func (ProviderWrapper) GenerateTile added in v0.13.0

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

func (ProviderWrapper) Metadata added in v0.13.0

func (t ProviderWrapper) Metadata() layer.Description

func (ProviderWrapper) PreAuth added in v0.13.0

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

type ResolvedMetadata added in v0.13.0

type ResolvedMetadata struct {
	Limits     Limits
	Advertised layer.Description // Always within Limits
}

Computed once at construction

func (ResolvedMetadata) ForRequest added in v0.13.0

func (r ResolvedMetadata) ForRequest(allowedArea *pkg.Bounds) layer.Description

Narrows the advertised metadata to the area a restricted caller may access

type TileJSONDocument added in v0.13.0

type TileJSONDocument struct {
	TileJSON string    `json:"tilejson"` // Version
	Name     string    `json:"name"`
	Tiles    []string  `json:"tiles"`
	MinZoom  int       `json:"minzoom"`
	MaxZoom  int       `json:"maxzoom"`
	Bounds   []float64 `json:"bounds"`
	// Not in the TileJSON spec. MapLibre GL JS reads it to know a source serves MapLibre Tiles
	Encoding string `json:"encoding,omitempty"`
	config.TileJSONMetadata
}

Per the TileJSON 3.0.0 spec: https://github.com/mapbox/tilejson-spec/tree/master/3.0.0

Jump to

Keyboard shortcuts

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