Documentation
¶
Overview ¶
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
const ( // DefaultPrefetchMinBlobSize is the default minimum blob size for prefetch (no minimum). DefaultPrefetchMinBlobSize = 0 // DefaultPrefetchMaxBlobSize is the default maximum blob size for prefetch (50GB). DefaultPrefetchMaxBlobSize = 50 * datasize.GB )
const ( StatusSuccess = "success" StatusFailure = "failure" )
Constants for prefetch status.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.1.6
type Config struct {
Listener listener.Config `yaml:"listener"`
PrefetchMinBlobSize datasize.ByteSize `yaml:"prefetch_min_blob_size"` // Minimum size for a blob to be prefetched (e.g., "50M", "1G"). 0 means no minimum.
PrefetchMaxBlobSize datasize.ByteSize `yaml:"prefetch_max_blob_size"` // Maximum size for a blob to be prefetched (e.g., "10G", "50G"). 0 means no maximum.
}
type DefaultTagParser ¶ added in v0.1.6
type DefaultTagParser struct{}
type Notification ¶
type Notification struct {
Events []Event
}
Notification holds all events. refer to https://docs.docker.com/registry/notifications/.
type PrefetchHandler ¶ added in v0.1.6
type PrefetchHandler struct {
// contains filtered or unexported fields
}
PrefetchHandler handles prefetch requests.
func NewPrefetchHandler ¶ added in v0.1.6
func NewPrefetchHandler( client blobclient.ClusterClient, tagClient tagclient.Client, tagParser TagParser, metrics tally.Scope, minBlobSizeBytes int64, maxBlobSizeBytes int64, v1Synchronous bool, ) *PrefetchHandler
NewPrefetchHandler constructs a new PrefetchHandler.
func (*PrefetchHandler) HandleV1 ¶ added in v0.1.13
func (ph *PrefetchHandler) HandleV1(w http.ResponseWriter, r *http.Request)
HandleV1 processes the prefetch request.
func (*PrefetchHandler) HandleV2 ¶ added in v0.1.13
func (ph *PrefetchHandler) HandleV2(w http.ResponseWriter, r *http.Request)
HandleV2 is a *mostly* idempotent operation that preheats the origin cluster's cache with the provided image. For each image layer: - if it is not present, it is prefetched by the origins asynchronously. - if it is present, no-op. The operation is "mostly" idempotent, as while it does not cause image layer redownloads, it ALWAYS 1) calls BI to get the manifest SHA and 2) downloads all image manifests from the origins.
type PreheatHandler ¶
type PreheatHandler struct {
// contains filtered or unexported fields
}
PreheatHandler defines the handler of preheat.
func NewPreheatHandler ¶
func NewPreheatHandler(client blobclient.ClusterClient, synchronous bool) *PreheatHandler
NewPreheatHandler creates a new preheat handler.
func (*PreheatHandler) Handle ¶
func (ph *PreheatHandler) Handle(w http.ResponseWriter, r *http.Request) error
Handle notifies origins to cache the blob related to the image.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server defines the proxy HTTP server.
func New ¶
func New( stats tally.Scope, config Config, client blobclient.ClusterClient, tagClient tagclient.Client, synchronous bool, ) *Server
New creates a new Server.