local

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package local is a storage.Store on the local filesystem, for development, tests and single-host deployments with a persistent volume. It is not shared between machines; use an object store such as storage/s3 for more than one instance or an ephemeral disk.

Everything lives under one root directory, reached only through os.Root so no key or symlink can leave it. An object is a directory holding its bytes (data) and its description (meta), published by renaming a complete temporary directory into place: the bytes and the metadata appear together or not at all, and a crash leaves only a temporary directory that no read ever sees and the next New sweeps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a filesystem storage.Store. Close it when done.

func New

func New(dir string) (*Store, error)

New opens, creating it if needed, the Store rooted at dir. Directories are created 0700 and files 0600. It removes temporary directories left by an interrupted write.

func (*Store) Close

func (s *Store) Close() error

Close releases the root directory.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

Delete implements storage.Store. The object leaves by one rename, so it is never half there, and its bytes are removed afterwards.

func (*Store) Open

func (s *Store) Open(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)

Open implements storage.Store.

func (*Store) Put

func (s *Store) Put(ctx context.Context, r io.Reader, opts storage.PutOptions) (storage.Object, error)

Put implements storage.Store.

func (*Store) Stat

func (s *Store) Stat(ctx context.Context, key string) (storage.Info, error)

Stat implements storage.Store. An object is present only when its directory holds a readable meta and a data file of the size meta records.

Jump to

Keyboard shortcuts

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