objectstore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist = errors.New("object does not exist")
)

Functions

This section is empty.

Types

type ErrRangeNotSatisfiable added in v0.0.18

type ErrRangeNotSatisfiable struct {
	Range Range
}

ErrRangeNotSatisfiable is returned when the byte range option falls outside of the total size of the object.

func (ErrRangeNotSatisfiable) Error added in v0.0.18

func (e ErrRangeNotSatisfiable) Error() string

type GetConfig

type GetConfig interface {
	ProcessOptions([]GetOption)
	Range() Range
}

func NewGetConfig

func NewGetConfig() GetConfig

type GetOption

type GetOption func(cfg *options)

func WithRange

func WithRange(byteRange Range) GetOption

WithRange configures a byte range to extract. Start and End are inclusive byte positions, following HTTP range semantics. End can be nil to read from Start to EOF.

type Object

type Object interface {
	// Size returns the total size of the object in bytes.
	Size() int64
	Body() io.ReadCloser
}

type Range

type Range struct {
	// Start is the starting byte position (inclusive)
	Start uint64
	// End is the ending byte position (inclusive), nil means read to EOF
	End *uint64
}

type Store

type Store interface {
	// Put stores an object with the given key and size from the provided reader.
	// The size parameter should match the actual bytes to be read from data.
	Put(ctx context.Context, key string, size uint64, data io.Reader) error
	// Get retrieves the object identified by the given key.
	// Returns an Object for reading the data, or an error if retrieval fails.
	// Use GetOption functions like WithRange to retrieve partial objects.
	Get(ctx context.Context, key string, opts ...GetOption) (Object, error)
	// Delete an object from the store by the given key.
	Delete(ctx context.Context, key string) error
}

Directories

Path Synopsis
Package flatfs is a Datastore implementation that stores all objects in a two-level directory structure in the local file system, regardless of the hierarchy of the keys.
Package flatfs is a Datastore implementation that stores all objects in a two-level directory structure in the local file system, regardless of the hierarchy of the keys.

Jump to

Keyboard shortcuts

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