client

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 13 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[Req request, Res common.ResponseTo[Req]](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.

func FromEnvironment

func FromEnvironment(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.

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