worker

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package worker implements the Pulse distributed worker HTTP server. A worker listens for RunRequests from a coordinator, executes the load test, and returns a WorkerResult with full histogram data for accurate latency merging.

Usage (library mode — pre-registered scenario):

srv := worker.New(myScenario)
if err := srv.ListenAndServe(ctx, ":9100"); err != nil {
    log.Fatal(err)
}

Usage (CLI mode — scenario built from RunRequest.HTTPScenario):

srv := worker.New(nil)
if err := srv.ListenAndServe(ctx, ":9100"); err != nil {
    log.Fatal(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a Pulse distributed worker. It accepts RunRequests from a coordinator over HTTP and executes the load test locally.

func New

func New(scenario func(context.Context) (int, error)) *Server

New creates a worker server. Pass a non-nil scenario for library mode; pass nil for CLI mode (scenario is derived from each RunRequest).

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context, addr string) error

ListenAndServe starts the worker HTTP server on addr and blocks until ctx is cancelled or a fatal listen error occurs. addr must be a "host:port" string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL