...

Package metadata

import "github.com/docker/docker/distribution/metadata"
Overview
Index

Overview ▾

func CheckV2MetadataHMAC

func CheckV2MetadataHMAC(meta *V2Metadata, key []byte) bool

CheckV2MetadataHMAC returns true if the given "meta" is tagged with a hmac hashed by the given "key".

func ComputeV2MetadataHMAC

func ComputeV2MetadataHMAC(key []byte, meta *V2Metadata) string

ComputeV2MetadataHMAC returns a hmac for the given "meta" hash by the given key.

func ComputeV2MetadataHMACKey

func ComputeV2MetadataHMACKey(authConfig *registry.AuthConfig) ([]byte, error)

ComputeV2MetadataHMACKey returns a key for the given "authConfig" that can be used to hash v2 metadata entries.

type FSMetadataStore

FSMetadataStore uses the filesystem to associate metadata with layer and image IDs.

type FSMetadataStore struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewFSMetadataStore

func NewFSMetadataStore(basePath string) (*FSMetadataStore, error)

NewFSMetadataStore creates a new filesystem-based metadata store.

func (*FSMetadataStore) Delete

func (store *FSMetadataStore) Delete(namespace, key string) error

Delete removes data indexed by namespace and key. The data file named after the key, stored in the namespace's directory is deleted.

func (*FSMetadataStore) Get

func (store *FSMetadataStore) Get(namespace string, key string) ([]byte, error)

Get retrieves data by namespace and key. The data is read from a file named after the key, stored in the namespace's directory.

func (*FSMetadataStore) Set

func (store *FSMetadataStore) Set(namespace, key string, value []byte) error

Set writes data indexed by namespace and key. The data is written to a file named after the key, stored in the namespace's directory.

type Store

Store implements a K/V store for mapping distribution-related IDs to on-disk layer IDs and image IDs. The namespace identifies the type of mapping (i.e. "v1ids" or "artifacts"). MetadataStore is goroutine-safe.

type Store interface {
    // Get retrieves data by namespace and key.
    Get(namespace string, key string) ([]byte, error)
    // Set writes data indexed by namespace and key.
    Set(namespace, key string, value []byte) error
    // Delete removes data indexed by namespace and key.
    Delete(namespace, key string) error
}

type V2Metadata

V2Metadata contains the digest and source repository information for a layer.

type V2Metadata struct {
    Digest           digest.Digest
    SourceRepository string
    // HMAC hashes above attributes with recent authconfig digest used as a key in order to determine matching
    // metadata entries accompanied by the same credentials without actually exposing them.
    HMAC string
}

type V2MetadataService

V2MetadataService maps layer IDs to a set of known metadata for the layer.

type V2MetadataService interface {
    GetMetadata(diffID layer.DiffID) ([]V2Metadata, error)
    GetDiffID(dgst digest.Digest) (layer.DiffID, error)
    Add(diffID layer.DiffID, metadata V2Metadata) error
    TagAndAdd(diffID layer.DiffID, hmacKey []byte, metadata V2Metadata) error
    Remove(metadata V2Metadata) error
}

func NewV2MetadataService

func NewV2MetadataService(store Store) V2MetadataService

NewV2MetadataService creates a new diff ID to v2 metadata mapping service.