35 lines
945 B
Go
35 lines
945 B
Go
package config
|
|
|
|
import "reflect"
|
|
|
|
// JSCKSourceSleeper is the sleeper source's configuration key.
|
|
const JSCKSourceSleeper string = "sleeper"
|
|
|
|
// JSCSourceSleeper configures the sleeper, a test source that
|
|
// simulates work by sleeping. With BlockShutdown its work ignores
|
|
// cancellation, to test shutdown waiting on a non-cooperative task.
|
|
type JSCSourceSleeper struct {
|
|
JobSearchConfigSource
|
|
BlockShutdown bool `cfg:"block_shutdown"`
|
|
}
|
|
|
|
// ---------- Section methods (see Section) ----------
|
|
|
|
func (c JSCSourceSleeper) Map() map[string]any { return mapOf(c) }
|
|
|
|
func (c JSCSourceSleeper) Flatten() map[string]any {
|
|
return flattenOf(JSCKSourceSleeper, c)
|
|
}
|
|
|
|
func (c JSCSourceSleeper) TypeOf(key string) (reflect.Kind, error) {
|
|
return typeOf(c, key)
|
|
}
|
|
|
|
func (c JSCSourceSleeper) ValueOf(key string) (any, error) {
|
|
return valueOf(c, key)
|
|
}
|
|
|
|
func (c *JSCSourceSleeper) SetValue(key string, value any) error {
|
|
return setValue(c, key, value)
|
|
}
|