base

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: Apache-2.0 Imports: 16 Imported by: 15

Documentation

Overview

Package base define base manager

Index

Constants

View Source
const (
	//RangeHeader represents a range header
	RangeHeader     = "Range"
	RangeHeaderTmpl = "bytes=%d-%d"
)

RangeHeader represents a range header

Variables

This section is empty.

Functions

func NewStreamReader added in v0.6.0

func NewStreamReader(stream *option.Stream, reedSeeker io.ReadSeeker) io.ReadCloser

func NewUploader

func NewUploader(manager storage.Manager) storage.BatchUploader

NewUploader creates a new batch uploader

Types

type List added in v0.9.0

type List func(ctx context.Context, location string, options ...storage.Option) ([]os.FileInfo, error)

type Manager

type Manager struct {
	storage.Manager
	// contains filtered or unexported fields
}

Manager represents Storager base manager

func New

func New(manager storage.Manager, scheme string, provider func(ctx context.Context, baseURL string, options ...storage.Option) (storage.Storager, error), options []storage.Option) *Manager

New creates base Storager base Manager

func (*Manager) BaseURL added in v0.5.0

func (m *Manager) BaseURL() string

Scheme returns scheme

func (*Manager) Close

func (m *Manager) Close() error

Close closes storagers

func (*Manager) Create

func (m *Manager) Create(ctx context.Context, URL string, mode os.FileMode, isDir bool, options ...storage.Option) error

Create creates a resource

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, URL string, options ...storage.Option) error

Delete deletes locations

func (*Manager) Download

func (m *Manager) Download(ctx context.Context, object storage.Object, options ...storage.Option) (io.ReadCloser, error)

Download downloads content

func (*Manager) DownloadWithURL

func (m *Manager) DownloadWithURL(ctx context.Context, URL string, options ...storage.Option) (io.ReadCloser, error)

DownloadWithURL downloads content

func (*Manager) Exists

func (m *Manager) Exists(ctx context.Context, URL string, options ...storage.Option) (bool, error)

Exists checks if resource exsits

func (*Manager) IsAuthChanged added in v0.5.0

func (m *Manager) IsAuthChanged(ctx context.Context, baseURL string, options []storage.Option) bool

func (*Manager) List

func (m *Manager) List(ctx context.Context, URL string, options ...storage.Option) ([]storage.Object, error)

List lists content for supplied URL

func (*Manager) Object added in v0.9.0

func (m *Manager) Object(ctx context.Context, URL string, options ...storage.Option) (storage.Object, error)

Object retuns an object for supplied URL or error

func (*Manager) Options

func (m *Manager) Options(options []storage.Option) []storage.Option

Options returns base and supplied options

func (*Manager) Scheme

func (m *Manager) Scheme() string

Scheme returns scheme

func (*Manager) Storager

func (m *Manager) Storager(ctx context.Context, baseURL string, options []storage.Option) (storage.Storager, error)

Storager returns Storager

func (*Manager) Upload

func (m *Manager) Upload(ctx context.Context, URL string, mode os.FileMode, reader io.Reader, options ...storage.Option) error

Upload uploads content

type Retry added in v0.8.0

type Retry struct {
	Count      int
	Initial    time.Duration
	Max        time.Duration
	Multiplier float64
	// contains filtered or unexported fields
}

Retry represents abstraction holding sleep duration between retries (back-off)

func NewRetry added in v0.10.4

func NewRetry() *Retry

NewRetry creates a retry

func (*Retry) Pause added in v0.8.0

func (b *Retry) Pause() time.Duration

Pause returns the next time.Duration that the caller should use to backoff.

type Storager added in v0.9.0

type Storager struct {
	List func(ctx context.Context, location string, options ...storage.Option) ([]os.FileInfo, error)
}

Storager represents a base storager

func (*Storager) Get added in v0.9.0

func (s *Storager) Get(ctx context.Context, location string, options ...storage.Option) (os.FileInfo, error)

Get returns an object for supplied location

Jump to

Keyboard shortcuts

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