Documentation
¶
Index ¶
- Variables
- type LocalStorage
- func (s *LocalStorage) Delete(_ context.Context, path string) error
- func (s *LocalStorage) Exists(_ context.Context, path string) (bool, error)
- func (s *LocalStorage) List(_ context.Context, prefix string) ([]string, error)
- func (s *LocalStorage) ListDirs(_ context.Context, prefix string) ([]string, error)
- func (s *LocalStorage) MoveDir(_ context.Context, oldPrefix, newPrefix string) error
- func (s *LocalStorage) Read(_ context.Context, path string) ([]byte, error)
- func (s *LocalStorage) Write(_ context.Context, path string, data []byte) error
- type S3Storage
- func (s *S3Storage) Delete(ctx context.Context, path string) error
- func (s *S3Storage) Exists(ctx context.Context, path string) (bool, error)
- func (s *S3Storage) List(ctx context.Context, prefix string) ([]string, error)
- func (s *S3Storage) ListDirs(ctx context.Context, prefix string) ([]string, error)
- func (s *S3Storage) MoveDir(ctx context.Context, oldPrefix, newPrefix string) error
- func (s *S3Storage) Read(ctx context.Context, path string) ([]byte, error)
- func (s *S3Storage) Write(ctx context.Context, path string, data []byte) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a requested path does not exist in storage.
Functions ¶
This section is empty.
Types ¶
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage implements Storage using the local filesystem.
Individual file operations (Read, Write, Delete, Exists) are inherently safe for concurrent use: each operates on a single file, and Write uses an atomic temp-file-then-rename pattern. Multi-operation atomicity (e.g. check-then-write for Claim) is handled by repository-level mutexes (e.g. claimMu in the task repo). Removing the previous global RWMutex eliminates cross-repository lock contention that caused disk IO spikes when a long-running scan (e.g. task log index build) blocked all storage operations system-wide.
func NewLocalStorage ¶
func NewLocalStorage(basePath string) (*LocalStorage, error)
NewLocalStorage creates a new LocalStorage rooted at basePath.
func (*LocalStorage) MoveDir ¶ added in v0.0.33
func (s *LocalStorage) MoveDir(_ context.Context, oldPrefix, newPrefix string) error
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements Storage using AWS S3.
func NewS3Storage ¶
NewS3Storage creates a new S3Storage.
type Storage ¶
type Storage interface {
Read(ctx context.Context, path string) ([]byte, error)
Write(ctx context.Context, path string, data []byte) error
Delete(ctx context.Context, path string) error
List(ctx context.Context, prefix string) ([]string, error)
ListDirs(ctx context.Context, prefix string) ([]string, error)
Exists(ctx context.Context, path string) (bool, error)
MoveDir(ctx context.Context, oldPrefix, newPrefix string) error
}
Storage provides an abstraction over key-value style file storage.