client

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Username   = "orchestrion"
	NoPassword = "" // We only use account management to have access to system events, not for security.
)
View Source
const (
	EnvVarJobserverURL = "ORCHESTRION_JOBSERVER_URL"
)

Variables

View Source
var (
	ErrNoServerAvailable = errors.New("no job server is available")
)

Functions

func Request

func Request[Res any, Req request[Res]](ctx context.Context, client *Client, req Req) (Res, error)

Types

type Client

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

func Connect

func Connect(addr string) (*Client, error)

Connect creates a new client connected to the NATS server at the specified address. It implements exponential backoff retry logic to handle temporary connection issues, especially on slower CI environments.

func FromEnvironment

func FromEnvironment(ctx context.Context, workDir string) (*Client, error)

FromEnvironment returns a client connected to the current environment's job server, using the following process:

  • If the ORCHESTRION_JOBSERVER_URL environment variable is set, a client connected to this URL is returned.
  • Otherwise, if workDir is not empty, a server will be identified based on a `.orchestrion-jobserver` file; or a new server will be started using that url file, and a connection will be established to it. The started job server will automatically shut itself down once it no longer has any active client for a period of time.
  • Otherwise, the ErrNoServerAvailable error is returned.

The returned client is re-used, so callers should NOT call Client.Close on it.

func New

func New(conn *nats.Conn) *Client

func (*Client) Close

func (c *Client) Close()

Jump to

Keyboard shortcuts

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