github.com/ranjib/nomad@v0.1.1-0.20160225204057-97751b02f70b/client/driver/structs/structs.go (about)

     1  package structs
     2  
     3  import (
     4  	"fmt"
     5  	cgroupConfig "github.com/opencontainers/runc/libcontainer/configs"
     6  )
     7  
     8  // WaitResult stores the result of a Wait operation.
     9  type WaitResult struct {
    10  	ExitCode int
    11  	Signal   int
    12  	Err      error
    13  }
    14  
    15  func NewWaitResult(code, signal int, err error) *WaitResult {
    16  	return &WaitResult{
    17  		ExitCode: code,
    18  		Signal:   signal,
    19  		Err:      err,
    20  	}
    21  }
    22  
    23  func (r *WaitResult) Successful() bool {
    24  	return r.ExitCode == 0 && r.Signal == 0 && r.Err == nil
    25  }
    26  
    27  func (r *WaitResult) String() string {
    28  	return fmt.Sprintf("Wait returned exit code %v, signal %v, and error %v",
    29  		r.ExitCode, r.Signal, r.Err)
    30  }
    31  
    32  // IsolationConfig has information about the isolation mechanism the executor
    33  // uses to put resource constraints and isolation on the user process
    34  type IsolationConfig struct {
    35  	Cgroup *cgroupConfig.Cgroup
    36  }