storage

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMimeType added in v1.7.0

func GetMimeType(fpath string) string

func HandleProxy added in v1.7.0

func HandleProxy(dataURL string, ratio *Ratio, original bool, useProxy bool) (io.ReadCloser, string, error)

Types

type Bucket

type Bucket struct {
	Name string
	Path string
	Root string
}

type ObjectStorage

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

	DeleteBucket(bucket Bucket) error
	GetBucketQuota(bucket Bucket) (uint64, error)
	GetFile(bucket Bucket, fpath string) (utils.ReaderAtCloser, int64, time.Time, error)
	ServeFile(bucket Bucket, fpath string, ratio *Ratio, original bool, useProxy bool) (io.ReadCloser, string, error)
	PutFile(bucket Bucket, fpath string, contents utils.ReaderAtCloser, entry *utils.FileEntry) (string, error)
	DeleteFile(bucket Bucket, fpath string) error
	ListFiles(bucket Bucket, dir string, recursive bool) ([]os.FileInfo, error)
}

type Ratio added in v1.7.0

type Ratio struct {
	Width  int
	Height int
}

func GetRatio added in v1.7.0

func GetRatio(dimes string) (*Ratio, error)

type StorageFS

type StorageFS struct {
	Dir string
}

func NewStorageFS

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

func (*StorageFS) DeleteBucket

func (s *StorageFS) DeleteBucket(bucket Bucket) error

func (*StorageFS) DeleteFile

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

func (*StorageFS) GetBucket

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

func (*StorageFS) GetBucketQuota

func (s *StorageFS) GetBucketQuota(bucket Bucket) (uint64, error)

func (*StorageFS) GetFile

func (s *StorageFS) GetFile(bucket Bucket, fpath string) (utils.ReaderAtCloser, int64, time.Time, error)

func (*StorageFS) ListBuckets added in v1.6.0

func (s *StorageFS) ListBuckets() ([]string, error)

func (*StorageFS) ListFiles

func (s *StorageFS) ListFiles(bucket Bucket, dir string, recursive bool) ([]os.FileInfo, error)

func (*StorageFS) PutFile

func (s *StorageFS) PutFile(bucket Bucket, fpath string, contents utils.ReaderAtCloser, entry *utils.FileEntry) (string, error)

func (*StorageFS) ServeFile added in v1.7.0

func (s *StorageFS) ServeFile(bucket Bucket, fpath string, ratio *Ratio, original bool, useProxy bool) (io.ReadCloser, string, error)

func (*StorageFS) UpsertBucket

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

type StorageMinio

type StorageMinio struct {
	Client *minio.Client
	Admin  *madmin.AdminClient
}

func NewStorageMinio

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

func (*StorageMinio) DeleteBucket

func (s *StorageMinio) DeleteBucket(bucket Bucket) error

func (*StorageMinio) DeleteFile

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

func (*StorageMinio) GetBucket

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

func (*StorageMinio) GetBucketQuota

func (s *StorageMinio) GetBucketQuota(bucket Bucket) (uint64, error)

func (*StorageMinio) GetFile

func (s *StorageMinio) GetFile(bucket Bucket, fpath string) (utils.ReaderAtCloser, int64, time.Time, error)

func (*StorageMinio) ListBuckets added in v1.6.0

func (s *StorageMinio) ListBuckets() ([]string, error)

func (*StorageMinio) ListFiles

func (s *StorageMinio) ListFiles(bucket Bucket, dir string, recursive bool) ([]os.FileInfo, error)

func (*StorageMinio) PutFile

func (s *StorageMinio) PutFile(bucket Bucket, fpath string, contents utils.ReaderAtCloser, entry *utils.FileEntry) (string, error)

func (*StorageMinio) ServeFile added in v1.7.0

func (s *StorageMinio) ServeFile(bucket Bucket, fpath string, ratio *Ratio, original bool, useProxy bool) (io.ReadCloser, 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