storage

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 6 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

Overview

Package storage provides a wrapper around omnistorage backends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage wraps an omnistorage.Backend with ChatHub-specific operations.

func New

func New(backend omnistorage.Backend, folder string) *Storage

New creates a new Storage instance.

func NewFromConfig

func NewFromConfig(backendName string, config map[string]string, folder string) (*Storage, error)

NewFromConfig creates a Storage from backend name and config.

func (*Storage) Backend

func (s *Storage) Backend() omnistorage.Backend

Backend returns the underlying omnistorage.Backend.

func (*Storage) Close

func (s *Storage) Close() error

Close closes the underlying backend.

func (*Storage) Delete

func (s *Storage) Delete(ctx context.Context, filePath string) error

Delete removes a file.

func (*Storage) Exists

func (s *Storage) Exists(ctx context.Context, filePath string) (bool, error)

Exists checks if a file exists.

func (*Storage) Folder

func (s *Storage) Folder() string

Folder returns the configured root folder.

func (*Storage) List

func (s *Storage) List(ctx context.Context, prefix string) ([]string, error)

List lists files with a prefix.

func (*Storage) ListBySource

func (s *Storage) ListBySource(ctx context.Context, source string) ([]string, error)

ListBySource lists conversations from a specific source.

func (*Storage) ListConversations

func (s *Storage) ListConversations(ctx context.Context) ([]string, error)

ListConversations lists all conversation files in the storage folder.

func (*Storage) Read

func (s *Storage) Read(ctx context.Context, filePath string) ([]byte, error)

Read reads content from a path.

func (*Storage) Save

func (s *Storage) Save(ctx context.Context, filePath string, content []byte) error

Save writes content to a path.

Jump to

Keyboard shortcuts

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