storage

package
v0.0.0-...-d58e437 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BufferSize                = 40960
	DownloadBytesLimitDefault = 1 * 1024 * 1024
)

Variables

View Source
var (
	CommandStatus = []string{"ok", "error"}
)

Functions

func Service

func Service(debug bool)

Types

type ComposedStorageProvider

type ComposedStorageProvider struct {
	StorageProvider StorageProvider
}

func NewComposedStorageProvider

func NewComposedStorageProvider(InputStorageProvider InputStorageProvider,
	OutputStorageProvider OutputStorageProvider) *ComposedStorageProvider

type Content

type Content struct {
	Length int
	Stream chan []byte
}

func ContentFrom

func ContentFrom(length int, r io.ReadCloser) *Content

type Destination

type Destination struct {
	Destination IDestination
}

func (*Destination) DownloadBytes

func (d *Destination) DownloadBytes(ctx context.Context, limit int, resultFunc func([]byte), errFunc func(error))

func (*Destination) DownloadFile

func (d *Destination) DownloadFile(ctx context.Context, destPath string)

type GftProvider

type GftProvider struct {
	StorageProvider
	// contains filtered or unexported fields
}

func NewGftProvider

func NewGftProvider(_tmpDir string, process process) *GftProvider

func (*GftProvider) Start

func (g *GftProvider) Start() error

func (*GftProvider) Stop

func (g *GftProvider) Stop()

func (*GftProvider) UploadFile

func (g *GftProvider) UploadFile(filePath string) (Source, error)

func (*GftProvider) UploadStream

func (g *GftProvider) UploadStream(length int, stream []byte) Source

type GftpDestination

type GftpDestination struct {
	Destination
	// contains filtered or unexported fields
}

func (*GftpDestination) DownloadFile

func (g *GftpDestination) DownloadFile(ctx context.Context, dest string)

func (*GftpDestination) DownloadStream

func (g *GftpDestination) DownloadStream() (*Content, error)

func (*GftpDestination) UploadUrl

func (g *GftpDestination) UploadUrl() string

type GftpDriver

type GftpDriver interface {
}

func NewProcess

func NewProcess(debug bool, client jsonrpc.RPCClient) GftpDriver

type GftpSource

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

func (*GftpSource) ContentLength

func (g *GftpSource) ContentLength() int

func (*GftpSource) DownloadUrl

func (g *GftpSource) DownloadUrl() string

type IDestination

type IDestination interface {
	UploadUrl() string
	DownloadStream() (*Content, error)
	DownloadFile(ctx context.Context, destPath string)
	DownloadBytes(ctx context.Context, limit int, resultFunc func(interface{}), errFunc func(error))
}

type InputStorage

type InputStorage struct {
	InputStorageProvider
}

func (*InputStorage) UploadBytes

func (i *InputStorage) UploadBytes(data []byte) (Source, error)

func (*InputStorage) UploadFile

func (i *InputStorage) UploadFile(filePath string) (Source, error)

type InputStorageProvider

type InputStorageProvider interface {
	UploadStream(length int, stream []byte) (Source, error)
	UploadBytes(data []byte) (Source, error)
	UploadFile(filePath string) (Source, error)
}

type OutputStorageProvider

type OutputStorageProvider interface {
	NewDestination(destFile string) IDestination
}
type PubLink struct {
	File string
	Url  string
}

type Source

type Source interface {
	DownloadUrl() string
	ContentLength() int
}

type StorageProvider

type StorageProvider interface {
	InputStorageProvider
	OutputStorageProvider
}

Jump to

Keyboard shortcuts

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