option

package
v0.11.3 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: 11 Imported by: 0

Documentation

Overview

Package option define storage options

Index

Constants

View Source
const (
	//ErrorTypeDownload download error type
	ErrorTypeDownload = "download"
	//ErrorTypeUpload upload error type
	ErrorTypeUpload = "upload"
	//ErrorTypeReader reader error type
	ErrorTypeReader = "reader"
)
View Source
const (
	//NoCacheBaseURL no cache base URL
	NoCacheBaseURL = iota + 1
)

Variables

This section is empty.

Functions

func Append

func Append(options []storage.Option, newOptions ...storage.Option) []storage.Option

Append storage options

func Assign

func Assign(options []storage.Option, supported ...interface{}) ([]storage.Option, bool)

Assign assign supplied option, if returns un assign options and true if assign at least one

func DefaultMatch added in v0.2.2

func DefaultMatch(parent string, info os.FileInfo) bool

func GetListOptions added in v0.2.0

func GetListOptions(options []storage.Option) (Match, *Page)

GetListOptions returns list options

func GetWalkOptions added in v0.2.0

func GetWalkOptions(options []storage.Option) (Match, Modifier)

GetWalkOptions returns walk options

Types

type AES256Key

type AES256Key struct {
	Key                 []byte
	Base64Key           string
	Base64KeyMd5Hash    string
	Base64KeySha256Hash string
}

AES256Key represents custom key

func NewAES256Key

func NewAES256Key(key []byte) (result *AES256Key, err error)

NewAES256Key returns new key

func NewBase64AES256Key

func NewBase64AES256Key(base64Key string) (result *AES256Key, err error)

NewBase64AES256Key create a AES256Key from base64 encoded key

func (*AES256Key) Init

func (k *AES256Key) Init() (err error)

Init initialises key

func (*AES256Key) Validate

func (k *AES256Key) Validate() error

Validate checks if key is valid

type Auth added in v0.6.1

type Auth struct {
	Force bool
}

Auth auth options to force auth, instead of reusing previous auth session

func NewAuth added in v0.6.1

func NewAuth(force bool) *Auth

NewAuth create an auth option

type BasicAuth

type BasicAuth interface {
	Credentials() (user, password string)
}

BasicAuth represents a basic auth

func NewBasicAuth

func NewBasicAuth(user, password string) BasicAuth

NewBasicAuth returns credential authenticator

type Crc

type Crc struct {
	Hash uint32
}

Crc represents crc hash

func NewCrc

func NewCrc(data []byte) *Crc

NewCrc returns a crc hash for supplied data

func (*Crc) Decode

func (c *Crc) Decode(encoded string) error

Decode decodes base64 encoded hash

func (*Crc) Encode

func (c *Crc) Encode() string

Encode encodes hash

type Dest

type Dest storage.Options

Dest represents dest options

func NewDest

func NewDest(options ...storage.Option) *Dest

NewDest returns new source options

type Error

type Error struct {
	Type  string
	Error error
}

Error represents a simulation error

func NewDownloadError

func NewDownloadError(err error) *Error

NewDownloadError creates a download error

func NewErrors

func NewErrors(errors ...*Error) []*Error

NewErrors creates an error slice for supplied errors

func NewReaderError

func NewReaderError(err error) *Error

NewReaderError creates a reader error

func NewUploadError

func NewUploadError(err error) *Error

NewUploadError creates an upload error

type Errors

type Errors []*Error

Errors represents simulation errors

type Generation added in v0.8.0

type Generation struct {
	WhenMatch  bool
	Generation int64
}

Generation represent generation option

func NewGeneration added in v0.8.0

func NewGeneration(whenMatch bool, generation int64) *Generation

NewGeneration create a generation

type Location

type Location struct {
	Path string
}

Location represents a location

func NewLocation

func NewLocation(path string) *Location

NewLocation create a location with supplied path

type Match added in v0.2.0

type Match func(parent string, info os.FileInfo) bool

Match represents a matching function

func GetMatchFunc added in v0.2.0

func GetMatchFunc(matcher Match) Match

GetMatchFunc returns supplied matcher or default matcher

type Matcher

type Matcher interface {
	Match(parent string, info os.FileInfo) bool
}

Matcher represents a matcher

type Md5

type Md5 struct {
	Hash []byte
}

Md5 represents md5 value

func NewMd5

func NewMd5(data []byte) *Md5

NewMd5 returns a MD5 hash for supplied data

func (*Md5) Decode

func (m *Md5) Decode(encoded string) (err error)

Decode base64 decode

func (*Md5) Encode

func (m *Md5) Encode() string

Encode encode base64 hash value

type Modifier

type Modifier func(info os.FileInfo, reader io.ReadCloser) (os.FileInfo, io.ReadCloser, error)

Modifier option to modify content,

type NoCache

type NoCache struct {
	Source int
}

NoCache represents nocache option

type ObjectKind added in v0.10.0

type ObjectKind struct {
	File bool
}

ObjectKind represents an option to indicate operation object kind

func NewObjectKind added in v0.10.0

func NewObjectKind(file bool) *ObjectKind

NewObject creates a new object

type Override

type Override struct {
	Override bool
}

Override override flag option

type Page

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

Page represents a page

func NewPage

func NewPage(offset, limit int) *Page

NewPage returns a page

func (*Page) HasReachedLimit

func (p *Page) HasReachedLimit() bool

HasReachedLimit returns true if limit has been reaced

func (*Page) Increment

func (p *Page) Increment() int

Increment increment counter

func (*Page) MaxResult

func (p *Page) MaxResult() int64

MaxResult returns max results or zero

func (*Page) ShallSkip

func (p *Page) ShallSkip() bool

ShallSkip returns true if item needs to be skipped

type Recursive added in v0.3.0

type Recursive struct {
	Flag bool
}

Recursive represents recursive option

func NewRecursive added in v0.3.0

func NewRecursive(flag bool) *Recursive

NewRecursive returns a recursive option

type SkipChecksum added in v0.7.0

type SkipChecksum struct {
	Skip bool
}

SkipChecksum represents checksum option

func NewSkipChecksum added in v0.7.0

func NewSkipChecksum(skip bool) *SkipChecksum

NewSkipChecksum returns checksum options for supplied skip flag

type Source

type Source storage.Options

Source represents source options

func NewSource

func NewSource(options ...storage.Option) *Source

NewSource returns new source options

type Stream added in v0.6.0

type Stream struct {
	PartSize int
	Size     int
}

Stream represents stream option for download reader

func NewStream added in v0.6.0

func NewStream(partSize, size int) *Stream

NewStream returns a new stream

type Timeout

type Timeout struct {
	time.Duration
}

Timeout represents timeout option

func NewTimeout

func NewTimeout(durationInMs int) Timeout

NewTimeout creates a new timeout option

Jump to

Keyboard shortcuts

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