network

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2015 License: GPL-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadJobex

func LoadJobex(name string, nwkDir string) error

LoadJobex loads jobex csv which corresponds to name. LoadJobex returns empty jobex array if csv is not exists.

func MasterErrorResult

func MasterErrorResult(msg string, pid int) string

MasterErrorResult generates master error result message as JSON.

func RealtimeErrorResult

func RealtimeErrorResult(msg string) string

RealtimeErrorResult generates realtime error result message as JSON.

func SuccessResult

func SuccessResult(pid int, instanceID int, networkName string) string

SuccessResult generates success result message as JSON.

Types

type Command

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

Command represents a master command which executes realtime network.

func NewCommand

func NewCommand(realtimeName string) *Command

NewCommand creates Command object with unique network name. Network name is generate from realtimeName and current timestamp.

func (*Command) GetNetworkName

func (c *Command) GetNetworkName() string

GetNetworkName returns network name.

func (*Command) GetPID

func (c *Command) GetPID() int

GetPID returns master process ID. If Run is not called, returns 0.

func (*Command) Release

func (c *Command) Release() error

Release releases any resources associated with the master command process. It is recommended that call this function if you do not wait end of process.

func (*Command) Run

func (c *Command) Run() (int, error)

Run runs the master command and gets its instance id.

type Job

type Job struct {
	Name    string
	Node    string
	Port    int
	Path    string
	Param   string
	Env     string
	Work    string
	WRC     int
	WPtn    string
	ERC     int
	EPtn    string
	Timeout int
	SNode   string
	SPort   int
}

func (*Job) UnmarshalJSON

func (j *Job) UnmarshalJSON(data []byte) error

UnmarshalJSON create job object from data(JSON format). Use jobex value loaded by LoadJobex function if the parameter is null.

type Network

type Network struct {
	Flow string `json:"flow"`
	Jobs []Job  `json:"jobs"`
}

func Parse

func Parse(reader io.Reader) (*Network, error)

Parse parses str as json format, and create Network object.

func (*Network) Clean

func (n *Network) Clean(name, nwkDir string)

func (*Network) DetectError

func (n *Network) DetectError() error

DetectError detects error in Network object, and return it. If there is no error, DetectError returns nil.

func (*Network) Export

func (n *Network) Export(name, nwkDir string) error

type Result

type Result struct {
	Status  int           `json:"status"`
	Message string        `json:"message"`
	PID     int           `json:"pid"`
	Network networkResult `json:"network"`
}

func (*Result) Encode

func (r *Result) Encode() string

Encode generates JSON string from object data.

Jump to

Keyboard shortcuts

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