blobstore

package
v1.0.0-beta.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package blobstore is the engine's store of layer blobs: files named by their digest under one directory, which containerd's metadata store records and collects (core/metadata's contentStore wraps it).

It writes nothing synchronously. The engine already runs its own databases without syncing and keeps no promise across a host crash (server.Server.GracefulStop explains why), and a sync made while containerd's metadata store holds its one write lock stalls every other write behind it on a busy disk. A blob a crash left short or wrong is caught where it is read: ReaderAt checks its size, unpacking checks its diff ID, and remote-cache uploads check its digest.

A write is never resumed: reopening a write starts it over. Every engine writer writes a whole blob under its own ref, or under a ref named by the blob's digest that only one writer holds at a time.

The layout is containerd's local store's (blobs/<algorithm>/<encoded>, and ingest/<sha256 of the ref>/ holding the write's ref and data), so an engine state written by that store reads the same.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a content.Store of blobs under root.

func New

func New(root string) (*Store, error)

New returns the store under root, creating root when it doesn't exist.

func (*Store) Abort

func (s *Store) Abort(_ context.Context, ref string) error

Abort removes the write under ref. A writer that still holds it fails when it commits.

func (*Store) Delete

func (s *Store) Delete(_ context.Context, dgst digest.Digest) error

Delete removes the blob.

func (*Store) Info

func (s *Store) Info(_ context.Context, dgst digest.Digest) (content.Info, error)

Info returns the blob's size; its times are its file's modification time.

func (*Store) ListStatuses

func (s *Store) ListStatuses(ctx context.Context, filters ...string) ([]content.Status, error)

ListStatuses lists every write. It takes no filters, as Walk.

func (*Store) ReaderAt

func (s *Store) ReaderAt(_ context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error)

ReaderAt opens the blob desc names. It fails when the stored blob isn't desc's size, as a host crash can leave it.

func (*Store) Status

func (s *Store) Status(_ context.Context, ref string) (content.Status, error)

Status reports the write under ref: its offset is what is written so far.

func (*Store) Update

func (s *Store) Update(context.Context, content.Info, ...string) (content.Info, error)

Update is not supported: containerd's metadata store keeps the labels.

func (*Store) Walk

func (s *Store) Walk(ctx context.Context, fn content.WalkFunc, filters ...string) error

Walk calls fn for every blob. It takes no filters: containerd's metadata store filters its own records and walks this store only to collect it.

func (*Store) WalkStatusRefs

func (s *Store) WalkStatusRefs(ctx context.Context, fn func(string) error) error

WalkStatusRefs calls fn with the ref of every write, open or left behind. containerd's metadata store aborts those it has no record of.

func (*Store) Writer

func (s *Store) Writer(_ context.Context, opts ...content.WriterOpt) (content.Writer, error)

Writer starts a write under the ref opts name. Only one writer holds a ref: another fails as unavailable until it closes, which content.OpenWriter waits out. A blob already stored under the descriptor's digest fails as already existing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL