server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateETag

func GenerateETag(filePath string) (string, error)

GenerateETag generates an ETag for a file

Types

type ServerConfigTuner

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

ServerConfigTuner provides automatic tuning of server configuration parameters based on system load and resource utilization metrics

func NewServerConfigTuner

func NewServerConfigTuner(metricsManager *monitoring.MetricsManager, options *ServerConfigTunerOptions) (*ServerConfigTuner, error)

NewServerConfigTuner creates a new server configuration tuner

func (*ServerConfigTuner) ApplyRecommendations

func (t *ServerConfigTuner) ApplyRecommendations()

ApplyRecommendations applies all current recommendations

func (*ServerConfigTuner) GetCurrentConfig

func (t *ServerConfigTuner) GetCurrentConfig() map[string]interface{}

GetCurrentConfig returns the current server configuration

func (*ServerConfigTuner) GetRecommendations

func (t *ServerConfigTuner) GetRecommendations() map[string]string

GetRecommendations returns recommendations for server configuration

func (*ServerConfigTuner) IsAutoTuneEnabled

func (t *ServerConfigTuner) IsAutoTuneEnabled() bool

IsAutoTuneEnabled returns true if automatic tuning is enabled

func (*ServerConfigTuner) SetAutoTuneEnabled

func (t *ServerConfigTuner) SetAutoTuneEnabled(enabled bool)

SetAutoTuneEnabled enables or disables automatic tuning

func (*ServerConfigTuner) StartAutoTuning

func (t *ServerConfigTuner) StartAutoTuning()

StartAutoTuning starts automatic tuning at the configured interval

func (*ServerConfigTuner) StopAutoTuning

func (t *ServerConfigTuner) StopAutoTuning()

StopAutoTuning stops automatic tuning

func (*ServerConfigTuner) TuneServerConfig

func (t *ServerConfigTuner) TuneServerConfig()

TuneServerConfig tunes server configuration parameters based on system metrics

type ServerConfigTunerOptions

type ServerConfigTunerOptions struct {
	// TuningInterval is the interval at which automatic tuning occurs
	TuningInterval time.Duration
	// AutoTuneEnabled indicates if automatic tuning is enabled
	AutoTuneEnabled bool
	// LogFile is the file to log tuning operations to
	LogFile string
}

ServerConfigTunerOptions contains options for the server configuration tuner

func DefaultServerConfigTunerOptions

func DefaultServerConfigTunerOptions() *ServerConfigTunerOptions

DefaultServerConfigTunerOptions returns default options for the server configuration tuner

type StaticFileHandler

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

StaticFileHandler provides optimized handling of static files with features like caching, compression, and ETags

func NewStaticFileHandler

func NewStaticFileHandler(options *StaticFileHandlerOptions) (*StaticFileHandler, error)

NewStaticFileHandler creates a new static file handler

func (*StaticFileHandler) CacheFile

func (h *StaticFileHandler) CacheFile(urlPath string) error

CacheFile caches a file in memory

func (*StaticFileHandler) ClearCache

func (h *StaticFileHandler) ClearCache()

ClearCache clears the file cache

func (*StaticFileHandler) GetCacheStats

func (h *StaticFileHandler) GetCacheStats() map[string]interface{}

GetCacheStats returns statistics about the file cache

func (*StaticFileHandler) GetFilePath

func (h *StaticFileHandler) GetFilePath(urlPath string) string

GetFilePath returns the file path for a URL path

func (*StaticFileHandler) GetURLPath

func (h *StaticFileHandler) GetURLPath(filePath string) (string, error)

GetURLPath returns the URL path for a file path

func (*StaticFileHandler) RefreshCache

func (h *StaticFileHandler) RefreshCache()

RefreshCache refreshes the file cache

func (*StaticFileHandler) RegisterStaticRoute

func (h *StaticFileHandler) RegisterStaticRoute(mux *http.ServeMux)

RegisterStaticRoute registers the static file handler with an HTTP server

func (*StaticFileHandler) ServeHTTP

func (h *StaticFileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface

func (*StaticFileHandler) UncacheFile

func (h *StaticFileHandler) UncacheFile(urlPath string)

UncacheFile removes a file from memory cache

type StaticFileHandlerOptions

type StaticFileHandlerOptions struct {
	// RootDir is the root directory for static files
	RootDir string
	// URLPrefix is the URL prefix for static files
	URLPrefix string
	// MaxAge is the max-age value for Cache-Control header in seconds
	MaxAge int
	// EnableCompression enables gzip compression
	EnableCompression bool
	// EnableETag enables ETag generation
	EnableETag bool
	// EnableFileCache enables caching of file data in memory
	EnableFileCache bool
	// LogFile is the file to log to
	LogFile string
}

StaticFileHandlerOptions contains options for the static file handler

func DefaultStaticFileHandlerOptions

func DefaultStaticFileHandlerOptions() *StaticFileHandlerOptions

DefaultStaticFileHandlerOptions returns default options for the static file handler

Jump to

Keyboard shortcuts

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