Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
ListenAndServe is a convenience function that creates and starts a server
Types ¶
type CacheServer ¶
type CacheServer interface {
// Start starts the server (blocking)
Start() error
// Shutdown gracefully shuts down the server
Shutdown(timeout time.Duration) error
// Config returns the current configuration
Config() *config.Config
// Stats returns cache statistics
Stats() map[string]interface{}
}
CacheServer is the main server interface that can be embedded in other applications
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
ServeHTTP allows embedding the cache server as an http.Handler
type Options ¶
type Options struct {
// Config is the server configuration
Config *config.Config
// Logger is the logger to use (if nil, creates a new one)
Logger *logrus.Logger
// AuthValidator is a custom authentication validator (optional)
// If provided, overrides the default basic auth
AuthValidator userpass.AuthenticateFunc
// OnBlobAccess is called when a blob is accessed (optional)
OnBlobAccess func(digest string, size int64)
// OnBlobDelete is called when a blob is deleted (optional)
OnBlobDelete func(digest string)
}
Options for creating a new server
Click to show internal directories.
Click to hide internal directories.