core

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStorageNotFound   = errors.New("Storage not found")
	ErrStorageNil        = errors.New("Storage pointer is nil")
	ErrStorageKeyIsEmpty = errors.New("Storage key is empty")
	ErrNoDefaultStorage  = errors.New("Default storage not specified")
	ErrCLinkError        = errors.New("CLink error")
)

Functions

This section is empty.

Types

type AbstractStorage

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

func New

func New() *AbstractStorage

func (*AbstractStorage) AddStorage

func (aStorage *AbstractStorage) AddStorage(storageKey string, storage Storage) (err error)

AddStorage - add new storage to storages list

func (aStorage *AbstractStorage) CreateCLink(filePath, path string) (cLink string, err error)

CreateCLink - save file and create cLink in default storage

func (*AbstractStorage) CreateCLinkInStorage

func (aStorage *AbstractStorage) CreateCLinkInStorage(filePath, path, storageKey string) (cLink string, err error)

CreateCLinkInStorage - save file and create clink in selected storage by storageKey

func (*AbstractStorage) Delete

func (aStorage *AbstractStorage) Delete(cLink string) (err error)

Delete - delete file in storage by cLink

func (aStorage *AbstractStorage) GetPathByCLink(cLink string) (path string)

func (*AbstractStorage) GetStorage

func (aStorage *AbstractStorage) GetStorage(storageKey string) (s Storage, err error)

GetStorage - get storage from list by storage by

func (*AbstractStorage) GetURL

func (aStorage *AbstractStorage) GetURL(cLink string, options ...interface{}) (URL string)

GetURL - return http link by cLink

func (aStorage *AbstractStorage) PrepareCLink(path string) (cLink string, err error)

func (*AbstractStorage) PrepareCLinkInStorage

func (aStorage *AbstractStorage) PrepareCLinkInStorage(path, storageKey string) (cLink string, err error)

func (*AbstractStorage) SetDefaultStorage

func (aStorage *AbstractStorage) SetDefaultStorage(storageKey string) (err error)

SetDefaultStorage - set storage as default

func (aStorage *AbstractStorage) UploadByCLink(filePath, cLink string) (err error)

type ExpirationVerifier

type ExpirationVerifier interface {
	GetAccessExpireTime(cLink string) (expires time.Time)
}

type Storage

type Storage interface {
	Store(filePath, path string) (cLink string, err error)
	GetURL(cLink string, options ...interface{}) (URL string)
	Remove(cLink string) (err error)
	GetCLink(path string) (cLink string)
	StoreByCLink(filePath, cLink string) (err error)
}

type StorageConfig

type StorageConfig struct {
	Key  string            `json:"key" yaml:"key"`
	Type string            `json:"type" yaml:"type"`
	Cfg  map[string]string `json:"config" yaml:"config"`
}

type StoragesConfig

type StoragesConfig struct {
	Default   string          `json:"default" yaml:"default"`
	Instances []StorageConfig `json:"instances" yaml:"instances"`
}

Jump to

Keyboard shortcuts

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