registry

package
v2.0.0-alpha.2+incompa... Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2015 License: Apache-2.0 Imports: 25 Imported by: 263

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithRequest

func WithRequest(ctx context.Context, r *http.Request) context.Context

WithRequest adds an http request to the given context and requents a new context with an "http.request" value.

Types

type App

type App struct {
	Config configuration.Configuration

	// InstanceID is a unique id assigned to the application on each creation.
	// Provides information in the logs and context to identify restarts.
	InstanceID string
	// 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(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) 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

	// RequestID is the unique id of the request.
	RequestID string

	// Repository is the repository for the current request. All requests
	// should be scoped to a single repository. This field may be nil.
	Repository storage.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 v2.Errors

	// AuthUserInfo contains information about an authorized client.
	AuthUserInfo auth.UserInfo
	// 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.

Jump to

Keyboard shortcuts

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