server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 45 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticator

func Authenticator(metadataManager *metadata.Manager, config *Config) *auth.Authenticator

func SetupRoutes

func SetupRoutes(r *teapot.Router, deps RouteDependencies)

SetupRoutes configures all application routes on the provided router. When deps is nil, routes are registered with nil handlers (for CLI route listing).

func SetupVHostRoutes

func SetupVHostRoutes(r *teapot.Router, deps RouteDependencies, canonicalDomain string)

SetupVHostRoutes configures the S3 data-plane routes for virtual-hosted-style addressing on a dedicated router. Only called when CanonicalDomain is set.

Unlike SetupRoutes, this does not register /.dirio/*, /minio/admin/*, or any other non-bucket-scoped routes — AWS's vhost-style endpoints are S3-data-plane-only, and control-plane traffic always goes through the path router (bare canonical domain or an IP).

Types

type Config

type Config struct {
	DataDir   string
	Port      int
	AccessKey string // CLI admin credentials
	SecretKey string // CLI admin credentials

	// mDNS settings
	MDNSEnabled  bool
	MDNSName     string
	MDNSHostname string
	MDNSMode     string

	// URL generation
	CanonicalDomain string

	// Debug mode
	Debug bool

	// DataConfig provides alternative admin credentials from .dirio/config.json.
	// Always populated when coming from the Starter (serve command).
	DataConfig *data.ConfigData

	// CLICredentialsExplicitlySet tracks whether AccessKey/SecretKey were
	// explicitly provided (via env, flag, or config) vs using defaults.
	CLICredentialsExplicitlySet bool

	// ShutdownTimeout is how long to wait for in-flight requests to finish
	// during graceful shutdown before connections are forcefully closed.
	ShutdownTimeout time.Duration

	// Pre-initialised components supplied by the Starter.
	// Both fields are required; server.New does not construct them itself.
	RootFS   billy.Filesystem
	Metadata *metadata.Manager

	// Telemetry is the OTel provider.  When non-nil the server registers the
	// Prometheus metrics endpoint and adds the otelhttp middleware.
	Telemetry *telemetry.Provider
}

Config holds server configuration.

type RouteDependencies

type RouteDependencies struct {
	APIHandler *api.Handler

	// Modern Deps
	Health   health.RouteHandlers
	Metrics  metrics.RouteHandlers
	Minio    minioHTTP.RouteHandlers
	Pprof    prof.RouteHandlers
	DirioAPI dirioapi.RouteHandlers
	// contains filtered or unexported fields
}

RouteDependencies contains all dependencies needed for route handlers.

type Server

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

Server represents the S3-compatible HTTP server.

func New

func New(config *Config) (*Server, error)

New creates a new Server from a fully-prepared Config.

The Config must carry RootFS and metadata from the Starter — server.New no longer constructs those itself, ensuring MinIO import and DataConfig finalisation have already completed before the HTTP layer is wired up.

func (*Server) ActiveRequests

func (s *Server) ActiveRequests() int32

ActiveRequests returns the current number of in-flight requests. Exposed for debug endpoints and tests.

func (*Server) Auth

func (s *Server) Auth() *auth.Authenticator

Auth returns the authenticator (used by the console wire file for admin credential validation).

func (*Server) InShutdown

func (s *Server) InShutdown() bool

InShutdown reports whether the server has begun graceful shutdown.

func (*Server) Metadata

func (s *Server) Metadata() *metadata.Manager

Metadata returns the metadata manager (used by the console wire file).

func (*Server) PolicyEngine

func (s *Server) PolicyEngine() *policy.Engine

PolicyEngine returns the policy engine (used by the console wire file).

func (*Server) Router

func (s *Server) Router() *teapot.Router

Router returns the S3 router (used by the console wire file for URL generation).

func (*Server) SetConsole

func (s *Server) SetConsole(h *teapot.Router, port int)

SetConsole registers the console handler with the server. When port is 0 the console is mounted at /dirio/ui/ on the main port. When port is non-zero (e.g. 9001) a separate listener is started for the console. Must be called before Start.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start begins serving HTTP requests with graceful shutdown support. It listens for SIGINT, SIGTERM, and ctx cancellation to trigger a graceful shutdown, draining both the main and console HTTP servers before stopping.

func (*Server) Storage

func (s *Server) Storage() *storage.Storage

Storage returns the storage backend (used by the console wire file).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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