Documentation ¶
Index ¶
- Constants
- func CallTimeout(f func(time.Duration) bool, timeout time.Duration)
- func FlagsForAccess(flag int) int
- func FlagsForOpen(flag int) int
- func IsTimeoutErr(err error) bool
- func OpenOrCreate(creator func(bool) error, flag int) (bool, error)
- func SyscallErrHasCode(err error, code syscall.Errno) bool
Constants ¶
View Source
const (
ERROR_TIMEOUT = 1460
)
View Source
const ( // O_NONBLOCK flag tell some functions not to block. // Its value does not interfere with O_* constants from 'os' package. O_NONBLOCK = syscall.O_NONBLOCK )
Variables ¶
This section is empty.
Functions ¶
func CallTimeout ¶ added in v0.4.0
CallTimeout calls f in a loop allowing it to run for at least 'timeout'. It calls f, measuring its runtime:
if f returned false, or its cumulative runtime exceeded timeout, CallTimeout returns. otherwise CallTimeout subtracts runtime from timeout anf calls 'f' with the updated value.
func FlagsForAccess ¶
FlagsForAccess extracts os.O_RDONLY, os.O_WRONLY, os.O_RDWR, and O_NONBLOCK flag values.
func FlagsForOpen ¶
FlagsForOpen extracts os.O_CREATE and os.O_EXCL flag values.
func IsTimeoutErr ¶ added in v0.3.0
IsTimeoutErr returns true, if the given error is a temporary syscall error.
func OpenOrCreate ¶
OpenOrCreate performs open/create file operation according to the given mode. It allows to find out if the object was opened or created.
creator is the function which performs actual operation. It is called with 'true', if it must create an object, and with false otherwise. It must return an 'not exists error' if the param is false, and the object does not exist. It must return an 'already exists error' if the param is true, and the object already exists. flag is the combination of open flags from os package. If flag == os.O_CREATE, OpenOrCreate makes several attempts to open or create an object, and analyzes the return error. It tries to open the object first.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.