-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathants-api.go
More file actions
102 lines (76 loc) · 3.34 KB
/
ants-api.go
File metadata and controls
102 lines (76 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package pants
import "github.com/snivilised/pants/internal/third/ants"
type (
// ConditionalOption allows the delaying of inception of the option until
// the condition is known to be true. This is in contrast to IfOption where the
// Option is pre-created, regardless of the condition.
ConditionalOption = ants.ConditionalOption
// IDGenerator is a sequential unique id generator interface
IDGenerator = ants.IDGenerator
// InputEnvelope
InputEnvelope = ants.InputEnvelope
// InputParam
InputParam = ants.InputParam
// Option represents the ants functional option.
Option = ants.Option
// Option represents the ants options.
Options = ants.Options
// PoolFunc ants pool function
PoolFunc = ants.PoolFunc
// RoutineID the identifier representing the underlying worker.
RoutineID = ants.RoutineID
// Sequential represents te ants sequential ID generator
Sequential = ants.Sequential
// TaskFunc ants task function
TaskFunc = ants.TaskFunc
)
var (
// IfOption enables options to be conditional. IfOption condition evaluates to true
// then the option is returned, otherwise nil.
IfOption = ants.IfOption
// IfElseOption provides conditional option selection similar to IfOption but
// handles both true and false cases. It accepts a condition and two
// ConditionalOption functions:
// tOption (returned when condition is true) and
// fOption (returned when condition is false).
IfElseOption = ants.IfElseOption
// IfOptionF uses ConditionalOption to delay the creation of the option
// until after the condition is known to be true.
IfOptionF = ants.IfOptionF
// IfElseOptionF provides conditional option selection similar to IfOptionF but
// handles both true and false cases. It accepts a condition and two
// ConditionalOption functions:
// tOption (executed when condition is true) and
// fOption (executed when condition is false).
IfElseOptionF = ants.IfElseOptionF
// WithDisablePurge indicates whether we turn off automatically purge
WithDisablePurge = ants.WithDisablePurge
// WithExpiryDuration sets up the interval time of cleaning up goroutines
WithExpiryDuration = ants.WithExpiryDuration
// WithGenerator sets up an ID generator
WithGenerator = ants.WithGenerator
// WithInput sets input buffer size
WithInput = ants.WithInput
// WithMaxBlockingTasks sets up the maximum number of goroutines that are
// blocked when it reaches the capacity of pool.
WithMaxBlockingTasks = ants.WithMaxBlockingTasks
// WithNonblocking indicates that pool will return nil when there is no
// available workers.
WithNonblocking = ants.WithNonblocking
// WithOptions accepts the whole options config.
WithOptions = ants.WithOptions
// WithOutput sets output characteristics:
// size uint: defines the size of the output channel
// interval time.Duration: usee by Conclude to check if its safe to close
// the output channel, periodically, which is implemented within another Go routine.
// timeout time.Duration: denotes the timeout used when the pool attempts
// to send to the output channel
WithOutput = ants.WithOutput
// WithPanicHandler sets up panic handler.
WithPanicHandler = ants.WithPanicHandler
// WithPreAlloc indicates whether it should malloc for workers.
WithPreAlloc = ants.WithPreAlloc
// WithSize denotes the number of workers in the pool. Defaults
// to number of CPUs available.
WithSize = ants.WithSize
)