storage

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalStorage

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

LocalStorage implements Storage using the local filesystem.

func NewLocalStorage

func NewLocalStorage(basePath string) *LocalStorage

NewLocalStorage creates a new local storage instance.

func (*LocalStorage) Delete

func (s *LocalStorage) Delete(storagePath string) error

Delete removes a file by storage path.

func (*LocalStorage) Get

func (s *LocalStorage) Get(storagePath string) (io.ReadCloser, error)

Get retrieves a file by storage path.

func (*LocalStorage) GetFullPath

func (s *LocalStorage) GetFullPath(storagePath string) string

GetFullPath returns the full filesystem path.

func (*LocalStorage) Save

func (s *LocalStorage) Save(filename string, reader io.Reader) (string, string, int64, error)

Save stores a file and returns its storage path and SHA-256 hash.

type Storage

type Storage interface {
	// Save stores file data and returns the storage path and hash.
	Save(filename string, reader io.Reader) (storagePath string, hash string, size int64, err error)
	// Get retrieves a file by its storage path.
	Get(storagePath string) (io.ReadCloser, error)
	// Delete removes a file by its storage path.
	Delete(storagePath string) error
	// GetFullPath returns the full filesystem path for a storage path.
	GetFullPath(storagePath string) string
}

Storage defines the interface for file storage operations.

Jump to

Keyboard shortcuts

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