Documentation ¶
Index ¶
- type BatchOptions
- type GenericWorker
- func (w *GenericWorker) GetBatchOptions(cmd *cobra.Command) (*BatchOptions, error)
- func (w *GenericWorker) GetMaxJobs() int64
- func (w *GenericWorker) GetMaxWorkers() int
- func (w *GenericWorker) Run(cmd *cobra.Command, iter iterator.Iterator, ...) error
- func (w *GenericWorker) RunSequentially(cmd *cobra.Command, iter iterator.Iterator, ...) error
- func (w *GenericWorker) StartWorker(id int, jobs <-chan Job, results chan<- error, prog *progressbar.ProgressBar, ...)
- type Job
- type RequestHandler
- type Runner
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchOptions ¶
type BatchOptions struct { StartIndex int NumJobs int TotalWorkers int Delay time.Duration DelayBefore time.Duration AbortOnErrorCount int SemanticMethod string PostActions []flags.Action InputData []string // Generic values ConfirmationMessage func(string, any, any) (string, error) // contains filtered or unexported fields }
func (*BatchOptions) GetConfirmationMessage ¶ added in v2.41.0
func (*BatchOptions) GetItem ¶
func (b *BatchOptions) GetItem() (string, error)
type GenericWorker ¶ added in v2.41.0
type GenericWorker struct { Config *config.Config IO *iostreams.IOStreams Logger *logger.Logger Client *c8y.Client ActivityLogger *activitylogger.ActivityLogger CheckError func(error) error Execute Runner }
func NewGenericWorker ¶ added in v2.41.0
func NewGenericWorker(log *logger.Logger, cfg *config.Config, iostream *iostreams.IOStreams, client *c8y.Client, activityLog *activitylogger.ActivityLogger, runFunc Runner, checkError func(error) error) (*GenericWorker, error)
func (*GenericWorker) GetBatchOptions ¶ added in v2.41.0
func (w *GenericWorker) GetBatchOptions(cmd *cobra.Command) (*BatchOptions, error)
func (*GenericWorker) GetMaxJobs ¶ added in v2.41.0
func (w *GenericWorker) GetMaxJobs() int64
GetMaxJob maximum number of jobs allowed
func (*GenericWorker) GetMaxWorkers ¶ added in v2.41.0
func (w *GenericWorker) GetMaxWorkers() int
GetMaxWorkers maximum number of workers
func (*GenericWorker) Run ¶ added in v2.41.0
func (w *GenericWorker) Run(cmd *cobra.Command, iter iterator.Iterator, inputIterators *flags.RequestInputIterators) error
func (*GenericWorker) RunSequentially ¶ added in v2.41.0
func (w *GenericWorker) RunSequentially(cmd *cobra.Command, iter iterator.Iterator, inputIterators *flags.RequestInputIterators) error
func (*GenericWorker) StartWorker ¶ added in v2.41.0
func (w *GenericWorker) StartWorker(id int, jobs <-chan Job, results chan<- error, prog *progressbar.ProgressBar, wg *sync.WaitGroup)
These workers will receive work on the `jobs` channel and send the corresponding results on `results`
type Job ¶ added in v2.41.0
type Job struct { ID int64 Value any CommonOptions config.CommonCommandOptions Input any Options BatchOptions }
type RequestHandler ¶
type RequestHandler func(requests []c8y.RequestOptions, input any, commonOptions config.CommonCommandOptions) (*c8y.Response, error)
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker(log *logger.Logger, cfg *config.Config, iostream *iostreams.IOStreams, client *c8y.Client, activityLog *activitylogger.ActivityLogger, reqHandlerFunc RequestHandler, checkError func(error) error) (*Worker, error)
func (*Worker) GetMaxJobs ¶
GetMaxJob maximum number of jobs allowed
func (*Worker) GetMaxWorkers ¶
GetMaxWorkers maximum number of workers
func (*Worker) ProcessRequestAndResponse ¶
func (w *Worker) ProcessRequestAndResponse(cmd *cobra.Command, r *c8y.RequestOptions, inputIterators *flags.RequestInputIterators) error
Click to show internal directories.
Click to hide internal directories.