objectstore

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: Apache-2.0, MIT Imports: 4 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 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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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