forked from TrueCloudLab/distribution
5789ca7629
To bring the implementation inline with the specification, the names and structure of the API routes have been updated. The overloaded term "image" has been replaced with the term "manifest", which may also be known as "image manifest". The desire for the layer storage to be more of a general blob storage is reflected in moving from "layer" api prefixes to "blob". The "tarsum" path parameter has been replaced by a more general "digest" parameter and is no longer required to start uploads. Another set of changes will come along to support this change at the storage service layer.
35 lines
778 B
Go
35 lines
778 B
Go
package registry
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gorilla/handlers"
|
|
)
|
|
|
|
// layerDispatcher uses the request context to build a layerHandler.
|
|
func layerDispatcher(ctx *Context, r *http.Request) http.Handler {
|
|
layerHandler := &layerHandler{
|
|
Context: ctx,
|
|
TarSum: ctx.vars["tarsum"],
|
|
}
|
|
|
|
layerHandler.log = layerHandler.log.WithField("tarsum", layerHandler.TarSum)
|
|
|
|
return handlers.MethodHandler{
|
|
"GET": http.HandlerFunc(layerHandler.GetLayer),
|
|
"HEAD": http.HandlerFunc(layerHandler.GetLayer),
|
|
}
|
|
}
|
|
|
|
// layerHandler serves http layer requests.
|
|
type layerHandler struct {
|
|
*Context
|
|
|
|
TarSum string
|
|
}
|
|
|
|
// GetLayer fetches the binary data from backend storage returns it in the
|
|
// response.
|
|
func (lh *layerHandler) GetLayer(w http.ResponseWriter, r *http.Request) {
|
|
|
|
}
|