storage

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS added in v0.2.0

type FS interface {
	stream.CreateFS[struct{}]
	Stat(path string) (fs.FileInfo, error)
}

type FileSystem added in v0.2.0

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

FileSystem

func NewFileSystem added in v0.2.0

func NewFileSystem(mount string, files ...string) (*FileSystem, error)

NewFileSystem creates filesystem storage.

func (*FileSystem) Get added in v0.2.0

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

Get reads value from key.

func (*FileSystem) Has added in v0.2.0

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

Has checks if key exists.

func (*FileSystem) Put added in v0.2.0

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

Put writes value to key.

func (*FileSystem) Walk added in v0.2.0

func (s *FileSystem) 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".
	// Returns the absolute path where the document was stored.
	Put(ctx context.Context, key iosystem.Key, value io.Reader) (string, 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.
	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.

Jump to

Keyboard shortcuts

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