Documentation ¶
Index ¶
- Variables
- func CheckError(fn func() error)
- func CreateFile(p string) (f *os.File, err error)
- func Dir() (string, error)
- func Expand(path string) (string, error)
- func FromTaskContext(ctx context.Context) string
- func GetMarkers(n int) []byte
- func IsTimeoutError(err error) bool
- func Join(in ...string) string
- func NewTaskContext(ctx context.Context, t string) context.Context
- func Recover()
- func Relative(full, prefix string) string
- type Conn
- type ContextKey
- type Dialer
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = &http.Client{ Timeout: 0, Transport: &http.Transport{ DialContext: DefaultDialer.DialContext, MaxIdleConns: 100, MaxIdleConnsPerHost: 10, IdleConnTimeout: time.Second * 20, TLSHandshakeTimeout: time.Second * 10, ExpectContinueTimeout: 2 * time.Second, }, }
DefaultClient is the default HTTP client for qscamel.
var DefaultDialer = &Dialer{ &net.Dialer{ DualStack: false, Timeout: time.Second * 30, }, time.Second * 30, time.Second * 30, }
DefaultDialer is the default dialer for qscamel.
var DisableCache bool
DisableCache will disable caching of the home directory. Caching is enabled by default.
Functions ¶
func CheckError ¶
func CheckError(fn func() error)
CheckError will execute the func, handle it's panic and error
func CreateFile ¶
CreateFile will create a file recursively.
func Dir ¶
Dir returns the home directory for the executing user.
This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.
func Expand ¶
Expand expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is.
func FromTaskContext ¶
FromTaskContext will extract task name from context.
func GetMarkers ¶
GetMarkers will generate markers for every list worker.
func IsTimeoutError ¶
IsTimeoutError will check whether the err is a timeout error.
func NewTaskContext ¶
NewTaskContext will create a ctx with task name.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a generic stream-oriented network connection.
func (*Conn) SetReadTimeout ¶
SetReadTimeout will set the conn's read timeout.
func (*Conn) SetWriteTimeout ¶
SetWriteTimeout will set the conn's write timeout.
type ContextKey ¶
type ContextKey string
ContextKey is the type for context key.
const (
ContextKeyTask ContextKey = "task"
)
Context keys.
type Dialer ¶
Dialer is wrapped dialer provided by qingstor go sdk.
We provide this dialer wrapper ReadTimeout & WriteTimeout attributes into connection object. This timeout is for individual buffer I/O operation like other language (python, perl... etc), so don't bother with SetDeadline or stupid nethttp.Client timeout.