Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Delete(ctx context.Context, id job.ID) error
- func (c *Client) Describe(ctx context.Context, id job.ID) (*job.Specification, error)
- func (c *Client) Download(ctx context.Context, id job.ID, path string) (job.Reader, error)
- func (c *Client) Error(ctx context.Context, t job.Task) error
- func (c *Client) Fatal(ctx context.Context, t job.Task) error
- func (c *Client) Heartbeat(ctx context.Context, t job.Task) (bool, error)
- func (c *Client) Info(ctx context.Context, id job.ID, n int64) (job.Info, error)
- func (c *Client) List(ctx context.Context) ([]job.ID, error)
- func (c *Client) ListWithPriority(ctx context.Context, level job.Priority) ([]job.ID, error)
- func (c *Client) Next(ctx context.Context, mt job.Metadata) (job.Task, error)
- func (c *Client) Requeue(ctx context.Context, t job.Task) error
- func (c *Client) Status(ctx context.Context, id job.ID) (job.Status, error)
- func (c *Client) Submit(ctx context.Context, spec *job.Specification) (job.ID, error)
- func (c *Client) Success(ctx context.Context, t job.Task) error
- func (c *Client) Upload(ctx context.Context, id job.ID, path string, contents io.Reader) error
- type ClientConfig
- type Option
- type Server
Constants ¶
const ( DefaultTCPPort = 12360 DefaultWSPort = 80 )
The default ports that the jobdb server listens on.
Variables ¶
var ( ErrNilClient = errors.New("uninitialised client") ErrClosed = errors.New("client is closed") )
errors
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { log.BasicLogable io.Closer // contains filtered or unexported fields }
Client is the client view of the server.
func NewClient ¶
func NewClient(ctx context.Context, cfg *ClientConfig) (*Client, error)
NewClient returns a new client view of the server specified by the configuration cfg.
func (*Client) Download ¶
Download downloads a file with the given path. This should be present in the manifest for the job with the given ID.
func (*Client) Heartbeat ¶
Heartbeat sends a message to the job server indicating that the worker is still alive and is processing the task t. A nil value for t indicates that no task is being processed. Heartbeat returns true if task processing should continue and false if the current task should be cancelled.
func (*Client) ListWithPriority ¶
ListWithPriority returns a slice containing the IDs of all jobs with the given priority level.
func (*Client) Next ¶
Next returns a new task, if one is available. It provides the metadata mt to the job server.
func (*Client) Requeue ¶
Requeue indicates that the task t should be requeued, without incrementing the number of failures.
func (*Client) Submit ¶
Submit submits a job specified by spec, returning an ID which identifies that job.
type ClientConfig ¶
type ClientConfig struct { Address *address.Address // The address to connect to SSLCert []byte // The SSL certificate(s) (if any) }
ClientConfig describes the configuration options we allow a user to set on a jobdb client.
func DefaultClientConfig ¶
func DefaultClientConfig() *ClientConfig
DefaultClientConfig returns a new client configuration initialised with the default values.
The initial default value for the hostname will be read from the environment variable PCAS_JOBDB_ADDRESS on package init. This should take the form "hostname[:port]" or "ws://host/path".
func SetDefaultClientConfig ¶
func SetDefaultClientConfig(c *ClientConfig) *ClientConfig
SetDefaultClientConfig sets the default client configuration to c and returns the old default configuration. This change will be reflected in future calls to DefaultClientConfig.
func (*ClientConfig) Copy ¶
func (c *ClientConfig) Copy() *ClientConfig
Copy returns a copy of the configuration.
func (*ClientConfig) URI ¶
func (c *ClientConfig) URI() string
URI returns the URI connection string.
Note that the returned string may differ slightly from the value returned c.Address.URI(). For example, if c.Address omits a port number, an appropriate default port number is used here.
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate validates the client configuration, returning an error if there's a problem.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option sets options on a jobdb server.
func SSLCertAndKey ¶
SSLCertAndKey adds the given SSL public certificate and private key to the server.
func WithStorage ¶
WithStorage sets the underlying storage system used by the server.