Documentation ¶
Index ¶
- Variables
- func BoolP(name, shorthand string, value bool, usage string) (out *bool)
- func Cause(cause error) (retriable bool, err error)
- func CountP(name, shorthand string, usage string) (out *int)
- func Debugf(o interface{}, text string, args ...interface{})
- func DurationP(name, shorthand string, value time.Duration, usage string) (out *time.Duration)
- func Errorf(o interface{}, text string, args ...interface{})
- func FatalError(err error) error
- func Float64P(name, shorthand string, value float64, usage string) (out *float64)
- func HashStream(r io.Reader) (map[HashType]string, error)
- func HashStreamTypes(r io.Reader, set HashSet) (map[HashType]string, error)
- func Infof(o interface{}, text string, args ...interface{})
- func InitLogging()
- func IntP(name, shorthand string, value int, usage string) (out *int)
- func IsFatalError(err error) bool
- func IsNoRetryError(err error) bool
- func IsRetryError(err error) bool
- func LogLevelPrintf(level LogLevel, o interface{}, text string, args ...interface{})
- func Logf(o interface{}, text string, args ...interface{})
- func NoRetryError(err error) error
- func OpenOptionAddHTTPHeaders(headers http.Header, options []OpenOption)
- func OpenOptionAddHeaders(options []OpenOption, headers map[string]string)
- func OpenOptionHeaders(options []OpenOption) (headers map[string]string)
- func RetryError(err error) error
- func RetryErrorf(format string, a ...interface{}) error
- func ShouldRetry(err error) bool
- func ShouldRetryHTTP(resp *http.Response, retryErrorCodes []int) bool
- func StringArrayP(name, shorthand string, value []string, usage string) (out *[]string)
- func StringP(name, shorthand string, value string, usage string) (out *string)
- func Trace(o interface{}, format string, a ...interface{}) func(string, ...interface{})
- func VarP(value pflag.Value, name, shorthand, usage string)
- type BwTimeSlot
- type BwTimetable
- type CleanUpper
- type ConfigInfo
- type Copier
- type CountingReader
- type Dir
- func (d *Dir) ID() string
- func (d *Dir) Items() int64
- func (d *Dir) ModTime() time.Time
- func (d *Dir) Remote() string
- func (d *Dir) SetID(id string) *Dir
- func (d *Dir) SetItems(items int64) *Dir
- func (d *Dir) SetRemote(remote string) *Dir
- func (d *Dir) SetSize(size int64) *Dir
- func (d *Dir) Size() int64
- func (d *Dir) String() string
- type DirCacheFlusher
- type DirChangeNotifier
- type DirEntries
- func (ds DirEntries) ForDir(fn func(dir Directory))
- func (ds DirEntries) ForDirError(fn func(dir Directory) error) error
- func (ds DirEntries) ForObject(fn func(o Object))
- func (ds DirEntries) ForObjectError(fn func(o Object) error) error
- func (ds DirEntries) Len() int
- func (ds DirEntries) Less(i, j int) bool
- func (ds DirEntries) Swap(i, j int)
- type DirEntry
- type DirMover
- type Directory
- type Fataler
- type Features
- type Fs
- type HTTPOption
- type HashSet
- func (h *HashSet) Add(t ...HashType) HashSet
- func (h HashSet) Array() (ht []HashType)
- func (h HashSet) Contains(t HashType) bool
- func (h HashSet) Count() int
- func (h HashSet) GetOne() HashType
- func (h HashSet) Overlap(t HashSet) HashSet
- func (h HashSet) String() string
- func (h HashSet) SubsetOf(c HashSet) bool
- type HashType
- type HashesOption
- type Info
- type ListRCallback
- type ListRFn
- type ListRer
- type LogLevel
- type MergeDirser
- type MimeTyper
- type Mover
- type MultiHasher
- type NoRetrier
- type Object
- type ObjectInfo
- type OpenOption
- type Purger
- type PutStreamer
- type PutUncheckeder
- type RangeOption
- type Retrier
- type SeekOption
- type SizeSuffix
- type UnWrapper
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorNotFoundInConfigFile is returned by NewFs if not found in config file ErrorNotFoundInConfigFile = errors.New("didn't find section in config file") ErrorCantPurge = errors.New("can't purge directory") ErrorCantCopy = errors.New("can't copy object - incompatible remotes") ErrorCantMove = errors.New("can't move object - incompatible remotes") ErrorCantDirMove = errors.New("can't move directory - incompatible remotes") ErrorDirExists = errors.New("can't copy directory - destination already exists") ErrorCantSetModTime = errors.New("can't set modified time") ErrorCantSetModTimeWithoutDelete = errors.New("can't set modified time without deleting existing object") ErrorDirNotFound = errors.New("directory not found") ErrorObjectNotFound = errors.New("object not found") ErrorLevelNotSupported = errors.New("level value not supported") ErrorListAborted = errors.New("list aborted") ErrorListBucketRequired = errors.New("bucket or container name is needed in remote") ErrorIsFile = errors.New("is a file not a directory") ErrorNotAFile = errors.New("is a not a regular file") ErrorNotDeleting = errors.New("not deleting files as there were IO errors") ErrorNotDeletingDirs = errors.New("not deleting directories as there were IO errors") ErrorCantMoveOverlapping = errors.New("can't move files on overlapping remotes") ErrorDirectoryNotEmpty = errors.New("directory not empty") ErrorImmutableModified = errors.New("immutable file modified") )
Globals
var ( // Config is the global config Config = &ConfigInfo{ LowLevelRetries: 3, } )
Global
var ErrHashUnsupported = errors.New("hash type not supported")
ErrHashUnsupported should be returned by filesystem, if it is requested to deliver an unsupported hash type.
var HashWidth = map[HashType]int{ HashMD5: 32, HashSHA1: 40, HashDropbox: 64, }
HashWidth returns the width in characters for any HashType
var SupportedHashes = NewHashSet(HashMD5, HashSHA1, HashDropbox)
SupportedHashes returns a set of all the supported hashes by HashStream and MultiHasher.
Functions ¶
func BoolP ¶
BoolP defines a flag which can be overridden by an environment variable
It is a thin wrapper around pflag.BoolP
func Cause ¶
Cause is a souped up errors.Cause which can unwrap some standard library errors too. It returns true if any of the intermediate errors had a Timeout() or Temporary() method which returned true.
func CountP ¶
CountP defines a flag which can be overridden by an environment variable
It is a thin wrapper around pflag.CountP
func Debugf ¶
func Debugf(o interface{}, text string, args ...interface{})
Debugf writes debugging output for this Object or Fs. Use this for debug only. The user must have to specify -vv to see this.
func DurationP ¶
DurationP defines a flag which can be overridden by an environment variable
It is a thin wrapper around pflag.DurationP
func Errorf ¶
func Errorf(o interface{}, text string, args ...interface{})
Errorf writes error log output for this Object or Fs. It should always be seen by the user.
func FatalError ¶
FatalError makes an error which indicates it is a fatal error and the sync should stop.
func Float64P ¶
Float64P defines a flag which can be overridden by an environment variable
It is a thin wrapper around pflag.Float64P
func HashStream ¶
HashStream will calculate hashes of all supported hash types.
func HashStreamTypes ¶
HashStreamTypes will calculate hashes of the requested hash types.
func Infof ¶
func Infof(o interface{}, text string, args ...interface{})
Infof writes info on transfers for this Object or Fs. Use this level for logging transfers, deletions and things which should appear with the -v flag.
func IntP ¶
IntP defines a flag which can be overridden by an environment variable
It is a thin wrapper around pflag.IntP
func IsFatalError ¶
IsFatalError returns true if err conforms to the Fatal interface and calling the Fatal method returns true.
func IsNoRetryError ¶
IsNoRetryError returns true if err conforms to the NoRetry interface and calling the NoRetry method returns true.
func IsRetryError ¶
IsRetryError returns true if err conforms to the Retry interface and calling the Retry method returns true.
func LogLevelPrintf ¶
LogLevelPrintf writes logs at the given level
func Logf ¶
func Logf(o interface{}, text string, args ...interface{})
Logf writes log output for this Object or Fs. This should be considered to be Info level logging. It is the default level. By default rclone should not log very much so only use this for important things the user should see. The user can filter these out with the -q flag.
func NoRetryError ¶
NoRetryError makes an error which indicates the sync shouldn't be retried.
func OpenOptionAddHTTPHeaders ¶
func OpenOptionAddHTTPHeaders(headers http.Header, options []OpenOption)
OpenOptionAddHTTPHeaders Sets each header found in options to the http.Header map provided the key was non empty.
func OpenOptionAddHeaders ¶
func OpenOptionAddHeaders(options []OpenOption, headers map[string]string)
OpenOptionAddHeaders adds each header found in options to the headers map provided the key was non empty.
func OpenOptionHeaders ¶
func OpenOptionHeaders(options []OpenOption) (headers map[string]string)
OpenOptionHeaders adds each header found in options to the headers map provided the key was non empty.
It returns a nil map if options was empty
func RetryError ¶
RetryError makes an error which indicates it would like to be retried
func RetryErrorf ¶
RetryErrorf makes an error which indicates it would like to be retried
func ShouldRetry ¶
ShouldRetry looks at an error and tries to work out if retrying the operation that caused it would be a good idea. It returns true if the error implements Timeout() or Temporary() or if the error indicates a premature closing of the connection.
func ShouldRetryHTTP ¶
ShouldRetryHTTP returns a boolean as to whether this resp deserves. It checks to see if the HTTP response code is in the slice retryErrorCodes.
func StringArrayP ¶
StringArrayP defines a flag which can be overridden by an environment variable
It sets one value only - command line flags can be used to set more.
It is a thin wrapper around pflag.StringArrayP
func StringP ¶
StringP defines a flag which can be overridden by an environment variable
It is a thin wrapper around pflag.StringP
Types ¶
type BwTimeSlot ¶
type BwTimeSlot struct {
// contains filtered or unexported fields
}
BwTimeSlot represents a bandwidth configuration at a point in time.
type BwTimetable ¶
type BwTimetable []BwTimeSlot
BwTimetable contains all configured time slots.
func (BwTimetable) LimitAt ¶
func (x BwTimetable) LimitAt(tt time.Time) BwTimeSlot
LimitAt returns a BwTimeSlot for the time requested.
func (BwTimetable) String ¶
func (x BwTimetable) String() string
String returns a printable representation of BwTimetable.
type CleanUpper ¶
type CleanUpper interface { // CleanUp the trash in the Fs // // Implement this if you have a way of emptying the trash or // otherwise cleaning up old versions of files. CleanUp() error }
CleanUpper is an optional interfaces for Fs
type ConfigInfo ¶
type ConfigInfo struct { LogLevel LogLevel StatsLogLevel LogLevel DryRun bool CheckSum bool SizeOnly bool IgnoreTimes bool IgnoreExisting bool ModifyWindow time.Duration Checkers int Transfers int ConnectTimeout time.Duration // Connect timeout Timeout time.Duration // Data channel timeout DumpHeaders bool DumpBodies bool DumpAuth bool //Filter *Filter InsecureSkipVerify bool // Skip server certificate verification //DeleteMode DeleteMode TrackRenames bool // Track file renames. LowLevelRetries int UpdateOlder bool // Skip files that are newer on the destination NoGzip bool // Disable compression MaxDepth int IgnoreSize bool IgnoreChecksum bool NoTraverse bool NoUpdateModTime bool DataRateUnit string BackupDir string Suffix string UseListR bool //BufferSize SizeSuffix TPSLimit float64 TPSLimitBurst int BindAddr net.IP DisableFeatures []string Immutable bool }
ConfigInfo is filesystem config options
type Copier ¶
type Copier interface { // Copy src to this remote using server side copy operations. // // This is stored with the remote path given // // It returns the destination Object and a possible error // // Will only be called if src.Fs().Name() == f.Name() // // If it isn't possible then return fs.ErrorCantCopy Copy(src Object, remote string) (Object, error) }
Copier is an optional interface for Fs
type CountingReader ¶
type CountingReader struct {
// contains filtered or unexported fields
}
CountingReader holds a reader and a read count of how many bytes were read so far.
func NewCountingReader ¶
func NewCountingReader(in io.Reader) *CountingReader
NewCountingReader returns a CountingReader, which will read from the given reader while keeping track of how many bytes were read.
func (*CountingReader) BytesRead ¶
func (cr *CountingReader) BytesRead() uint64
BytesRead returns how many bytes were read from the underlying reader so far.
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
Dir describes an unspecialized directory for directory/container/bucket lists
func NewDirCopy ¶
NewDirCopy creates an unspecialized copy of the Directory object passed in
func (*Dir) Items ¶
Items returns the count of items in this directory or this directory and subdirectories if known, -1 for unknown
func (*Dir) ModTime ¶
ModTime returns the modification date of the file It should return a best guess if one isn't available
type DirCacheFlusher ¶
type DirCacheFlusher interface { // DirCacheFlush resets the directory cache - used in testing // as an optional interface DirCacheFlush() }
DirCacheFlusher is an optional interface for Fs
type DirChangeNotifier ¶
type DirChangeNotifier interface { // DirChangeNotify calls the passed function with a path // of a directory that has had changes. If the implementation // uses polling, it should adhere to the given interval. DirChangeNotify(func(string), time.Duration) chan bool }
DirChangeNotifier is an optional interface for Fs
type DirEntries ¶
type DirEntries []DirEntry
DirEntries is a slice of Object or *Dir
func (DirEntries) ForDir ¶
func (ds DirEntries) ForDir(fn func(dir Directory))
ForDir runs the function supplied on every Directory in the entries
func (DirEntries) ForDirError ¶
func (ds DirEntries) ForDirError(fn func(dir Directory) error) error
ForDirError runs the function supplied on every Directory in the entries
func (DirEntries) ForObject ¶
func (ds DirEntries) ForObject(fn func(o Object))
ForObject runs the function supplied on every object in the entries
func (DirEntries) ForObjectError ¶
func (ds DirEntries) ForObjectError(fn func(o Object) error) error
ForObjectError runs the function supplied on every object in the entries
type DirEntry ¶
type DirEntry interface { // String returns a description of the Object String() string // Remote returns the remote path Remote() string // ModTime returns the modification date of the file // It should return a best guess if one isn't available ModTime() time.Time // Size returns the size of the file Size() int64 }
DirEntry provides read only information about the common subset of a Dir or Object. These are returned from directory listings - type assert them into the correct type.
type DirMover ¶
type DirMover interface { // DirMove moves src, srcRemote to this remote at dstRemote // using server side move operations. // // Will only be called if src.Fs().Name() == f.Name() // // If it isn't possible then return fs.ErrorCantDirMove // // If destination exists then return fs.ErrorDirExists DirMove(src Fs, srcRemote, dstRemote string) error }
DirMover is an optional interface for Fs
type Directory ¶
type Directory interface { DirEntry // Items returns the count of items in this directory or this // directory and subdirectories if known, -1 for unknown Items() int64 // ID returns the internal ID of this directory if known, or // "" otherwise ID() string }
Directory is a filesystem like directory provided by an Fs
type Fataler ¶
Fataler is an optional interface for error as to whether the operation should cause the entire operation to finish immediately.
This should be returned from Update or Put methods as required
type Features ¶
type Features struct { // Feature flags, whether Fs CaseInsensitive bool // has case insensitive files DuplicateFiles bool // allows duplicate files ReadMimeType bool // can read the mime type of objects WriteMimeType bool // can set the mime type of objects CanHaveEmptyDirectories bool // can have empty directories BucketBased bool // is bucket based (like s3, swift etc) // Purge all files in the root and the root directory // // Implement this if you have a way of deleting all the files // quicker than just running Remove() on the result of List() // // Return an error if it doesn't exist Purge func() error // Copy src to this remote using server side copy operations. // // This is stored with the remote path given // // It returns the destination Object and a possible error // // Will only be called if src.Fs().Name() == f.Name() // // If it isn't possible then return fs.ErrorCantCopy Copy func(src Object, remote string) (Object, error) // Move src to this remote using server side move operations. // // This is stored with the remote path given // // It returns the destination Object and a possible error // // Will only be called if src.Fs().Name() == f.Name() // // If it isn't possible then return fs.ErrorCantMove Move func(src Object, remote string) (Object, error) // DirMove moves src, srcRemote to this remote at dstRemote // using server side move operations. // // Will only be called if src.Fs().Name() == f.Name() // // If it isn't possible then return fs.ErrorCantDirMove // // If destination exists then return fs.ErrorDirExists DirMove func(src Fs, srcRemote, dstRemote string) error // DirChangeNotify calls the passed function with a path // of a directory that has had changes. If the implementation // uses polling, it should adhere to the given interval. DirChangeNotify func(func(string), time.Duration) chan bool // UnWrap returns the Fs that this Fs is wrapping UnWrap func() Fs // DirCacheFlush resets the directory cache - used in testing // as an optional interface DirCacheFlush func() // Put in to the remote path with the modTime given of the given size // // May create the object even if it returns an error - if so // will return the object and the error, otherwise will return // nil and the error // // May create duplicates or return errors if src already // exists. PutUnchecked func(in io.Reader, src ObjectInfo, options ...OpenOption) (Object, error) // PutStream uploads to the remote path with the modTime given of indeterminate size // // May create the object even if it returns an error - if so // will return the object and the error, otherwise will return // nil and the error PutStream func(in io.Reader, src ObjectInfo, options ...OpenOption) (Object, error) // MergeDirs merges the contents of all the directories passed // in into the first one and rmdirs the other directories. MergeDirs func([]Directory) error // CleanUp the trash in the Fs // // Implement this if you have a way of emptying the trash or // otherwise cleaning up old versions of files. CleanUp func() error // ListR lists the objects and directories of the Fs starting // from dir recursively into out. // // dir should be "" to start from the root, and should not // have trailing slashes. // // This should return ErrDirNotFound if the directory isn't // found. // // It should call callback for each tranche of entries read. // These need not be returned in any particular order. If // callback returns an error then the listing will stop // immediately. // // Don't implement this unless you have a more efficient way // of listing recursively that doing a directory traversal. ListR ListRFn }
Features describe the optional features of the Fs
func (*Features) Disable ¶
Disable nil's out the named feature. If it isn't found then it will log a message.
func (*Features) DisableList ¶
DisableList nil's out the comma separated list of named features. If it isn't found then it will log a message.
func (*Features) Fill ¶
Fill fills in the function pointers in the Features struct from the optional interfaces. It returns the original updated Features struct passed in.
type Fs ¶
type Fs interface { Info // List the objects and directories in dir into entries. The // entries can be returned in any order but should be for a // complete directory. // // dir should be "" to list the root, and should not have // trailing slashes. // // This should return ErrDirNotFound if the directory isn't // found. List(dir string) (entries DirEntries, err error) // NewObject finds the Object at remote. If it can't be found // it returns the error ErrorObjectNotFound. NewObject(remote string) (Object, error) // Put in to the remote path with the modTime given of the given size // // May create the object even if it returns an error - if so // will return the object and the error, otherwise will return // nil and the error Put(in io.Reader, src ObjectInfo, options ...OpenOption) (Object, error) // Mkdir makes the directory (container, bucket) // // Shouldn't return an error if it already exists Mkdir(dir string) error // Rmdir removes the directory (container, bucket) if empty // // Return an error if it doesn't exist or isn't empty Rmdir(dir string) error }
Fs is the interface a cloud storage system must provide
type HTTPOption ¶
HTTPOption defines a general purpose HTTP option
func (*HTTPOption) Header ¶
func (o *HTTPOption) Header() (key string, value string)
Header formats the option as an http header
func (*HTTPOption) Mandatory ¶
func (o *HTTPOption) Mandatory() bool
Mandatory returns whether the option must be parsed or can be ignored
func (*HTTPOption) String ¶
func (o *HTTPOption) String() string
String formats the option into human readable form
type HashSet ¶
type HashSet int
A HashSet Indicates one or more hash types.
func NewHashSet ¶
NewHashSet will create a new hash set with the hash types supplied
func (HashSet) GetOne ¶
GetOne will return a hash type. Currently the first is returned, but it could be improved to return the strongest.
type HashType ¶
type HashType int
HashType indicates a standard hashing algorithm
const ( // HashMD5 indicates MD5 support HashMD5 HashType = 1 << iota // HashSHA1 indicates SHA-1 support HashSHA1 // HashDropbox indicates Dropbox special hash // https://www.dropbox.com/developers/reference/content-hash HashDropbox // HashNone indicates no hashes are supported HashNone HashType = 0 )
type HashesOption ¶
type HashesOption struct {
Hashes HashSet
}
HashesOption defines an option used to tell the local fs to limit the number of hashes it calculates.
func (*HashesOption) Header ¶
func (o *HashesOption) Header() (key string, value string)
Header formats the option as an http header
func (*HashesOption) Mandatory ¶
func (o *HashesOption) Mandatory() bool
Mandatory returns whether the option must be parsed or can be ignored
func (*HashesOption) String ¶
func (o *HashesOption) String() string
String formats the option into human readable form
type Info ¶
type Info interface { // Name of the remote (as passed into NewFs) Name() string // Root of the remote (as passed into NewFs) Root() string // String returns a description of the FS String() string // Precision of the ModTimes in this Fs Precision() time.Duration // Returns the supported hash types of the filesystem Hashes() HashSet // Features returns the optional features of this Fs Features() *Features }
Info provides a read only interface to information about a filesystem.
type ListRCallback ¶
type ListRCallback func(entries DirEntries) error
ListRCallback defines a callback function for ListR to use
It is called for each tranche of entries read from the listing and if it returns an error, the listing stops.
type ListRFn ¶
type ListRFn func(dir string, callback ListRCallback) error
ListRFn is defines the call used to recursively list a directory
type ListRer ¶
type ListRer interface { // ListR lists the objects and directories of the Fs starting // from dir recursively into out. // // dir should be "" to start from the root, and should not // have trailing slashes. // // This should return ErrDirNotFound if the directory isn't // found. // // It should call callback for each tranche of entries read. // These need not be returned in any particular order. If // callback returns an error then the listing will stop // immediately. // // Don't implement this unless you have a more efficient way // of listing recursively that doing a directory traversal. ListR(dir string, callback ListRCallback) error }
ListRer is an optional interfaces for Fs
type LogLevel ¶
type LogLevel byte
LogLevel describes rclone's logs. These are a subset of the syslog log levels.
const ( LogLevelEmergency LogLevel = iota LogLevelAlert LogLevelCritical LogLevelError // Error - can't be suppressed LogLevelWarning LogLevelNotice // Normal logging, -q suppresses LogLevelInfo // Transfers, needs -v LogLevelDebug // Debug level, needs -vv )
Log levels. These are the syslog levels of which we only use a subset.
LOG_EMERG system is unusable LOG_ALERT action must be taken immediately LOG_CRIT critical conditions LOG_ERR error conditions LOG_WARNING warning conditions LOG_NOTICE normal, but significant, condition LOG_INFO informational message LOG_DEBUG debug-level message
type MergeDirser ¶
type MergeDirser interface { // MergeDirs merges the contents of all the directories passed // in into the first one and rmdirs the other directories. MergeDirs([]Directory) error }
MergeDirser is an option interface for Fs
type MimeTyper ¶
type MimeTyper interface { // MimeType returns the content type of the Object if // known, or "" if not MimeType() string }
MimeTyper is an optional interface for Object
type Mover ¶
type Mover interface { // Move src to this remote using server side move operations. // // This is stored with the remote path given // // It returns the destination Object and a possible error // // Will only be called if src.Fs().Name() == f.Name() // // If it isn't possible then return fs.ErrorCantMove Move(src Object, remote string) (Object, error) }
Mover is an optional interface for Fs
type MultiHasher ¶
type MultiHasher struct {
// contains filtered or unexported fields
}
A MultiHasher will construct various hashes on all incoming writes.
func NewMultiHasher ¶
func NewMultiHasher() *MultiHasher
NewMultiHasher will return a hash writer that will write all supported hash types.
func NewMultiHasherTypes ¶
func NewMultiHasherTypes(set HashSet) (*MultiHasher, error)
NewMultiHasherTypes will return a hash writer that will write the requested hash types.
func (*MultiHasher) Size ¶
func (m *MultiHasher) Size() int64
Size returns the number of bytes written
func (*MultiHasher) Sums ¶
func (m *MultiHasher) Sums() map[HashType]string
Sums returns the sums of all accumulated hashes as hex encoded strings.
type NoRetrier ¶
NoRetrier is an optional interface for error as to whether the operation should not be retried at a high level.
If only NoRetry errors are returned in a sync then the sync won't be retried.
This should be returned from Update or Put methods as required
type Object ¶
type Object interface { ObjectInfo // SetModTime sets the metadata on the object to set the modification date SetModTime(time.Time) error // Open opens the file for read. Call Close() on the returned io.ReadCloser Open(options ...OpenOption) (io.ReadCloser, error) // Update in to the object with the modTime given of the given size Update(in io.Reader, src ObjectInfo, options ...OpenOption) error // Removes this object Remove() error }
Object is a filesystem like object provided by an Fs
type ObjectInfo ¶
type ObjectInfo interface { DirEntry // Fs returns read only access to the Fs that this object is part of Fs() Info // Hash returns the selected checksum of the file // If no checksum is available it returns "" Hash(HashType) (string, error) // Storable says whether this object can be stored Storable() bool }
ObjectInfo provides read only information about an object.
func NewStaticObjectInfo ¶
func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable bool, hashes map[HashType]string, fs Info) ObjectInfo
NewStaticObjectInfo returns a static ObjectInfo If hashes is nil and fs is not nil, the hash map will be replaced with empty hashes of the types supported by the fs.
type OpenOption ¶
type OpenOption interface { fmt.Stringer // Header returns the option as an HTTP header Header() (key string, value string) // Mandatory returns whether this option can be ignored or not Mandatory() bool }
OpenOption is an interface describing options for Open
type Purger ¶
type Purger interface { // Purge all files in the root and the root directory // // Implement this if you have a way of deleting all the files // quicker than just running Remove() on the result of List() // // Return an error if it doesn't exist Purge() error }
Purger is an optional interfaces for Fs
type PutStreamer ¶
type PutStreamer interface { // PutStream uploads to the remote path with the modTime given of indeterminate size // // May create the object even if it returns an error - if so // will return the object and the error, otherwise will return // nil and the error PutStream(in io.Reader, src ObjectInfo, options ...OpenOption) (Object, error) }
PutStreamer is an optional interface for Fs
type PutUncheckeder ¶
type PutUncheckeder interface { // Put in to the remote path with the modTime given of the given size // // May create the object even if it returns an error - if so // will return the object and the error, otherwise will return // nil and the error // // May create duplicates or return errors if src already // exists. PutUnchecked(in io.Reader, src ObjectInfo, options ...OpenOption) (Object, error) }
PutUncheckeder is an optional interface for Fs
type RangeOption ¶
RangeOption defines an HTTP Range option with start and end. If either start or end are < 0 then they will be omitted.
func (*RangeOption) Header ¶
func (o *RangeOption) Header() (key string, value string)
Header formats the option as an http header
func (*RangeOption) Mandatory ¶
func (o *RangeOption) Mandatory() bool
Mandatory returns whether the option must be parsed or can be ignored
func (*RangeOption) String ¶
func (o *RangeOption) String() string
String formats the option into human readable form
type Retrier ¶
Retrier is an optional interface for error as to whether the operation should be retried at a high level.
This should be returned from Update or Put methods as required
type SeekOption ¶
type SeekOption struct {
Offset int64
}
SeekOption defines an HTTP Range option with start only.
func (*SeekOption) Header ¶
func (o *SeekOption) Header() (key string, value string)
Header formats the option as an http header
func (*SeekOption) Mandatory ¶
func (o *SeekOption) Mandatory() bool
Mandatory returns whether the option must be parsed or can be ignored
func (*SeekOption) String ¶
func (o *SeekOption) String() string
String formats the option into human readable form
type SizeSuffix ¶
type SizeSuffix int64
SizeSuffix is parsed by flag with k/M/G suffixes
func (SizeSuffix) String ¶
func (x SizeSuffix) String() string
String turns SizeSuffix into a string
func (SizeSuffix) Unit ¶
func (x SizeSuffix) Unit(unit string) string
Unit turns SizeSuffix into a string with a unit