package app

import "golang.org/x/perf/storage/app"

Package app implements the performance data storage server. Combine an App with a database and filesystem to get an HTTP server.

Index

Variables

var ErrResponseWritten = errors.New("response written")

ErrResponseWritten can be returned by App.Auth to abort the normal /upload handling.

Types

type App

type App struct {
	DB *db.DB
	FS fs.FS

	// Auth obtains the username for the request.
	// If necessary, it can write its own response (e.g. a
	// redirect) and return ErrResponseWritten.
	Auth func(http.ResponseWriter, *http.Request) (string, error)

	// ViewURLBase will be used to construct a URL to return as
	// "viewurl" in the response from /upload. If it is non-empty,
	// the upload ID will be appended to ViewURLBase.
	ViewURLBase string

	// BaseDir is the directory containing the "template" directory.
	// If empty, the current directory will be used.
	BaseDir string
}

App manages the storage server logic. Construct an App instance using a literal with DB and FS objects and call RegisterOnMux to connect it with an HTTP server.

func (*App) RegisterOnMux

func (a *App) RegisterOnMux(mux *http.ServeMux)

RegisterOnMux registers the app's URLs on mux.

Source Files

app.go local.go query.go upload.go

Version
v0.0.0-20250214215153-c95ad7d5b636 (latest)
Published
Feb 14, 2025
Platform
linux/amd64
Imports
17 packages
Last checked
1 week ago

Tools for package owners.