hosercmd

package
v0.0.0-...-7dcf7c4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirOut = "out"
	DirIn  = "in"
)
View Source
const (
	MaxCodeLen = 128 // 128 chars is a conservative upper limit on command code len (e.g. start)
)

Variables

View Source
var (
	ErrTooLong  = errors.New("id too long (too many slashes)")
	ErrTooShort = errors.New("id must have pipeline")
)

Functions

This section is empty.

Types

type Code

type Code string
var (
	CodeStart    Code = "start"
	CodePipeline Code = "pipeline"
	CodeSet      Code = "set"
	CodePipe     Code = "pipe"
	CodeExit     Code = "exit"
)

type Command

type Command interface {
	UnmarshalJSON(body []byte) error
	MarshalJSON() ([]byte, error)
	Code() Code
}

func Read

func Read(line []byte) (Command, error)

func ReadFiles

func ReadFiles(r io.Reader) (cmds []Command, err error)

type Dir

type Dir string

type Error

type Error struct {
	LineNumber int
	Context    []byte
	Err        error
}

func (*Error) Error

func (e *Error) Error() string

type Exit

type Exit struct {
	When string
}

func (*Exit) Code

func (b *Exit) Code() Code

func (Exit) MarshalEasyJSON

func (v Exit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Exit) MarshalJSON

func (v Exit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Exit) UnmarshalEasyJSON

func (v *Exit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Exit) UnmarshalJSON

func (v *Exit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Ident

type Ident struct {
	Pipeline, Node, Port string // any of these values can be empty
}

Ident is an identifier in hosercmd. An identifier can have three different scopes: pipeline: /pipelineID process/var: /pipelineID/varID OR /pipelineID/processID port: /pipelineID/processID[portID]

func ParseId

func ParseId(id string) (Ident, error)

func (Ident) String

func (i Ident) String() string

type Pipe

type Pipe struct {
	Src, Dst string
}

func (*Pipe) Code

func (b *Pipe) Code() Code

func (Pipe) MarshalEasyJSON

func (v Pipe) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Pipe) MarshalJSON

func (v Pipe) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Pipe) UnmarshalEasyJSON

func (v *Pipe) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Pipe) UnmarshalJSON

func (v *Pipe) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Pipeline

type Pipeline struct {
	Id string
}

func (*Pipeline) Code

func (b *Pipeline) Code() Code

func (Pipeline) MarshalEasyJSON

func (v Pipeline) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Pipeline) MarshalJSON

func (v Pipeline) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Pipeline) UnmarshalEasyJSON

func (v *Pipeline) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Pipeline) UnmarshalJSON

func (v *Pipeline) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Port

type Port struct {
	Dir Dir
}

type Result

type Result = Command

type Set

type Set struct {
	Id          string
	Read, Write string // URLs to read and write data to. Read creates a source, Write creates a sink.
	Text        string // A fixed value for sources
}

func (*Set) Code

func (sb *Set) Code() Code

func (*Set) IsSink

func (sb *Set) IsSink() bool

func (*Set) IsSpout

func (sb *Set) IsSpout() bool

func (Set) MarshalEasyJSON

func (v Set) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Set) MarshalJSON

func (v Set) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Set) UnmarshalEasyJSON

func (v *Set) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Set) UnmarshalJSON

func (v *Set) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Start

type Start struct {
	Id      string
	ExeFile string `json:"exe"`
	Argv    []string
	Ports   map[string]Port
}

func (*Start) Code

func (sb *Start) Code() Code

func (Start) MarshalEasyJSON

func (v Start) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Start) MarshalJSON

func (v Start) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Start) UnmarshalEasyJSON

func (v *Start) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Start) UnmarshalJSON

func (v *Start) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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