Documentation ¶
Index ¶
- Variables
- func AddError(err error) bool
- func ByteCountSI(b int64) string
- func DoStashCPSingle(sourceFile string, destination string, methods []string, recursive bool) (int64, error)
- func DownloadHTTP(transfer TransferDetails, dest string, token string) (int64, error)
- func ErrorsRetryable() bool
- func Find(slice []string, val string) (int, bool)
- func GetBestStashcache(cacheListName string) ([]string, error)
- func GetErrors() string
- func HasPort(host string) bool
- func IsDir(url *url.URL, token string, namespace Namespace) (bool, error)
- func IsRetryable(err error) bool
- func UploadFile(src string, dest *url.URL, token string, namespace Namespace) (int64, error)
- type ConnectionSetupError
- type Namespace
- type OptionsStruct
- type ProgressReader
- type SlowTransferError
- type TransferDetails
- type TransferResults
Constants ¶
This section is empty.
Variables ¶
var CachesJsonLocation string
var NearestCache string
Nearest cache
var NearestCacheList []string
List of caches, in order from closest to furthest
Functions ¶
func ByteCountSI ¶
func DoStashCPSingle ¶
func DoStashCPSingle(sourceFile string, destination string, methods []string, recursive bool) (int64, error)
Start the transfer, whether read or write back
func DownloadHTTP ¶
func DownloadHTTP(transfer TransferDetails, dest string, token string) (int64, error)
DownloadHTTP - Perform the actual download of the file
func ErrorsRetryable ¶
func ErrorsRetryable() bool
ErrorsRetryable returns if the errors in the stack are retryable later
func Find ¶
Find takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false. From https://golangcode.com/check-if-element-exists-in-slice/
func GetBestStashcache ¶
func IsRetryable ¶
IsRetryable will return true if the error is retryable
Types ¶
type ConnectionSetupError ¶
ConnectionSetupError is an error that is returned when a connection to the remote server fails
func (*ConnectionSetupError) Error ¶
func (e *ConnectionSetupError) Error() string
func (*ConnectionSetupError) Is ¶
func (e *ConnectionSetupError) Is(target error) bool
func (*ConnectionSetupError) Unwrap ¶
func (e *ConnectionSetupError) Unwrap() error
type Namespace ¶
type Namespace struct { Path string `yaml:"path"` ReadHTTPS bool `yaml:"readhttps"` UseTokenOnRead bool `yaml:"usetokenonread"` WriteBackHost string `yaml:"writebackhost"` DirListHost string `yaml:"dirlisthost"` }
Namespace holds the structure of stash namespaces
func GetNamespaces ¶
func MatchNamespace ¶
type OptionsStruct ¶
var Options OptionsStruct
type ProgressReader ¶
type ProgressReader struct {
// contains filtered or unexported fields
}
ProgressReader wraps the io.Reader to get progress Adapted from https://stackoverflow.com/questions/26050380/go-tracking-post-request-progress
func (*ProgressReader) Close ¶
func (pr *ProgressReader) Close() error
Close implments the close function of io.Closer
type SlowTransferError ¶
type SlowTransferError struct { BytesTransferred int64 BytesPerSecond int64 BytesTotal int64 Duration time.Duration }
SlowTransferError is an error that is returned when a transfer takes longer than the configured timeout
func (*SlowTransferError) Error ¶
func (e *SlowTransferError) Error() string
func (*SlowTransferError) Is ¶
func (e *SlowTransferError) Is(target error) bool
type TransferDetails ¶
type TransferDetails struct { // Url is the url.URL of the cache and port Url url.URL // Proxy specifies if a proxy should be used Proxy bool }
func NewTransferDetails ¶
func NewTransferDetails(cache string, https bool) []TransferDetails
NewTransferDetails creates the TransferDetails struct with the given cache