chunk

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBucketNotFound = errors.New("bucket not found")

ErrBucketNotFound is returned when the bucket is not found.

View Source
var ErrNotFound = errors.New("chunk not found")

ErrNotFound is returned if the chunk was not found.

Functions

This section is empty.

Types

type Store

type Store interface {
	// HasChunk checks if a chunk exists.
	// Returns error for I/O or connection failures.
	HasChunk(ctx context.Context, hash string) (bool, error)

	// GetChunk retrieves a chunk by hash.
	// NOTE: The caller must close the returned io.ReadCloser!
	GetChunk(ctx context.Context, hash string) (io.ReadCloser, error)

	// PutChunk stores a chunk. Returns true if chunk was new, and the compressed size.
	PutChunk(ctx context.Context, hash string, data []byte) (bool, int64, error)

	// DeleteChunk removes a chunk.
	DeleteChunk(ctx context.Context, hash string) error

	// WalkChunks walks all chunks in the store and calls fn for each hash.
	WalkChunks(ctx context.Context, fn func(hash string) error) error
}

Store represents a storage backend for chunks.

func NewLocalStore

func NewLocalStore(baseDir string) (Store, error)

NewLocalStore returns a new local chunk store.

func NewS3Store

func NewS3Store(ctx context.Context, cfg s3.Config, locker lock.Locker) (Store, error)

NewS3Store returns a new S3 chunk store.

Jump to

Keyboard shortcuts

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