storage

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STORAGE_UNDEFINED_TYPE = iota
	STORAGE_FILESYSTEM
	STORAGE_MINIO
)

Variables

View Source
var ErrNotImplementedYet = fmt.Errorf("not implemented yet")

Functions

This section is empty.

Types

type ArchiveStorage

type ArchiveStorage interface {
	Type() StorageType
	MakeBucket(string) error
	UploadFile(context.Context, ArchiveUnit) (string, error)
}

func NewFileSystemProvider

func NewFileSystemProvider(path string) (ArchiveStorage, error)

func NewMinioProvider

func NewMinioProvider(client *minio.Client, bucket, path string) (ArchiveStorage, error)

type ArchiveUnit

type ArchiveUnit struct {
	Bucket      string
	SegmentName string
	FileName    string
}

type FileSystemProvider

type FileSystemProvider struct {
	Path string
}

func (*FileSystemProvider) MakeBucket

func (storage *FileSystemProvider) MakeBucket(bucket string) error

func (*FileSystemProvider) Type

func (storage *FileSystemProvider) Type() StorageType

func (*FileSystemProvider) UploadFile

func (storage *FileSystemProvider) UploadFile(ctx context.Context, object ArchiveUnit) (string, error)

type MinioProvider

type MinioProvider struct {
	DefaultBucket string
	Path          string
	// contains filtered or unexported fields
}

func (*MinioProvider) MakeBucket

func (m *MinioProvider) MakeBucket(bucket string) error

func (*MinioProvider) Type

func (m *MinioProvider) Type() StorageType

func (*MinioProvider) UploadFile

func (m *MinioProvider) UploadFile(ctx context.Context, object ArchiveUnit) (string, error)

UploadFile loads file to MinIO. Do not provide FileName field in ArchiveUnit object if you want to use Payload bytes; otherwise file will be loaded from filesystem by FileName field

type StorageType

type StorageType uint16

func NewStorageTypeFrom

func NewStorageTypeFrom(str string) StorageType

func (StorageType) String

func (iotaIdx StorageType) String() string

String returns string representation of the storage type

Jump to

Keyboard shortcuts

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