source

package
v0.0.0-...-87e9d67 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package source contains remote source interface and implementations for uploader.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPSource

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

HTTPSource is HTTP source.

func NewHTTPSource

func NewHTTPSource() *HTTPSource

NewHTTPSource creates new HTTPSource.

func (*HTTPSource) Open

func (s *HTTPSource) Open(ctx context.Context, u *url.URL) (_ RemoteFile, rerr error)

Open implements Source.

func (*HTTPSource) WithClient

func (s *HTTPSource) WithClient(client *http.Client) *HTTPSource

WithClient sets HTTP client to use.

type RemoteFile

type RemoteFile interface {
	io.ReadCloser
	// Name returns filename. Should not be empty.
	Name() string
	// Size returns size of file. If size is unknown, -1 should be returned.
	Size() int64
}

RemoteFile is abstraction for remote file.

type Source

type Source interface {
	Open(ctx context.Context, u *url.URL) (RemoteFile, error)
}

Source is abstraction for remote upload source.

Jump to

Keyboard shortcuts

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