middleware

package
v0.0.0-...-1a91edc Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package middleware defines utility decorators of sources as such, middlewares implement the source interface

Index

Constants

View Source
const NestingLevel timedContextKey = "tckn"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key interface{}) (value interface{}, found bool)
	Set(key, value interface{})
}

Cache is the interface of cache implementations expected by the Cacher

type Cacher

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

Cacher is a tile retriever that uses a cache

func NewCacher

func NewCacher(cache Cache, fallback source.Source) Cacher

New yields a fresh new Cacher tile retriever

func (Cacher) GetTile

func (c Cacher) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Cacher) Name

func (Cacher) Name() string

type Delayer

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

Delayer is a tile source that returns the tile in at least n milliseconds where min < n < max useful for testing and simulations

func NewDelayer

func NewDelayer(min, max uint, src source.Source, name string) (*Delayer, error)

New yields a fresh new Delayer tile retriever

func (Delayer) GetTile

func (d Delayer) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Delayer) Name

func (d Delayer) Name() string

type Fallback

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

func NewFallback

func NewFallback(primary, fallback source.Source) *Fallback

func (Fallback) GetTile

func (f Fallback) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Fallback) Name

func (Fallback) Name() string

type Masker

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

func NewMasker

func NewMasker(primary, mask, replacement source.Source) *Masker

func (Masker) GetTile

func (f Masker) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Masker) Name

func (Masker) Name() string

type Resizer

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

func NewResizer

func NewResizer(source source.Source, sm SamplingMethod, targetSize uint16) *Resizer

func (Resizer) GetTile

func (r Resizer) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Resizer) Name

func (r Resizer) Name() string

type SamplingMethod

type SamplingMethod int
const (
	NearestNeighbor SamplingMethod = iota + 1
	Box
	Linear
	Gaussian
	MitchellNetravali
	CatmullRom
	Lanczos
)

type Switcher

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

func NewSwitcher

func NewSwitcher(name string, method SwitchingMethod) *Switcher

func (Switcher) GetTile

func (s Switcher) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Switcher) Name

func (s Switcher) Name() string

type SwitchingMethod

type SwitchingMethod func(ctx context.Context, props tile.Properties) source.Source

type Timer

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

func Time

func Time(s source.Source) *Timer

func (Timer) GetTile

func (t Timer) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Timer) Name

func (t Timer) Name() string

type Tracer

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

func Trace

func Trace(s source.Source) *Tracer

func (Tracer) GetTile

func (t Tracer) GetTile(ctx context.Context, props tile.Properties) (*tile.Tile, error)

func (Tracer) Name

func (t Tracer) Name() string

Jump to

Keyboard shortcuts

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