Documentation
¶
Index ¶
- Constants
- Variables
- type EnvironmentVariable
- type EnvironmentVariables
- type Exec
- func (e *Exec) Cancel()
- func (e Exec) GetArgs() []interface{}
- func (e Exec) GetBackoff() time.Duration
- func (e Exec) GetBy() string
- func (e Exec) GetCancelChan() chan struct{}
- func (e Exec) GetDuration() time.Duration
- func (e Exec) GetEnvs(passphrase string) (EnvironmentVariables, error)
- func (e Exec) GetEnvsMap(passphrase string) (map[string]interface{}, error)
- func (e Exec) GetErr() interface{}
- func (e Exec) GetExecutionTime() int64
- func (e Exec) GetHash() string
- func (e Exec) GetInterval() int
- func (e Exec) GetPriority() int
- func (e Exec) GetResult() interface{}
- func (e Exec) GetRetries() int
- func (e Exec) GetRetriesCount() int
- func (e Exec) GetStatus() string
- func (e Exec) GetTTL() time.Duration
- func (e Exec) GetTimestamp() int64
- func (e *Exec) IncrRetriesCount()
- func (e *Exec) SetArgs(a []interface{})
- func (e *Exec) SetBackoff(b time.Duration) error
- func (e *Exec) SetBy(by string)
- func (e *Exec) SetDuration(t time.Duration)
- func (e *Exec) SetErr(err interface{})
- func (e *Exec) SetExecutionTime(t int64) error
- func (e *Exec) SetInterval(i int)
- func (e *Exec) SetPriority(p int) error
- func (e *Exec) SetResult(r interface{})
- func (e *Exec) SetRetries(r int) error
- func (e *Exec) SetStatus(s string)
- func (e *Exec) SetTTL(ttl time.Duration)
- func (e *Exec) SetTimestamp(t int64)
- type Job
- func (j *Job) AddExec(je Exec)
- func (j *Job) Execute(exec *Exec, passphrase string) *Exec
- func (j Job) GetExec(hash string) (*Exec, error)
- func (j Job) GetExecs() []Exec
- func (j Job) GetHash() string
- func (j Job) GetID() string
- func (j Job) GetLatestExec() Exec
- func (j Job) GetName() string
- func (j Job) GetPrivate() bool
- func (j Job) GetSignature() string
- func (j Job) GetSubmissionTime() int64
- func (j Job) GetTask() (string, error)
- func (j Job) IsEmpty() (bool, error)
- func (j *Job) Sign(priv string) error
- func (j Job) Verify() (bool, error)
- func (j Job) VerifySignature(pub string) (bool, error)
- type Request
Constants ¶
const ( //MaxExecs max number of jobs allowed in the chain MaxExecs = 10 //MaxRetries max number of retries allowed MaxRetries = 5 //MaxRetryBackoff time limit between retries MaxRetryBackoff = 120 //! 2 minutes //DefaultMaxTTL time limit of job DefaultMaxTTL = time.Minute * 10 //DefaultRetries default number of retries DefaultRetries = 0 //DefaultPriority default priority DefaultPriority = NORMAL )
const ( BOOST = 4 HIGH = 3 MEDIUM = 2 LOW = 1 NORMAL = 0 //! default )
Gizo Priorities
const ( CANCELLED = "CANCELLED" //cancelled by sender QUEUED = "QUEUED" //job added to job queue TIMEOUT = "TIMEOUT" //job timed out RUNNING = "RUNNING" //job being executed FINISHED = "FINISHED" //job done RETRYING = "RETRYING" //job retrying DISPATHCHED = "DISPATCHED" //job dispatched to worker STARTED = "STARTED" //job received by dispatcher (prior to dispatch) )
Gizo Statuses
Variables ¶
var ( //ErrExecNotFound occurs when exec not found ErrExecNotFound = errors.New("Exec Not Found") //ErrInvalidPriority occurs when invalid priority number ErrInvalidPriority = errors.New("Invalid priority number") //ErrRetriesOutsideLimit occurs when retries outside limit ErrRetriesOutsideLimit = errors.New("Retries outside limit") //ErrRetryDelayOutsideLimit occurs when retry delay is outside limit ErrRetryDelayOutsideLimit = errors.New("Retry Delay outside limit") //ErrBackoffOutsideLimit occurs when backoff duration is outside limit ErrBackoffOutsideLimit = errors.New("Backoff duration outside limit") //ErrExecutionTimeBehind occurs when execution time is past ErrExecutionTimeBehind = errors.New("Execution time is past") //ErrJobsLenRange occurs when number of jobs is more than allowed ErrJobsLenRange = errors.New("Number of jobs is more than allowed") )
var ( //ErrUnverifiedSignature when unauthorized person tries to execute private job ErrUnverifiedSignature = errors.New("Signature not verified") //ErrUnableToConvert when args is not able to be converted to string ErrUnableToConvert = errors.New("Unable to convert to string") //ErrUnableToSign unable to sign job ErrUnableToSign = errors.New("Unable to sign job") )
Functions ¶
This section is empty.
Types ¶
type EnvironmentVariable ¶
EnvironmentVariable stores key and value of env variables
func NewEnv ¶
func NewEnv(key, value string) *EnvironmentVariable
NewEnv initializes an environment variable
func (EnvironmentVariable) GetKey ¶
func (env EnvironmentVariable) GetKey() string
GetKey returns key
func (EnvironmentVariable) GetValue ¶
func (env EnvironmentVariable) GetValue() string
GetValue returns value
type EnvironmentVariables ¶
type EnvironmentVariables []EnvironmentVariable
EnvironmentVariables list of environment variables
func NewEnvVariables ¶
func NewEnvVariables(variables ...EnvironmentVariable) EnvironmentVariables
NewEnvVariables initializes environment variables
type Exec ¶
type Exec struct { Hash string Timestamp int64 Duration time.Duration //saved in nanoseconds Args []interface{} // parameters Err interface{} Priority int Result interface{} Status string //job status Retries int // number of max retries RetriesCount int //number of retries Backoff time.Duration //backoff time of retries (seconds) ExecutionTime int64 // time scheduled to run (unix) - should sleep # of seconds before adding to job queue Interval int //periodic job exec (seconds) By string //! ID of the worker node that ran this TTL time.Duration //! time limit of job running Pub string //! public key for private jobs Envs []byte //encrypted environment variables // contains filtered or unexported fields }
Exec - config for job executions
func NewExec ¶
func NewExec(args []interface{}, retries, priority int, backoff time.Duration, execTime int64, interval int, ttl time.Duration, pub string, envs EnvironmentVariables, passphrase string) (*Exec, error)
NewExec initializes an exec
func (Exec) GetCancelChan ¶
func (e Exec) GetCancelChan() chan struct{}
GetCancelChan returns cancel channel
func (Exec) GetEnvs ¶
func (e Exec) GetEnvs(passphrase string) (EnvironmentVariables, error)
GetEnvs returns environment variables
func (Exec) GetEnvsMap ¶
GetEnvsMap returns environment variables as a map
func (Exec) GetExecutionTime ¶
GetExecutionTime returne execution time
func (Exec) GetRetriesCount ¶
GetRetriesCount return retries count
func (*Exec) IncrRetriesCount ¶
func (e *Exec) IncrRetriesCount()
IncrRetriesCount increments retries count
func (*Exec) SetExecutionTime ¶
SetExecutionTime sets execution time - unix
type Job ¶
type Job struct { ID string Hash string Execs []Exec Name string Task string Signature string // signature of owner SubmissionTime int64 Private bool //private job flag (default to false - public) }
Job holds deployed job
func (Job) GetLatestExec ¶
GetLatestExec return latest exec of job
func (Job) GetSubmissionTime ¶
GetSubmissionTime returns submission time
type Request ¶
Request requests job execs
func NewRequest ¶
NewRequest initializes job request
func (*Request) AppendExec ¶
AppendExec adds exec to job request