storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Name string
	Path string
}

type ObjectStorage

type ObjectStorage interface {
	GetBucket(name string) (Bucket, error)
	UpsertBucket(name string) (Bucket, error)

	GetFile(bucket Bucket, fname string) (ReaderAtCloser, error)
	PutFile(bucket Bucket, fname string, contents ReaderAtCloser) (string, error)
	DeleteFile(bucket Bucket, fname string) error
}

type ReadAndReaderAt

type ReadAndReaderAt interface {
	io.ReaderAt
	io.Reader
}

type ReaderAtCloser

type ReaderAtCloser interface {
	io.ReaderAt
	io.ReadCloser
}

func NopReaderAtCloser

func NopReaderAtCloser(r ReadAndReaderAt) ReaderAtCloser

type StorageFS

type StorageFS struct {
	Dir string
}

func NewStorageFS

func NewStorageFS(dir string) (*StorageFS, error)

func (*StorageFS) DeleteFile

func (s *StorageFS) DeleteFile(bucket Bucket, fname string) error

func (*StorageFS) GetBucket

func (s *StorageFS) GetBucket(name string) (Bucket, error)

GetBucket - A bucket for the filesystem is just a directory.

func (*StorageFS) GetFile

func (s *StorageFS) GetFile(bucket Bucket, fname string) (ReaderAtCloser, error)

func (*StorageFS) PutFile

func (s *StorageFS) PutFile(bucket Bucket, fname string, contents ReaderAtCloser) (string, error)

func (*StorageFS) UpsertBucket

func (s *StorageFS) UpsertBucket(name string) (Bucket, error)

type StorageMinio

type StorageMinio struct {
	Client *minio.Client
}

func NewStorageMinio

func NewStorageMinio(address, user, pass string) (*StorageMinio, error)

func (*StorageMinio) DeleteFile

func (s *StorageMinio) DeleteFile(bucket Bucket, fname string) error

func (*StorageMinio) GetBucket

func (s *StorageMinio) GetBucket(name string) (Bucket, error)

func (*StorageMinio) GetFile

func (s *StorageMinio) GetFile(bucket Bucket, fname string) (ReaderAtCloser, error)

func (*StorageMinio) PutFile

func (s *StorageMinio) PutFile(bucket Bucket, fname string, contents ReaderAtCloser) (string, error)

func (*StorageMinio) UpsertBucket

func (s *StorageMinio) UpsertBucket(name string) (Bucket, error)

Jump to

Keyboard shortcuts

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