Documentation
¶
Index ¶
- type ConfigWatcher
- type Service
- func (s *Service) Clean()
- func (s *Service) GetCache(name string) cache.Manager
- func (s *Service) GetCacheSource(name string, opt tile.TileOptions) layer.Layer
- func (s *Service) GetGrid(name string) geo.Grid
- func (s *Service) GetId() string
- func (s *Service) GetInfoSource(name string) layer.InfoLayer
- func (s *Service) GetLegendSource(name string) layer.LegendLayer
- func (s *Service) GetService() service.Service
- func (s *Service) GetServiceType() ServiceType
- func (s *Service) GetSource(name string) layer.Layer
- func (s *Service) LoadError() error
- func (s *Service) Reload(newConfig *setting.ProxyService, globals *setting.GlobalsSetting, ...) error
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) Status() ServiceStatus
- type ServiceStatus
- type ServiceType
- type TileProxy
- func (t *TileProxy) GetService(id string) *Service
- func (t *TileProxy) GetServiceIDs() []string
- func (t *TileProxy) Reload(proxy []*setting.ProxyService, fac setting.CacheFactory)
- func (t *TileProxy) ReloadFromFile(path string, fac setting.CacheFactory) error
- func (t *TileProxy) ReloadServices(services []*setting.ProxyService, fac setting.CacheFactory) error
- func (t *TileProxy) RemoveService(id string)
- func (s *TileProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (t *TileProxy) SetRequestTimeout(timeout time.Duration)
- func (t *TileProxy) SetSlowLogThreshold(d time.Duration)
- func (t *TileProxy) Shutdown(ctx context.Context) error
- func (t *TileProxy) UpdateService(id string, d *setting.ProxyService, fac setting.CacheFactory) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigWatcher ¶
type ConfigWatcher struct {
// contains filtered or unexported fields
}
ConfigWatcher watches a configuration file for changes and hot-reloads the proxy. It polls the file metadata and confirms a change by comparing content hashes, which keeps it reliable across editors that save via rename (a pattern inotify-style watchers easily miss) and needs no platform specific dependencies. Reload failures are logged and leave the running services untouched.
func NewConfigWatcher ¶
func NewConfigWatcher(proxy *TileProxy, path string, fac setting.CacheFactory, interval, debounce time.Duration) *ConfigWatcher
func (*ConfigWatcher) Start ¶
func (w *ConfigWatcher) Start()
Start begins watching in a background goroutine.
func (*ConfigWatcher) Stop ¶
func (w *ConfigWatcher) Stop()
Stop terminates the watcher. It is safe to call multiple times.
type Service ¶
type Service struct {
setting.ProxyInstance
Id string
Type ServiceType
Service service.Service
Grids map[string]geo.Grid
Sources map[string]layer.Layer
InfoSources map[string]layer.InfoLayer
LegendSources map[string]layer.LegendLayer
Caches map[string]cache.Manager
// contains filtered or unexported fields
}
func NewService ¶
func NewService(dataset *setting.ProxyService, globals *setting.GlobalsSetting, fac setting.CacheFactory) *Service
func (*Service) GetCacheSource ¶
func (*Service) GetLegendSource ¶
func (s *Service) GetLegendSource(name string) layer.LegendLayer
func (*Service) GetService ¶
func (*Service) GetServiceType ¶
func (s *Service) GetServiceType() ServiceType
func (*Service) Reload ¶
func (s *Service) Reload(newConfig *setting.ProxyService, globals *setting.GlobalsSetting, fac setting.CacheFactory) error
func (*Service) Status ¶
func (s *Service) Status() ServiceStatus
type ServiceStatus ¶
type ServiceStatus int32
const ( ServiceStatusStopped ServiceStatus = 0 ServiceStatusStarting ServiceStatus = 1 ServiceStatusRunning ServiceStatus = 2 ServiceStatusStopping ServiceStatus = 3 ServiceStatusError ServiceStatus = 4 )
func (ServiceStatus) String ¶
func (s ServiceStatus) String() string
type ServiceType ¶
type ServiceType uint32
const ( MapboxService ServiceType = 0 WMSService ServiceType = 1 WMTSService ServiceType = 2 TileService ServiceType = 3 CesiumService ServiceType = 4 )
func (ServiceType) String ¶
func (t ServiceType) String() string
type TileProxy ¶
func NewTileProxy ¶
func NewTileProxy(globals *setting.GlobalsSetting, proxys []*setting.ProxyService, fac setting.CacheFactory) *TileProxy
func (*TileProxy) GetService ¶
func (*TileProxy) GetServiceIDs ¶
func (*TileProxy) Reload ¶
func (t *TileProxy) Reload(proxy []*setting.ProxyService, fac setting.CacheFactory)
Reload replaces all services, logging instead of returning failures. It is kept for backwards compatibility; prefer ReloadServices.
func (*TileProxy) ReloadFromFile ¶
func (t *TileProxy) ReloadFromFile(path string, fac setting.CacheFactory) error
ReloadFromFile loads a configuration file and applies it without stopping the server. When the file is missing, malformed or fails validation the currently running services are left untouched and the error is returned.
func (*TileProxy) ReloadServices ¶
func (t *TileProxy) ReloadServices(services []*setting.ProxyService, fac setting.CacheFactory) error
ReloadServices atomically replaces the whole set of services. The new configuration is validated and built first; if anything fails the current services keep serving and the problems are returned. Retired services are drained and cleaned up in the background so in-flight requests finish safely.
func (*TileProxy) RemoveService ¶
func (*TileProxy) SetRequestTimeout ¶
func (*TileProxy) SetSlowLogThreshold ¶
SetSlowLogThreshold sets the duration above which requests are logged. A negative value disables request logging entirely; zero restores the default of 200ms.
func (*TileProxy) UpdateService ¶
func (t *TileProxy) UpdateService(id string, d *setting.ProxyService, fac setting.CacheFactory) error
UpdateService builds and installs a single service, replacing an existing one with the same id. The running configuration is left untouched when the new service cannot be built.