sumweb

package
v0.0.0-...-8c7d1c5 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package sumweb implements the HTTP protocols for serving a go.sum database.

Index

Constants

This section is empty.

Variables

View Source
var Paths = []string{
	"/lookup/",
	"/latest",
	"/tile/",
}

Paths are the URL paths for which Handler should be invoked.

Typically a server will do:

handler := &sumweb.Handler{Server: srv}
for _, path := range sumweb.Paths {
	http.HandleFunc(path, handler)
}

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Server Server
}

Handler is the go.sum database server handler, which should be invoked to serve the paths listed in Paths. The client is responsible for initializing Server.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Server

type Server interface {
	// NewContext returns the context to use for the request r.
	NewContext(r *http.Request) (context.Context, error)

	// Signed returns the signed hash of the latest tree.
	Signed(ctx context.Context) ([]byte, error)

	// ReadRecords returns the content for the n records id through id+n-1.
	ReadRecords(ctx context.Context, id, n int64) ([][]byte, error)

	// FindKey looks up a record by its associated key ("module@version"),
	// returning the record ID.
	FindKey(ctx context.Context, key string) (int64, error)

	// ReadTileData reads the content of tile t.
	// It is only invoked for hash tiles (t.L ≥ 0).
	ReadTileData(ctx context.Context, t tlog.Tile) ([]byte, error)
}

Server is a connection to a go.sum database server.

Jump to

Keyboard shortcuts

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