handlers

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NameNotRequired added in v0.5.3

func NameNotRequired(*http.Request) bool

func NameRequired added in v0.5.3

func NameRequired(*http.Request) bool

func NoCustomAccessRecords added in v0.5.3

func NoCustomAccessRecords(*http.Request) []auth.Access

Types

type App

type App struct {
	context.Context

	Config *configuration.Configuration
	// contains filtered or unexported fields
}

App is a global registry application object. Shared resources can be placed on this object that will be accessible from all requests. Any writable fields should be protected.

func NewApp

func NewApp(ctx context.Context, configuration *configuration.Configuration) *App

NewApp takes a configuration and returns a configured app, ready to serve requests. The app only implements ServeHTTP and can be wrapped in other handlers accordingly.

func (*App) Namespace added in v1.1.1

func (app *App) Namespace() distribution.Namespace

Namespace returns a namespace instance representing application's registry storage.

func (*App) NewRoute added in v0.5.3

func (app *App) NewRoute() *mux.Route

func (*App) RegisterHealthChecks added in v1.1.1

func (app *App) RegisterHealthChecks(healthRegistries ...*health.Registry)

RegisterHealthChecks is an awful hack to defer health check registration control to callers. This should only ever be called once per registry process, typically in a main function. The correct way would be register health checks outside of app, since multiple apps may exist in the same process. Because the configuration and app are tightly coupled, implementing this properly will require a refactor. This method may panic if called twice in the same process.

func (*App) RegisterRoute added in v0.5.3

func (app *App) RegisterRoute(route *mux.Route, dispatch dispatchFunc, nameRequired nameRequiredFunc, accessRecords customAccessRecordsFunc)

func (*App) ServeHTTP

func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Context

type Context struct {
	// App points to the application structure that created this context.
	*App
	context.Context

	// Repository is the repository for the current request. All requests
	// should be scoped to a single repository. This field may be nil.
	Repository distribution.Repository

	// Errors is a collection of errors encountered during the request to be
	// returned to the client API. If errors are added to the collection, the
	// handler *must not* start the response via http.ResponseWriter.
	Errors errcode.Errors
	// contains filtered or unexported fields
}

Context should contain the request specific context for use in across handlers. Resources that don't need to be shared across handlers should not be on this object.

func (*Context) Value

func (ctx *Context) Value(key interface{}) interface{}

Value overrides context.Context.Value to ensure that calls are routed to correct context.

Jump to

Keyboard shortcuts

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