...

Package continuity

import "github.com/containerd/continuity"
Overview
Index
Subdirectories

Overview ▾

Variables

var (
    // ErrNotFound represents the resource not found
    ErrNotFound = fmt.Errorf("not found")
    // ErrNotSupported represents the resource not supported
    ErrNotSupported = fmt.Errorf("not supported")
)

func ApplyManifest

func ApplyManifest(ctx Context, manifest *Manifest) error

ApplyManifest applies on the resources in a manifest to the given context.

func AtomicWriteFile

func AtomicWriteFile(filename string, data []byte, perm os.FileMode) error

AtomicWriteFile atomically writes data to a file by first writing to a temp file and calling rename.

func Marshal

func Marshal(m *Manifest) ([]byte, error)

func MarshalText

func MarshalText(w io.Writer, m *Manifest) error

func VerifyManifest

func VerifyManifest(ctx Context, manifest *Manifest) error

VerifyManifest verifies all the resources in a manifest against files from the given context.

type ByPath

ByPath provides the canonical sort order for a set of resources. Use with sort.Stable for deterministic sorting.

type ByPath []Resource

func (ByPath) Len

func (bp ByPath) Len() int

func (ByPath) Less

func (bp ByPath) Less(i, j int) bool

func (ByPath) Swap

func (bp ByPath) Swap(i, j int)

type ContentProvider

ContentProvider produces a read stream for a given digest

type ContentProvider interface {
    Reader(digest.Digest) (io.ReadCloser, error)
}

type Context

Context represents a file system context for accessing resources. The responsibility of the context is to convert system specific resources to generic Resource objects. Most of this is safe path manipulation, as well as extraction of resource details.

type Context interface {
    Apply(Resource) error
    Verify(Resource) error
    Resource(string, os.FileInfo) (Resource, error)
    Walk(filepath.WalkFunc) error
}

func NewContext

func NewContext(root string) (Context, error)

NewContext returns a Context associated with root. The default driver will be used, as returned by NewDriver.

func NewContextWithOptions

func NewContextWithOptions(root string, options ContextOptions) (Context, error)

NewContextWithOptions returns a Context associate with the root.

type ContextOptions

ContextOptions represents options to create a new context.

type ContextOptions struct {
    Digester   Digester
    Driver     driverpkg.Driver
    PathDriver pathdriver.PathDriver
    Provider   ContentProvider
}

type Device

type Device interface {
    Resource
    Hardlinkable
    XAttrer

    Major() uint64
    Minor() uint64
}

type Digester

Digester produces a digest for a given read stream

type Digester interface {
    Digest(io.Reader) (digest.Digest, error)
}

type Directory

type Directory interface {
    Resource
    XAttrer

    // Directory is a no-op method to identify directory objects by interface.
    Directory()
}

type Hardlinkable

Hardlinkable is an interface that a resource type satisfies if it can be a hardlink target.

type Hardlinkable interface {
    // Paths returns all paths of the resource, including the primary path
    // returned by Resource.Path. If len(Paths()) > 1, the resource is a hard
    // link.
    Paths() []string
}

type Manifest

Manifest provides the contents of a manifest. Users of this struct should not typically modify any fields directly.

type Manifest struct {
    // Resources specifies all the resources for a manifest in order by path.
    Resources []Resource
}

func BuildManifest

func BuildManifest(ctx Context) (*Manifest, error)

BuildManifest creates the manifest for the given context

func Unmarshal

func Unmarshal(p []byte) (*Manifest, error)

type NamedPipe

type NamedPipe interface {
    Resource
    Hardlinkable
    XAttrer

    // Pipe is a no-op method to allow consistent resolution of NamedPipe
    // interface.
    Pipe()
}

type RegularFile

type RegularFile interface {
    Resource
    XAttrer
    Hardlinkable

    Size() int64
    Digests() []digest.Digest
}

type Resource

type Resource interface {
    // Path provides the primary resource path relative to the bundle root. In
    // cases where resources have more than one path, such as with hard links,
    // this will return the primary path, which is often just the first entry.
    Path() string

    // Mode returns the
    Mode() os.FileMode

    UID() int64
    GID() int64
}

func Merge

func Merge(fs ...Resource) (Resource, error)

Merge two or more Resources into new file. Typically, this should be used to merge regular files as hardlinks. If the files are not identical, other than Paths and Digests, the merge will fail and an error will be returned.

type SymLink interface {
    Resource

    // Target returns the target of the symlink contained in the .
    Target() string
}

type SymlinkPath

SymlinkPath is intended to give the symlink target value in a root context. Target and linkname are absolute paths not under the given root.

type SymlinkPath func(root, linkname, target string) (string, error)

type XAttrer

type XAttrer interface {
    XAttrs() map[string][]byte
}

Subdirectories