storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 9 Imported by: 0

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