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.
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.
Click to show internal directories.
Click to hide internal directories.