storage

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

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
}

func NewStorage

func NewStorage(log *slog.Logger, cfg config.Config) (*Storage, error)

func (*Storage) CreateBucket added in v1.0.0

func (s *Storage) CreateBucket(
	id bucket.ID,
	trashTime time.Time,
) (path string, commit, abort func() error, err error)

CreateBucket Создаёт бакет id Бакет создаётся во временной директории; path - абсолютный путь временной директории При вызове функции commit() он перемещается в storage При вызове функции abort() он удаляется

func (*Storage) CreateFile added in v0.5.0

func (s *Storage) CreateFile(bucketID bucket.ID, file string) (path string, commit, abort func() error, err error)

CreateFile Создаёт файл file в существующем бакете bucketID Файл создаётся во временной директории; path - абсолютный путь до временной директории При вызове функции commit() он перемещается в storage При вызове функции abort() он удаляется

func (*Storage) DeleteFile added in v0.6.1

func (s *Storage) DeleteFile(bucketID bucket.ID, file string) error

func (*Storage) DownloadBucket added in v1.0.0

func (s *Storage) DownloadBucket(
	ctx context.Context,
	endpoint string,
	id bucket.ID,
	trashTime time.Time,
) error

DownloadBucket Скачивает бакет id с указанного endpoint

func (*Storage) DownloadFile added in v0.4.0

func (s *Storage) DownloadFile(
	ctx context.Context,
	endpoint string,
	bucketID bucket.ID,
	file string,
) error

DownloadFile Скачивает файл file в существующий бакет bucketID с указанного endpoint

func (*Storage) GetBucket added in v1.0.0

func (s *Storage) GetBucket(id bucket.ID) (path string, unlock func(), err error)

GetBucket Возвращает абсолютный путь бакета id Бакет блокируется в режиме на чтение. Для разблокировки необходимо вызвать unlock()

func (*Storage) GetBucketMeta added in v1.0.0

func (s *Storage) GetBucketMeta(id bucket.ID) (meta BucketMeta, err error)

GetBucketMeta Возвращает метаинформацию о бакете id

func (*Storage) GetFile added in v1.1.0

func (s *Storage) GetFile(bucketID bucket.ID, file string) (path string, unlock func(), err error)

GetFile Возвращает абсолютный путь бакета bucketID, в котором лежит файл file Бакет блокируется в режиме на чтение. Для разблокировки необходимо вызвать unlock()

func (*Storage) RemoveBucket added in v1.0.0

func (s *Storage) RemoveBucket(id bucket.ID) (err error)

RemoveBucket Удаляет бакет id

func (*Storage) Shutdown

func (s *Storage) Shutdown()

Jump to

Keyboard shortcuts

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