package backend

import "github.com/containerd/nydus-snapshotter/pkg/backend"

Index

Constants

const (
	BackendTypeOSS     = "oss"
	BackendTypeS3      = "s3"
	BackendTypeLocalFS = "localfs"
)

Variables

var (
	// We always use multipart upload for backend, and limit the
	// multipart chunk size to 500MB by default.
	MultipartChunkSize int64 = 500 * 1024 * 1024
)

Types

type Backend

type Backend interface {
	// Push pushes specified blob file to remote storage backend.
	Push(ctx context.Context, cs content.Store, desc ocispec.Descriptor) error
	// Check checks whether a blob exists in remote storage backend,
	// blob exists -> return (blobPath, nil)
	// blob not exists -> return ("", err)
	Check(blobDigest digest.Digest) (string, error)
	// Type returns backend type name.
	Type() string
}

Backend uploads blobs generated by nydus-image builder to a backend storage.

func NewBackend

func NewBackend(_type string, config []byte, forcePush bool) (Backend, error)

Nydus driver majorly works for registry backend, which means blob is stored in registry as per OCI distribution specification. But nydus can also make OSS or other storage services as backend storage. Pass config as byte slice here because we haven't find a way to represent all backend config at the same time.

type LocalFSBackend

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

func (*LocalFSBackend) Check

func (b *LocalFSBackend) Check(blobDigest digest.Digest) (string, error)

func (*LocalFSBackend) Push

func (*LocalFSBackend) Type

func (b *LocalFSBackend) Type() string

type OSSBackend

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

func (*OSSBackend) Check

func (b *OSSBackend) Check(blobDigest digest.Digest) (string, error)

func (*OSSBackend) Push

func (b *OSSBackend) Push(ctx context.Context, cs content.Store, desc ocispec.Descriptor) error

func (*OSSBackend) Type

func (b *OSSBackend) Type() string

type S3Backend

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

func (*S3Backend) Check

func (b *S3Backend) Check(blobDigest digest.Digest) (string, error)

func (*S3Backend) Push

func (b *S3Backend) Push(ctx context.Context, cs content.Store, desc ocispec.Descriptor) error

func (*S3Backend) Type

func (b *S3Backend) Type() string

type S3Config

type S3Config struct {
	AccessKeyID     string `json:"access_key_id,omitempty"`
	AccessKeySecret string `json:"access_key_secret,omitempty"`
	Endpoint        string `json:"endpoint,omitempty"`
	Scheme          string `json:"scheme,omitempty"`
	BucketName      string `json:"bucket_name,omitempty"`
	Region          string `json:"region,omitempty"`
	ObjectPrefix    string `json:"object_prefix,omitempty"`
}

Source Files

backend.go localfs.go oss.go s3.go

Version
v0.15.1 (latest)
Published
Jan 26, 2025
Platform
linux/amd64
Imports
22 packages
Last checked
8 hours ago

Tools for package owners.