Documentation ¶
Index ¶
- Constants
- Variables
- func AppDaemonizedEx(name, pidfile, stderr string) error
- func AppDir() string
- func AppExit(name string, pidfile string, force bool) error
- func AppImmobilized(pidfile string) error
- func AppIsRunningEx(pidfile string) (int, error)
- func AppRestart(name string, pidfile string, arg ...string) error
- func ByteCat(sv ...string) []byte
- func ErrorCat(sv ...string) error
- func EscapeNonBmpRune(s string) string
- func FileIsOpened(path string) bool
- func HasNonBmpRune(s string) bool
- func IsPathReachable(s string) bool
- func MakeError(sv ...string) error
- func Maximum64(x, y int64) int64
- func Minimum64(x, y int64) int64
- func NewAppRestart(name, pidfile string) error
- func NewUUID() (string, error)
- func PathDirExists(p string) bool
- func PathExists(p string) bool
- func PathNodeCanonicalize(u string) string
- func PathNodeCanonicalizeStrict(u string) string
- func PathSplit(p string, suggestcap int) []string
- func ReadFileFirstLine(path string) (string, error)
- func StrCat(sv ...string) string
- func StrSplitSkipEmpty(s string, sep byte, suggestcap int) []string
- func StrSplitSkipSpecNoEmpty(s, spec string, sep byte, suggestcap int) []string
- func WarpError(err error, sv ...string) error
- type ArgvContainer
- type ArgvEngine
- type Derivator
- type Job
- type Limiter
- type RoutinePool
- type TaskFunc
Constants ¶
const ( Kilo int64 = 1024 KB int64 = Kilo MB int64 = KB * Kilo GB int64 = MB * Kilo TB int64 = GB * Kilo PB int64 = TB * Kilo EB int64 = PB * Kilo // MAX UINT64MAX uint64 = ^uint64(0) INT64MAX int64 = int64(^uint64(0) >> 1) INT64MIN int64 = -int64(^uint64(0) >> 1) UINT32MAX uint32 = ^uint32(0) INT32MAX int32 = int32(^uint32(0) >> 1) INT32MIN int32 = -int32(^uint32(0) >> 1) UINT16MAX uint16 = ^uint16(0) INT16MAX int16 = int16(^uint16(0) >> 1) INT16MIN int16 = -int16(^uint16(0) >> 1) UINT8MAX uint8 = ^uint8(0) INT8MAX int8 = int8(^uint8(0) >> 1) INT8MIN int8 = -int8(^uint8(0) >> 1) )
Conversion
const ( REQUIRED int = iota NOARG OPTIONAL )
TODO
Variables ¶
var ( ErrPendingOverFlow = errors.New("Pending queue overflowed, please try again later") ErrPendingTimeout = errors.New("Pending timeout, please try again later") )
var ( ErrNilArgv = errors.New("argv is nil") ErrUnExpectedArg = errors.New("unexpected argument '-'") )
error
Functions ¶
func AppDaemonizedEx ¶
AppDaemonizedEx todo
func AppIsRunningEx ¶
AppIsRunningEx daemon is running
func AppRestart ¶
AppRestart restart app
func FileIsOpened ¶ added in v0.7.9
func HasNonBmpRune ¶
HasNonBmpRune todo BMP -> U+0000 to U+FFFF https://www.sttmedia.com/unicode-basiclingualplane
func NewAppRestart ¶ added in v0.6.6
new app restart only send SIGUSR2
func NewUUID ¶
NewUUID create v4 uuid More powerful UUID libraries can be used: https://github.com/google/uuid
func PathNodeCanonicalizeStrict ¶ added in v0.5.6
PathNodeCanonicalizeStrict todo
func ReadFileFirstLine ¶
ReadFileFirstLine read file first line
func StrCat ¶
StrCat cat strings: You should know that StrCat gradually builds advantages only when the number of parameters is> 2.
func StrSplitSkipEmpty ¶
StrSplitSkipEmpty skip empty string suggestcap is suggest cap
func StrSplitSkipSpecNoEmpty ¶
StrSplitSkipSpecNoEmpty todo
Types ¶
type ArgvContainer ¶
ArgvContainer todo
type ArgvEngine ¶
type ArgvEngine struct { SubcmdMode bool // subcmd mode // contains filtered or unexported fields }
ArgvEngine todo
func (*ArgvEngine) Execute ¶
func (ae *ArgvEngine) Execute(argv []string, ac ArgvContainer) error
Execute todo
type Derivator ¶ added in v0.2.0
type Derivator struct {
// contains filtered or unexported fields
}
Derivator expand env engine
func NewDerivator ¶ added in v0.2.0
func NewDerivator() *Derivator
NewDerivator create env derivative
func (*Derivator) AddBashCompatible ¶ added in v0.2.0
func (de *Derivator) AddBashCompatible()
AddBashCompatible $0~$9
type Job ¶ added in v0.5.5
type Job func()
Job Represents user request, function which should be executed in some worker.
type Limiter ¶ added in v0.7.1
type Limiter struct {
// contains filtered or unexported fields
}
func NewLimiter ¶ added in v0.7.1
return a new rate limiter instance.
params:
max: Number of processing tasks maxPending: Number of pending tasks after processing tasks is overflowed
func (*Limiter) Processing ¶ added in v0.7.1
return number of processing tasks
func (*Limiter) ProcessingAndPending ¶ added in v0.7.2
return number of processing and pending tasks
func (*Limiter) SetMaxPending ¶ added in v0.7.4
Set the maximum number of pending tasks
func (*Limiter) SetMaxProcessing ¶ added in v0.7.4
Set the maximum number of processing tasks
type RoutinePool ¶ added in v0.5.5
type RoutinePool struct { JobQueue chan Job NumberWorkers int // contains filtered or unexported fields }
RoutinePool todo
func NewRoutinePool ¶ added in v0.5.5
func NewRoutinePool(numWorkers int, jobQueueLen int) *RoutinePool
NewRoutinePool Will make pool of gorouting workers. numWorkers - how many workers will be created for this pool queueLen - how many jobs can we accept until we block
Returned object contains JobQueue reference, which you can use to send job to pool.
func (*RoutinePool) JobDone ¶ added in v0.5.5
func (p *RoutinePool) JobDone()
JobDone In case you are using WaitAll fn, you should call this method every time your job is done.
If you are not using WaitAll then we assume you have your own way of synchronizing.
func (*RoutinePool) Release ¶ added in v0.5.5
func (p *RoutinePool) Release()
Release Will release resources used by pool
func (*RoutinePool) WaitAll ¶ added in v0.5.5
func (p *RoutinePool) WaitAll()
WaitAll Will wait for all jobs to finish.
func (*RoutinePool) WaitCount ¶ added in v0.5.5
func (p *RoutinePool) WaitCount(count int)
WaitCount How many jobs we should wait when calling WaitAll. It is using WaitGroup Add/Done/Wait