option

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 47

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 ACL added in v1.15.0

type ACL struct {
	ACL string
}

ACL represents acl

func NewACL added in v1.15.0

func NewACL(acl string) *ACL

NewACL creates an acl option

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 Empty added in v1.7.0

type Empty struct {
	Allowed bool
}

Empty represents empty pipeline writer option

func NewEmpty added in v1.7.0

func NewEmpty(allowed bool) *Empty

NewEmpty creates a new empty option

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 Grant added in v1.15.0

type Grant struct {
	FullControl string
	Read        string
	ReadACP     string
	WriteACP    string
}

Grant represents a grant option

func NewGrant added in v1.15.0

func NewGrant(fullControl, read, readACP, writeACP string) *Grant

NewGrant creates a grant option

type HTTPMethod added in v1.10.0

type HTTPMethod string

HTTPMethod represent HTTP meothd

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 OsFlag added in v1.0.0

type OsFlag int

OsFlag represents os flag

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 PreSign added in v0.15.0

type PreSign struct {
	URL        string
	Header     http.Header
	TimeToLive time.Duration
}

TimeToLive represents presign URL

func NewPreSign added in v0.15.0

func NewPreSign(timeToLive time.Duration) *PreSign

NewPreSign creates a presign option

type Proxy added in v0.12.0

type Proxy struct {
	//URL proxy //URL
	URL string
	//TimeoutMs connection timeout
	TimeoutMs int
	//Fallback if proxy fails retry without proxy
	Fallback bool
}

Proxy represents http proxy

func NewProxy added in v0.12.0

func NewProxy(URL string, timeoutMs int, fallback bool) *Proxy

NewProxy creates a new proxy

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 Region added in v0.17.0

type Region struct {
	Name string
}

Region represents cloud region/location option

func NewRegion added in v0.17.0

func NewRegion(name string) *Region

NewRegion creates a region for specified name

type ServerSideEncryption added in v0.17.0

type ServerSideEncryption struct {
	Algorithm string
}

ServerSideEncryption represents server side encryption

func NewServerSideEncryption added in v0.17.0

func NewServerSideEncryption(alg string) *ServerSideEncryption

NewServerSideEncryption creates a server side encryption

type Size added in v1.0.0

type Size int

Size represents resource size

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 Status added in v1.7.2

type Status struct {
	Code int
}

Status represents status code

func NewStatus added in v1.7.2

func NewStatus() *Status

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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