sample

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analytics

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

Appends each event to a file as a line of JSON

func (*Analytics) Close

func (a *Analytics) Close(_ context.Context) error

Called on shutdown and hot reload because Analytics implements lifecycle.Closer

func (*Analytics) Record

func (a *Analytics) Record(_ context.Context, event analytics.Event) error

type AnalyticsConfig

type AnalyticsConfig struct {
	Path string
}

type AnalyticsRegistration

type AnalyticsRegistration struct{}

func (AnalyticsRegistration) Initialize

func (AnalyticsRegistration) InitializeConfig

func (AnalyticsRegistration) InitializeConfig() any

func (AnalyticsRegistration) Name

type Authentication

type Authentication struct {
	AuthenticationConfig
}

Accepts requests carrying a fixed key in a header

func (*Authentication) CheckAuthentication

func (a *Authentication) CheckAuthentication(ctx context.Context, req *http.Request) bool

type AuthenticationConfig

type AuthenticationConfig struct {
	Header string
	Key    string // Typically a secret.* reference so the key stays out of the file
	UserID string // Recorded as the user for every request that passes
}

type AuthenticationRegistration

type AuthenticationRegistration struct{}

func (AuthenticationRegistration) Initialize

func (AuthenticationRegistration) InitializeConfig

func (AuthenticationRegistration) InitializeConfig() any

func (AuthenticationRegistration) Name

type Cache

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

Stores tiles in a sample datastore

func (*Cache) Lookup

func (c *Cache) Lookup(_ context.Context, t pkg.TileRequest) (*pkg.Image, error)

func (*Cache) Remove

func (c *Cache) Remove(_ context.Context, t pkg.TileRequest) (bool, error)

func (*Cache) Save

func (c *Cache) Save(_ context.Context, t pkg.TileRequest, img *pkg.Image) error

type CacheConfig

type CacheConfig struct {
	Datastore string
}

type CacheRegistration

type CacheRegistration struct{}

func (CacheRegistration) Initialize

func (CacheRegistration) Initialize(cfgAny any, deps cache.CacheDeps) (cache.Cache, error)

func (CacheRegistration) InitializeConfig

func (CacheRegistration) InitializeConfig() any

func (CacheRegistration) Name

func (CacheRegistration) Name() string

type Check

type Check struct {
	CheckConfig
	// contains filtered or unexported fields
}

Healthy while a layer can still render a tile, bypassing the cache

func (*Check) Check

func (c *Check) Check(ctx context.Context) error

type CheckConfig

type CheckConfig struct {
	Delay uint
	Layer string
}

func (CheckConfig) GetDelay

func (c CheckConfig) GetDelay() uint

type CheckRegistration

type CheckRegistration struct{}

func (CheckRegistration) Initialize

func (CheckRegistration) InitializeConfig

func (CheckRegistration) InitializeConfig() health.HealthCheckConfig

func (CheckRegistration) Name

func (CheckRegistration) Name() string

type Datastore

type Datastore struct {
	DatastoreConfig
	// contains filtered or unexported fields
}

An in-memory map shared by whichever entities reference its ID. A real datastore would hold a connection pool

func (*Datastore) GetID

func (d *Datastore) GetID() string

func (*Datastore) Native

func (d *Datastore) Native() any

type DatastoreConfig

type DatastoreConfig struct {
	ID string
}

type DatastoreRegistration

type DatastoreRegistration struct{}

func (DatastoreRegistration) Initialize

func (DatastoreRegistration) InitializeConfig

func (DatastoreRegistration) InitializeConfig() any

func (DatastoreRegistration) Name

type Provider

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

Renders a solid color tile once at startup and serves it for every request

func (*Provider) GenerateTile

func (p *Provider) GenerateTile(_ context.Context, _ layer.ProviderContext, t pkg.TileRequest) (*pkg.Image, error)

func (*Provider) PreAuth

type ProviderConfig

type ProviderConfig struct {
	Color string // Six digit hex, such as 00AA88
}

type ProviderRegistration

type ProviderRegistration struct{}

func (ProviderRegistration) DataType

func (ProviderRegistration) Initialize

func (ProviderRegistration) Initialize(cfgAny any, deps layer.ProviderDeps) (layer.Provider, error)

func (ProviderRegistration) InitializeConfig

func (ProviderRegistration) InitializeConfig() any

func (ProviderRegistration) Name

type RateLimit added in v0.14.0

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

Counts in the sample datastore. Policies, windows, and headers are handled by tilegroxy

func (*RateLimit) Get added in v0.14.0

func (r *RateLimit) Get(_ context.Context, counters []ratelimit.RateLimitCounter) ([]int64, error)

func (*RateLimit) Increment added in v0.14.0

func (r *RateLimit) Increment(_ context.Context, counters []ratelimit.RateLimitCounter) error

type RateLimitStoreConfig added in v0.14.0

type RateLimitStoreConfig struct {
	Datastore string
}

type RateLimitStoreRegistration added in v0.14.0

type RateLimitStoreRegistration struct{}

func (RateLimitStoreRegistration) Initialize added in v0.14.0

func (RateLimitStoreRegistration) InitializeConfig added in v0.14.0

func (RateLimitStoreRegistration) InitializeConfig() any

func (RateLimitStoreRegistration) Name added in v0.14.0

type Secret

type Secret struct {
	SecretConfig
}

func (*Secret) Check

func (s *Secret) Check(_ context.Context, keys []string) ([]string, error)

func (*Secret) Lookup

func (s *Secret) Lookup(_ context.Context, key string) (string, string, error)

type SecretConfig

type SecretConfig struct {
	Values map[string]string
}

Holds secrets inline. A real secret source would fetch them from a vault

type SecretRegistration

type SecretRegistration struct{}

func (SecretRegistration) CheckBatchSize

func (SecretRegistration) CheckBatchSize() int

Zero means this source can't report changes, so secret watching can't be enabled

func (SecretRegistration) Initialize

func (SecretRegistration) Initialize(cfgAny any, deps secret.SecreterDeps) (secret.Secreter, error)

func (SecretRegistration) InitializeConfig

func (SecretRegistration) InitializeConfig() any

func (SecretRegistration) Name

func (SecretRegistration) Name() string

Jump to

Keyboard shortcuts

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