cloudstore

package
v0.0.0-...-ce25bc5 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFile

func AddFile(ctx context.Context, tx *dgo.Txn, file *FileInfo) (map[string]interface{}, error)

func InitStore

func InitStore()

InitStore initializes file store

Types

type CloudStore

type CloudStore interface {
	Download(ctx context.Context, id string, w io.Writer) error
	DownloadFile(ctx context.Context, file *FileInfo, w io.Writer) error
	Upload(ctx context.Context, path, mediaType string, r io.ReadCloser) (map[string]interface{}, error)
	Delete(ctx context.Context, id string) (string, interface{}, error)
	DeleteObject(ctx context.Context, path string) error
}

CloudStore is store of any BLOB objects

func NewCloudStore

func NewCloudStore() CloudStore

NewCloudStore creates new instance of cloud store

type FileInfo

type FileInfo struct {
	ID        string `json:"uid"`
	Path      string `json:"path"`
	URL       string `json:"url"`
	MediaType string `json:"content_type"`
}

func FindFile

func FindFile(ctx context.Context, id string) (*FileInfo, error)

func FindFileImpl

func FindFileImpl(ctx context.Context, tx *dgo.Txn, id string) (*FileInfo, error)

type Stow

type Stow struct {
	// contains filtered or unexported fields
}

Stow is cloud object store implemented using https://github.com/graymeta/stow

func NewStow

func NewStow() *Stow

NewStow creates new Stow instance

func (*Stow) Delete

func (fs *Stow) Delete(ctx context.Context, id string) (string, interface{}, error)

Delete object by given path or file id

func (*Stow) DeleteObject

func (fs *Stow) DeleteObject(ctx context.Context, path string) error

DeleteObject by given path

func (*Stow) Download

func (fs *Stow) Download(ctx context.Context, id string, w io.Writer) error

Download object at given path

func (*Stow) DownloadFile

func (fs *Stow) DownloadFile(ctx context.Context, file *FileInfo, w io.Writer) error

DownloadFile downloads given file

func (*Stow) EnsureBucket

func (fs *Stow) EnsureBucket() error

EnsureBucket creates S3 bucket

func (*Stow) Upload

func (fs *Stow) Upload(ctx context.Context, path, mediaType string, r io.ReadCloser) (map[string]interface{}, error)

Upload object at given path

Jump to

Keyboard shortcuts

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