Documentation ¶
Index ¶
- Constants
- Variables
- func AnyError(callback func(error), functions ...func() error)
- func Bool(bool bool) *bool
- func BuildPath(resourcePath string, values interface{}) (string, error)
- func BuildPathSpecTest(t *testing.T, mutex *sync.Mutex, tt PathSpecTest, sourceFs ReadWriteFs, ...)
- func ChangeDir(fs ReadWriteFs, relativePath string, fullPath string, mutex *sync.Mutex) (func(), bool, error)
- func CheckRequired(iStruct interface{}) error
- func CloseBody(res *http.Response)
- func CopyAt(dst io.WriterAt, writeOff int64, src io.Reader) (written int64, err error)
- func CreateError(i interface{}, name string) error
- func ExpandTilde(path string) string
- func Interface() interface{}
- func IsHTML(res *http.Response) bool
- func IsJSON(res *http.Response) bool
- func IsNonOkStatus(res *http.Response) bool
- func IsOkStatus(res *http.Response) bool
- func IsStatus(status int) func(res *http.Response) error
- func JSONEmptyValue(v reflect.Type) string
- func NewReader(ctx context.Context, r io.ReadCloser) io.ReadCloser
- func NewReaderAt(ctx context.Context, r io.ReaderAt) io.ReaderAt
- func NonJSONError(res *http.Response) error
- func NonOkError(res *http.Response) error
- func NonOkErrorCustom(callbacks ...func(error) error) func(res *http.Response) error
- func NormalizeForComparison(path string) string
- func NotStatus(status int) func(res *http.Response) error
- func PathEscape(path string) (string, error)
- func ResponseErrors(res *http.Response, errorFunc ...func(res *http.Response) error) error
- func String(string string) *string
- func Time(t time.Time) *time.Time
- func UnWrapBool(b *bool) bool
- func UrlJoinNoEscape(paths ...string) string
- func UrlLastSegment(path string) (rest string, lastSegment string)
- type Cmd
- type ConcurrencyManager
- type ConcurrencyManagerWithSubWorker
- type ConstrainedWorkGroup
- func (cw *ConstrainedWorkGroup) Done()
- func (cw *ConstrainedWorkGroup) Max() int
- func (cw *ConstrainedWorkGroup) NewSubWorker() ConcurrencyManager
- func (cw *ConstrainedWorkGroup) RemainingCapacity() int
- func (cw *ConstrainedWorkGroup) RunningCount() int
- func (cw *ConstrainedWorkGroup) Wait()
- func (cw *ConstrainedWorkGroup) WaitAllDone()
- func (cw *ConstrainedWorkGroup) WaitForADone() bool
- func (cw *ConstrainedWorkGroup) WaitWithContext(ctx context.Context) bool
- type DirEntry
- type ErrorWithOriginalResponse
- type ExeCmd
- type ExportValues
- type FSWithContext
- type FileWithContext
- type Iter
- func (i *Iter) Current() interface{}
- func (i *Iter) EOFPage() bool
- func (i *Iter) Err() error
- func (i *Iter) ExportParams() (ExportValues, error)
- func (i *Iter) GetCursor() string
- func (i *Iter) GetPage() bool
- func (i *Iter) GetParams() *ListParams
- func (i *Iter) Next() bool
- func (i *Iter) NextPage() bool
- func (i *Iter) Paging() bool
- func (i *Iter) SetCursor(cursor string)
- type IterChan
- type IterI
- type IterPagingI
- type KeyedMutex
- type ListParams
- type ListParamsContainer
- type LocalFileSystem
- func (w LocalFileSystem) Chdir(dir string) error
- func (w LocalFileSystem) Create(path string) (io.WriteCloser, error)
- func (w LocalFileSystem) Getwd() (string, error)
- func (w LocalFileSystem) MkdirAll(path string, mode fs.FileMode) error
- func (w LocalFileSystem) MkdirTemp(dir, pattern string) (string, error)
- func (w LocalFileSystem) Open(path string) (fs.File, error)
- func (w LocalFileSystem) PathJoin(paths ...string) string
- func (w LocalFileSystem) PathSeparator() string
- func (w LocalFileSystem) RelPath(parent, child string) (string, error)
- func (w LocalFileSystem) Remove(path string) error
- func (w LocalFileSystem) RemoveAll(path string) error
- func (w LocalFileSystem) SplitPath(path string) (string, string)
- func (w LocalFileSystem) TempDir() string
- type Map
- type OnPageError
- type Params
- type Path
- func (p Path) ConvertEmptyToRoot() Path
- func (p Path) EndingSlash() bool
- func (p Path) Join(str ...string) Path
- func (p Path) NormalizePathSystemForAPI() Path
- func (p Path) PathSeparator() string
- func (p Path) Pop() string
- func (p Path) PruneEndingSlash() Path
- func (p Path) PruneStartingSlash() Path
- func (p Path) String() string
- func (p Path) SwitchPathSeparator(separator string) Path
- type PathSpecArgs
- type PathSpecEntry
- type PathSpecTest
- type ProgressWriter
- type Query
- type Queue
- type ReadWriteFs
- type ReaderAtCloser
- type Resource
- type ResourceOut
- type ResponseError
- type Signal
- type StatefulDirectory
- type SubWorker
- type TypedIterI
- type UnmarshalJSON
- type Values
- type Walk
- type WithContextReader
- type WithContextReaderAt
- type WritableFs
- type WriterAndAt
Constants ¶
const (
BasePart = int64(1024*1024*5 + 1024*1024/3)
)
const (
URLPathSeparator = "/"
)
Variables ¶
var PartSizes = partSizes()
PartSizes return 10k parts that add up to 4.9 TB
Functions ¶
func BuildPathSpecTest ¶
func BuildPathSpecTest(t *testing.T, mutex *sync.Mutex, tt PathSpecTest, sourceFs ReadWriteFs, destinationFs ReadWriteFs, cmdBuilder func(source, destination string) Cmd)
func CheckRequired ¶
func CheckRequired(iStruct interface{}) error
func CreateError ¶
func ExpandTilde ¶
func IsNonOkStatus ¶
func IsOkStatus ¶
func JSONEmptyValue ¶
func NewReader ¶
func NewReader(ctx context.Context, r io.ReadCloser) io.ReadCloser
NewReader gets a context-aware io.Reader.
func NewReaderAt ¶
NewReader gets a context-aware io.Reader.
func NonJSONError ¶
func NonOkError ¶
func NonOkErrorCustom ¶
func NormalizeForComparison ¶
func PathEscape ¶
func ResponseErrors ¶
func UnWrapBool ¶
func UrlJoinNoEscape ¶
func UrlLastSegment ¶
Types ¶
type ConcurrencyManager ¶
type ConcurrencyManager interface { // Wait until a slot is available for the new goroutine. Wait() // Done Mark a goroutine as finished Done() // WaitAllDone Wait for all goroutines are done WaitAllDone() // RunningCount Returns the number of goroutines which are running RunningCount() int // WaitWithContext Acquires a semaphore to allow a new goroutine to run or returns false if the context is done WaitWithContext(ctx context.Context) bool // WaitForADone Blocks until at least one goroutine has completed. WaitForADone() bool }
type ConcurrencyManagerWithSubWorker ¶
type ConcurrencyManagerWithSubWorker interface { ConcurrencyManager NewSubWorker() ConcurrencyManager }
type ConstrainedWorkGroup ¶
type ConstrainedWorkGroup struct {
// contains filtered or unexported fields
}
func NewConstrainedWorkGroup ¶
func NewConstrainedWorkGroup(maxConcurrency int) *ConstrainedWorkGroup
func (*ConstrainedWorkGroup) Done ¶
func (cw *ConstrainedWorkGroup) Done()
func (*ConstrainedWorkGroup) Max ¶
func (cw *ConstrainedWorkGroup) Max() int
func (*ConstrainedWorkGroup) NewSubWorker ¶
func (cw *ConstrainedWorkGroup) NewSubWorker() ConcurrencyManager
func (*ConstrainedWorkGroup) RemainingCapacity ¶
func (cw *ConstrainedWorkGroup) RemainingCapacity() int
func (*ConstrainedWorkGroup) RunningCount ¶
func (cw *ConstrainedWorkGroup) RunningCount() int
func (*ConstrainedWorkGroup) Wait ¶
func (cw *ConstrainedWorkGroup) Wait()
func (*ConstrainedWorkGroup) WaitAllDone ¶
func (cw *ConstrainedWorkGroup) WaitAllDone()
func (*ConstrainedWorkGroup) WaitForADone ¶
func (cw *ConstrainedWorkGroup) WaitForADone() bool
func (*ConstrainedWorkGroup) WaitWithContext ¶
func (cw *ConstrainedWorkGroup) WaitWithContext(ctx context.Context) bool
type DirEntry ¶
func DirEntryWalkFile ¶
type ErrorWithOriginalResponse ¶
type ErrorWithOriginalResponse struct {
// contains filtered or unexported fields
}
func (ErrorWithOriginalResponse) OriginalResponse ¶
func (u ErrorWithOriginalResponse) OriginalResponse() interface{}
func (ErrorWithOriginalResponse) ProcessError ¶
func (u ErrorWithOriginalResponse) ProcessError(data []byte, err error, t interface{}) error
type ExportValues ¶
type Iter ¶
type Iter struct { Query ListParams ListParamsContainer Params []interface{} CurrentIndex int Values *[]interface{} Cursor string Error error OnPageError }
func (*Iter) Err ¶
Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.
func (*Iter) ExportParams ¶
func (i *Iter) ExportParams() (ExportValues, error)
func (*Iter) GetParams ¶
func (i *Iter) GetParams() *ListParams
func (*Iter) Next ¶
Next iterates the results in i.Current() or i.`ResourceName`(). It returns true until there are no results remaining. To adjust the number of results set ListParams.PerPage. To have it auto-paginate set ListParams.MaxPages, default is 1.
To iterate over all results use the following pattern.
for i.Next() { i.Current() }
type IterChan ¶
type IterPagingI ¶
type KeyedMutex ¶
type KeyedMutex struct {
// contains filtered or unexported fields
}
func NewKeyedMutex ¶
func NewKeyedMutex() KeyedMutex
func (KeyedMutex) Lock ¶
func (s KeyedMutex) Lock(key interface{})
func (KeyedMutex) Unlock ¶
func (s KeyedMutex) Unlock(key interface{})
type ListParams ¶
type ListParams struct { Page int64 `json:"page,omitempty" url:"page,omitempty" required:"false"` PerPage int64 `json:"per_page,omitempty" url:"per_page,omitempty" required:"false"` Cursor string `json:"cursor,omitempty" url:"cursor,omitempty" required:"false"` MaxPages int64 `json:"-" url:"-"` }
func (*ListParams) GetListParams ¶
func (p *ListParams) GetListParams() *ListParams
GetListParams returns a ListParams struct (itself). It exists because any structs that embed ListParams will inherit it, and thus implement the ListParamsContainer interface.
type ListParamsContainer ¶
type ListParamsContainer interface {
GetListParams() *ListParams
}
ListParamsContainer is a general interface for which all list parameter structs should comply. They achieve this by embedding a ListParams struct and inheriting its implementation of this interface.
type LocalFileSystem ¶
type LocalFileSystem struct{}
func (LocalFileSystem) Chdir ¶
func (w LocalFileSystem) Chdir(dir string) error
func (LocalFileSystem) Create ¶
func (w LocalFileSystem) Create(path string) (io.WriteCloser, error)
func (LocalFileSystem) Getwd ¶
func (w LocalFileSystem) Getwd() (string, error)
func (LocalFileSystem) MkdirAll ¶
func (w LocalFileSystem) MkdirAll(path string, mode fs.FileMode) error
func (LocalFileSystem) MkdirTemp ¶
func (w LocalFileSystem) MkdirTemp(dir, pattern string) (string, error)
func (LocalFileSystem) PathJoin ¶
func (w LocalFileSystem) PathJoin(paths ...string) string
func (LocalFileSystem) PathSeparator ¶
func (w LocalFileSystem) PathSeparator() string
func (LocalFileSystem) RelPath ¶
func (w LocalFileSystem) RelPath(parent, child string) (string, error)
func (LocalFileSystem) Remove ¶
func (w LocalFileSystem) Remove(path string) error
func (LocalFileSystem) RemoveAll ¶
func (w LocalFileSystem) RemoveAll(path string) error
func (LocalFileSystem) TempDir ¶
func (w LocalFileSystem) TempDir() string
type OnPageError ¶
type Path ¶
func NewUrlPath ¶
func (Path) ConvertEmptyToRoot ¶
func (Path) EndingSlash ¶
func (Path) NormalizePathSystemForAPI ¶
func (Path) PathSeparator ¶
func (Path) PruneEndingSlash ¶
func (Path) PruneStartingSlash ¶
func (Path) SwitchPathSeparator ¶
type PathSpecArgs ¶
type PathSpecEntry ¶
type PathSpecTest ¶
type PathSpecTest struct { Name string Args PathSpecArgs Dest []PathSpecEntry Src []PathSpecEntry }
func PathSpec ¶
func PathSpec(srcPathSeparator string, destPathSeparator string) []PathSpecTest
type ProgressWriter ¶
type ProgressWriter struct { WriterAndAt ProgressWatcher func(int64) }
func (ProgressWriter) Close ¶
func (w ProgressWriter) Close() error
type ReadWriteFs ¶
type ReadWriteFs interface { WritableFs fs.FS }
type ReaderAtCloser ¶
type ReaderAtCloser interface { io.ReaderAt io.ReadCloser }
type Resource ¶
type Resource struct { Path string Params interface{} Method string Entity UnmarshalJSON }
func (Resource) Out ¶
func (r Resource) Out() (ResourceOut, error)
type ResourceOut ¶
type ResponseError ¶
type ResponseError struct { StatusCode int // contains filtered or unexported fields }
func (ResponseError) Error ¶
func (r ResponseError) Error() string
type StatefulDirectory ¶
type SubWorker ¶
type SubWorker struct {
// contains filtered or unexported fields
}
func (*SubWorker) RunningCount ¶
func (*SubWorker) WaitAllDone ¶
func (sw *SubWorker) WaitAllDone()
func (*SubWorker) WaitForADone ¶
WaitForADone Blocks until at least one goroutine has completed.
type TypedIterI ¶
type UnmarshalJSON ¶
type Walk ¶
type WithContextReader ¶
type WithContextReaderAt ¶
type WritableFs ¶
type WritableFs interface { MkdirAll(string, fs.FileMode) error MkdirTemp(dir, pattern string) (string, error) TempDir() string Create(string) (io.WriteCloser, error) RemoveAll(string) error Remove(string) error PathSeparator() string PathJoin(...string) string RelPath(parent, child string) (string, error) SplitPath(path string) (string, string) }
Source Files ¶
- anyerror.go
- concurrencymanager.go
- constrainedwaitgroup.go
- copyat.go
- errorwithoriginalresponse.go
- expandtilde.go
- interface.go
- iter.go
- iterchan.go
- keyedmutex.go
- localfilesystem.go
- map.go
- normalizeforcomparison.go
- params.go
- partsize.go
- path.go
- pathspec.go
- pointers.go
- progresswriter.go
- query.go
- queue.go
- readerctx.go
- required.go
- responseerrors.go
- signal.go
- string.go
- urljoinnoexcape.go
- walk.go