storage

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSStorage

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

FSStorage wraps github.com/fogfish/stream for filesystem and S3 operations.

func NewFS

func NewFS(path string) (*FSStorage, error)

NewFS creates filesystem storage. Supports local paths and s3:// URLs via stream library.

func (*FSStorage) Get

func (s *FSStorage) Get(ctx context.Context, key iosystem.Key) (io.Reader, error)

Get reads value from key.

func (*FSStorage) Has

func (s *FSStorage) Has(ctx context.Context, key iosystem.Key) (bool, error)

Has checks if key exists.

func (*FSStorage) Put

func (s *FSStorage) Put(ctx context.Context, key iosystem.Key, value io.Reader) error

Put writes value to key.

func (*FSStorage) Walk

func (s *FSStorage) Walk(ctx context.Context, prefix iosystem.Key, visitor func(*iosystem.Document) error) error

Walk traverses keys matching prefix.

type Storage

type Storage interface {
	// Put writes value to key (overwrites if exists).
	// Key should be a relative path like "sub/file.txt".
	Put(ctx context.Context, key iosystem.Key, value io.Reader) error

	// Get reads value from key (returns auto-closing reader).
	// Returns error if key does not exist.
	Get(ctx context.Context, key iosystem.Key) (io.Reader, error)

	// Has checks if key exists (cheap operation for skip-if-exists logic).
	Has(ctx context.Context, key iosystem.Key) (bool, error)

	// Walk traverses all keys matching prefix pattern.
	// Visitor function is called for each matching document.
	Walk(ctx context.Context, prefix iosystem.Key, visitor func(*iosystem.Document) error) error
}

Storage provides pure key/value operations for document persistence. Implementations use github.com/fogfish/stream for filesystem and S3.

Jump to

Keyboard shortcuts

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