hep: go-hep.org/x/hep/fwk/job Index | Files

package job

import "go-hep.org/x/hep/fwk/job"

Index

Package Files

gocodec.go io.go job.go jsoncodec.go stmt.go ui.go utils.go

func MsgLevel Uses

func MsgLevel(lvl string) fwk.Level

MsgLevel returns the fwk.Level according to the given lvl string value. MsgLevel panics if no fwk.Level value corresponds to the lvl string value. Valid values are: "DEBUG", "INFO", "WARNING"|"WARN" and "ERROR"|"ERR".

func NewJSONDecoder Uses

func NewJSONDecoder(r io.Reader) *json.Decoder

NewJSONDecoder returns a new decoder that reads from r.

func NewJSONEncoder Uses

func NewJSONEncoder(w io.Writer) *json.Encoder

NewJSONEncoder returns a new encoder that writes to w

func Save Uses

func Save(stmts []Stmt, enc Encoder) error

Save saves a job's configuration description using the Encoder enc.

type C Uses

type C struct {
    Name  string // name of the fwk.Component to create (eg "my-propagator")
    Type  string // type of the fwk.Component to create (eg "go-hep.org/x/hep/fads.Propagator")
    Props P      // properties of the fwk.Component to create
}

C describes the configuration data of a fwk.Component

type Decoder Uses

type Decoder interface {
    Decode(ptr interface{}) error
}

Decoder decodes data from the unerlying io.Reader

type Encoder Uses

type Encoder interface {
    Encode(data interface{}) error
}

Encoder encodes data into the underlying io.Writer

type GoEncoder Uses

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

A GoEncoder writes a go representation to an output stream

func NewGoEncoder Uses

func NewGoEncoder(w io.Writer) *GoEncoder

NewGoEncoder returns a new encoder that writes to w

func (*GoEncoder) Encode Uses

func (enc *GoEncoder) Encode(data interface{}) error

Encode encodes data into the underlying io.Writer

type Job Uses

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

Job is the go-based scripting interface to create, configure and run a fwk.App.

func New Uses

func New(props P) *Job

New create a new Job with the default fwk.App implementation and configures it with the given properties P.

func NewJob Uses

func NewJob(app fwk.App, props P) *Job

NewJob create a new Job from the given fwk.App value and configures it with the given properties P.

func (*Job) App Uses

func (job *Job) App() fwk.App

App returns the underlying fwk.App value of this Job.

func (*Job) Create Uses

func (job *Job) Create(cfg C) fwk.Component

Create creates a fwk.Component according to the configuration data held by cfg. Create panics if no such component was registered with fwk.

func (*Job) Debugf Uses

func (job *Job) Debugf(format string, a ...interface{}) (int, error)

Debugf displays a (formated) DBG message

func (*Job) Errorf Uses

func (job *Job) Errorf(format string, a ...interface{}) (int, error)

Errorf displays a (formated) ERR message

func (*Job) Infof Uses

func (job *Job) Infof(format string, a ...interface{}) (int, error)

Infof displays a (formated) INFO message

func (*Job) Run Uses

func (job *Job) Run()

Run runs the underlying fwk.App. Run panics if an error occurred during any of the execution stages of the application.

func (*Job) SetProp Uses

func (job *Job) SetProp(c fwk.Component, name string, value interface{})

SetProp sets the property name of the component c with the value v. SetProp panics if the component does not have such property or if the types do not match.

func (*Job) Stmts Uses

func (job *Job) Stmts() []Stmt

Stmts returns the list of statements this Job has seen so far.

func (*Job) UI Uses

func (job *Job) UI() UI

UI returns a fwk Scripter

func (*Job) Warnf Uses

func (job *Job) Warnf(format string, a ...interface{}) (int, error)

Warnf displays a (formated) WARN message

type P Uses

type P map[string]interface{}

P holds the configuration data (the properties) of a fwk.Component a map of key-value pairs.

type Stmt Uses

type Stmt struct {
    Type StmtType // type of the statement
    Data C        // the configuration data associated with that statement
}

Stmt represents a job options statement.

func Load Uses

func Load(dec Decoder) ([]Stmt, error)

Load loads a job's configuration description using the Decoder dec.

type StmtType Uses

type StmtType int

StmtType represents the type of a job-options statement.

const (
    StmtNewApp StmtType = iota
    StmtCreate
    StmtSetProp
)

func (StmtType) String Uses

func (stmt StmtType) String() string

String returns the string representation of a StmtType

type UI Uses

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

UI wraps a fwk.Scripter and panics when an error occurs

func (UI) Configure Uses

func (ui UI) Configure()

Configure configures the underlying fwk.App. Configure panics if an error occurs.

func (UI) Run Uses

func (ui UI) Run(evtmax int64)

Run runs the event-loop of the underlying fwk.App. Run panics if an error different than io.EOF occurs.

func (UI) Shutdown Uses

func (ui UI) Shutdown()

Shutdown shuts the underlying fwk.App down. Shutdown panics if an error occurs.

func (UI) Start Uses

func (ui UI) Start()

Start starts the underlying fwk.App. Start panics if an error occurs.

func (UI) Stop Uses

func (ui UI) Stop()

Stop stops the underlying fwk.App. Stopt panics if an error occurs.

Package job imports 9 packages (graph) and is imported by 2 packages. Updated 2018-08-02. Refresh now. Tools for package owners.