Documentation
¶
Index ¶
Constants ¶
const ( HandlerPrefix = "/blobs/" ReadinessPath = "/artifact-streaming/readyz" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalRangeStore ¶
type MetricsHooks ¶
type Options ¶
type Options struct {
URLPolicy URLPolicy
ResolveCanonicalOrigin func(OriginURL) (OriginURL, bool)
// PeerLookupTimeout, PeerAttemptTimeout, and MaxPeerAttempts use defaults when zero.
PeerLookupTimeout time.Duration
PeerAttemptTimeout time.Duration
MaxPeerAttempts int
SelfPeerID ifaces.NodeID
StartupGated bool
Logger *slog.Logger
Metrics MetricsHooks
// Cache, when set, absorbs reads no larger than MaxCachedRangeBytes.
// OverlayBD index reads are tiny and every node wants the same ones, so
// caching them is what lets peers answer instead of origin.
Cache RangeCache
MaxCachedRangeBytes int64
// OnCached announces that this node can now serve ranges of d. Peers
// discover range sources the same way they discover complete blobs, so
// without this a cached range stays invisible to the swarm.
OnCached func(d digest.Digest)
}
type OriginClient ¶
type OriginClient struct {
// contains filtered or unexported fields
}
OriginClient fetches exact ranges from validated signed origin URLs.
func NewOriginClient ¶
func NewOriginClient(policy URLPolicy) *OriginClient
NewOriginClient constructs a client with independent origin concurrency.
func (*OriginClient) FetchRange ¶
func (c *OriginClient) FetchRange(ctx context.Context, origin OriginURL, requested httprange.Range) (io.ReadCloser, int64, string, error)
FetchRange fetches exactly requested from origin and returns the complete object size reported by Content-Range.
type OriginRangeFetcher ¶
type OriginStatusError ¶
OriginStatusError reports a non-206 response from the signed origin.
func (*OriginStatusError) Error ¶
func (e *OriginStatusError) Error() string
type OriginURL ¶
OriginURL is a validated origin capability extracted from an OverlayBD request. Raw is retained for the outbound request and must never be logged.
func OriginURLFromRequest ¶
OriginURLFromRequest reconstructs and validates the URL embedded by OverlayBD after /blobs/. RequestURI is used so signed query bytes are not decoded and re-encoded.
type PeerRangeFetcher ¶
type ProviderDiscovery ¶
type RangeCache ¶
type RangeCache interface {
OpenRange(ctx context.Context, d digest.Digest, requested httprange.Range) (io.ReadCloser, int64, error)
// Put returns rangecache.ErrFull without consuming r when admission is refused.
Put(d digest.Digest, total, start int64, r io.Reader) (int64, error)
}
RangeCache retains ranges fetched from peers or origin so the next reader - local or remote - does not have to leave the node for them.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves OverlayBD's node-local range proxy contract.
func NewServer ¶
func NewServer(local LocalRangeStore, discovery ProviderDiscovery, peer PeerRangeFetcher, origin OriginRangeFetcher, opts Options) (*Server, error)