server

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewListener added in v1.6.0

func NewListener(listenURL string) (net.Listener, error)

NewListener returns a listener that listens on the given URL. If blank, listens on a random localhost port. You can use l.Addr().String() to get the address.

Types

type Builder

type Builder interface {
	Build(*build.Definition) error
	Status() []build.Status
}

Builder interface describes anything that can Build() a singularity image given a build.Definition.

type Error added in v1.0.1

type Error string

func (Error) Error added in v1.0.1

func (e Error) Error() string

type Request added in v1.2.0

type Request struct {
	Name    string
	Version string `json:"version,omitempty"`
	Model   struct {
		Description string
		Packages    []core.Package
	}
}

A Request object contains all of the information required to build an environment.

type Server added in v1.6.0

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

func New

func New(b Builder, c *config.Config) *Server

New takes a Builder that will be sent a Definition when the returned Handler receives request JSON POSTed to /environments/build, and uses the Builder to get status information for builds when it receives a GET request to /environments/status. It uses the config to get your core URL, and if set will trigger the core service to resend pending builds to us after Start().

func (*Server) Start added in v1.6.0

func (s *Server) Start(l net.Listener) error

Start starts a server using the given listener (you can get one from NewListener()). Blocks until Stop() is called, or a kill signal is received.

You should always defer Stop(), regardless of this returning an error.

If we had been configured with core details, core will be asked to resend its queued environments.

func (*Server) Stop added in v1.6.0

func (s *Server) Stop()

func (*Server) WaitUntilStarted added in v1.6.0

func (s *Server) WaitUntilStarted() bool

WaitUntilStarted blocks until Start() brings up a listener and the core service talks to us. Will only work if we were configured with core details and the core is working. There is a timeout; will return false if the timeout expires, or core details weren't configured.

Jump to

Keyboard shortcuts

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