Documentation
¶
Index ¶
- func CloseProvider(ctx context.Context, p Provider) error
- func RegisterProvider(reg ProviderRegistration)
- func RegisteredProviderNames() []string
- type BoundsWrapper
- type Description
- type LayerGroup
- type MetadataProvider
- type Parent
- type Provider
- type ProviderContext
- type ProviderDeps
- type ProviderRegistration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseProvider ¶ added in v0.13.0
Also closes every provider nested beneath it
func RegisterProvider ¶
func RegisterProvider(reg ProviderRegistration)
func RegisteredProviderNames ¶
func RegisteredProviderNames() []string
Types ¶
type BoundsWrapper ¶ added in v0.13.0
type BoundsWrapper interface {
WrapBounds(inner Provider, bounds pkg.Bounds, deps ProviderDeps) (Provider, error)
}
Lets a ProviderRegistration restrict an already built provider to a layer's bounds
type Description ¶ added in v0.13.0
type Description struct {
DataType config.DataType
MinZoom *int
MaxZoom *int
Bounds config.BoundsConfig
config.TileJSONMetadata
}
What a provider knows about its tiles. Advertised to clients but never enforced
func DescribeTree ¶ added in v0.13.0
func DescribeTree(p Provider) Description
A MetadataProvider speaks for itself, a single child passes through, and several are unioned
func Union ¶ added in v0.13.0
func Union(descriptions ...Description) Description
A field is unknown if any description leaves it unknown, since that source could cover anything
func (Description) Clip ¶ added in v0.13.0
func (d Description) Clip(bounds config.BoundsConfig) Description
Drops a center that falls outside the bounds
func (Description) ZoomRange ¶ added in v0.13.0
func (d Description) ZoomRange() (int, int)
Unset ends are filled in
type LayerGroup ¶
type LayerGroup interface {
// Includes the layer's cache and permission checks
RenderTile(ctx context.Context, tileRequest pkg.TileRequest) (*pkg.Image, error)
// Skips the layer's cache
RenderTileNoCache(ctx context.Context, tileRequest pkg.TileRequest) (*pkg.Image, error)
// Includes names matching a layer pattern
HasLayer(ctx context.Context, layerName string) bool
ListLayerIDs() []string
}
Lets an entity render tiles from other layers
type MetadataProvider ¶ added in v0.13.0
type MetadataProvider interface {
Metadata() Description
}
Optional, for providers that can describe their own tiles
type Parent ¶ added in v0.13.0
type Parent interface {
Children() []Provider
}
Providers that nest others, so the tree can be walked generically
type Provider ¶
type Provider interface {
// Runs before tiles are generated. Called one at a time, when ProviderContext expires or GenerateTile returns an AuthError
PreAuth(ctx context.Context, providerContext ProviderContext) (ProviderContext, error)
GenerateTile(ctx context.Context, providerContext ProviderContext, tileRequest pkg.TileRequest) (*pkg.Image, 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 ProviderDeps ¶ added in v0.11.0
type ProviderDeps struct {
ClientConfig config.ClientConfig
ErrorMessages config.ErrorMessages
// Lets nesting providers reach sibling layers
LayerGroup LayerGroup
Datastores datastore.DatastoreRegistry
}
New dependencies are added as fields so the Initialize signature stays stable
type ProviderRegistration ¶
type ProviderRegistration interface {
Name() string
Initialize(config any, deps ProviderDeps) (Provider, error)
InitializeConfig() any
// Raster or vector. Nesting providers return config.DataTypeUnknown
DataType(config any) config.DataType
}
func RegisteredProvider ¶
func RegisteredProvider(name string) (ProviderRegistration, bool)