workspacebundle

package
v2.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxCompressedSize   int64 = 64 << 20
	DefaultMaxUncompressedSize int64 = 256 << 20
	DefaultMaxFiles                  = 8192
)

Variables

This section is empty.

Functions

func Digest

func Digest(data []byte) string

func Extract

func Extract(data []byte, dest string, desc Descriptor, limits Limits) error

func IsPathWithin

func IsPathWithin(root, candidate string) bool

func NormalizeRelativePath

func NormalizeRelativePath(relPath string) (string, error)

func StoreDir

func StoreDir(dataDir string) string

func ValidDigest

func ValidDigest(digest string) bool

func Verify

func Verify(data []byte, digest string) error

Types

type Client

type Client interface {
	PutWorkspaceBundle(ctx context.Context, desc Descriptor, data []byte) error
	GetWorkspaceBundle(ctx context.Context, digest string) ([]byte, error)
}

type Descriptor

type Descriptor struct {
	Digest      string
	Size        int64
	DAGPath     string
	OriginalRef string
	ResolvedRef string
}

func PackDirectory

func PackDirectory(root string, opts PackOptions) (*Descriptor, []byte, error)

func PackDirectoryToFile added in v2.15.2

func PackDirectoryToFile(root, stagingDir string, opts PackOptions) (*Descriptor, string, error)

PackDirectoryToFile creates a workspace archive in stagingDir.

type Limits

type Limits struct {
	MaxCompressedSize   int64
	MaxUncompressedSize int64
	MaxFiles            int
}

func DefaultLimits

func DefaultLimits() Limits

type PackOptions

type PackOptions struct {
	DAGPath     string
	DAGData     []byte
	Includes    []string
	OriginalRef string
	ResolvedRef string
	Limits      Limits
}

type Store

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

func NewStore

func NewStore(dir string, limits Limits) *Store

func (*Store) Cleanup added in v2.15.4

func (s *Store) Cleanup(ctx context.Context, before time.Time, protected map[string]struct{}) (int, error)

Cleanup removes unprotected canonical bundles unused since before.

func (*Store) CleanupReferenced added in v2.15.4

func (s *Store) CleanupReferenced(
	ctx context.Context,
	before time.Time,
	references func(context.Context) (map[string]struct{}, error),
) (int, error)

CleanupReferenced removes expired bundles while preventing reference transitions. references must return every currently protected digest.

func (*Store) Get

func (s *Store) Get(ctx context.Context, digest string) ([]byte, error)

func (*Store) Has

func (s *Store) Has(digest string) bool

func (*Store) Open added in v2.15.2

func (s *Store) Open(ctx context.Context, digest string) (*os.File, int64, error)

Open opens a verified workspace bundle for reading.

func (*Store) Put

func (s *Store) Put(ctx context.Context, desc Descriptor, data []byte) error

func (*Store) PutReader added in v2.15.2

func (s *Store) PutReader(ctx context.Context, desc Descriptor, reader io.Reader) error

PutReader stores a workspace bundle read from reader.

func (*Store) Touch added in v2.15.4

func (s *Store) Touch(ctx context.Context, digest string) (bool, error)

Touch reports whether a bundle exists and refreshes its expiration time.

func (*Store) WithLock added in v2.15.4

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

WithLock runs fn while holding the shared bundle-store lock.

Jump to

Keyboard shortcuts

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