equtils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOGLEVEL_INFO logLevel = 1
	LOGLEVEL_DBG  logLevel = 2
)

Variables

This section is empty.

Functions

func AddLogTee

func AddLogTee(newDst *os.File)

func AreActionsSliceEqual

func AreActionsSliceEqual(a, b []Action) bool

func AreEventsEqual

func AreEventsEqual(a, b *Event) bool

func AreEventsSliceEqual

func AreEventsSliceEqual(a, b []Event) bool

func AreTracesEqual

func AreTracesEqual(a, b *SingleTrace) bool

func ExecReq

func ExecReq(rw ReaderWriter, req, rsp proto.Message) error

func InitLog

func InitLog(path string)

func Log

func Log(format string, v ...interface{})

func Panic

func Panic(format string, v ...interface{})

func RecvMsg

func RecvMsg(rw ReaderWriter, msg proto.Message) error

integer header + protobuf marshaled object styled request todo: endian

func SendMsg

func SendMsg(rw ReaderWriter, msg proto.Message) error

Types

type Action

type Action struct {
	EntityId          string
	ActionId          string // used by MongoDB and so on. expected to compliant with RFC 4122 UUID string format
	ActionType        string // e.g., "Accept", "_JSON"
	ActionParam       EAParam
	OrchestratorLocal bool // if true, the action will not  be propagated to inspectors. this field exists mainly for syslog events.

	Evt   *Event
	Fault *Fault
}

func MakeFaultInjectionAction

func MakeFaultInjectionAction(entityId string) *Action

func (Action) String

func (this Action) String() string

func (*Action) ToJSONMap

func (this *Action) ToJSONMap() map[string]interface{}

func (Action) Validate

func (this Action) Validate() error

type Config

type Config struct {
	*viper.Viper
}

func ParseConfigFile

func ParseConfigFile(filePath string) (*Config, error)

TODO: support env vars for overriding (https://github.com/spf13/viper#working-with-environment-variables) TODO: validate config with JSON schema

func (*Config) DumpToJsonFile

func (this *Config) DumpToJsonFile(filePath string) error

type EAParam

type EAParam map[string]interface{}

TODO: use viper, which enables aliasing for keeping compatibility

func NewEAParam

func NewEAParam() EAParam

func (EAParam) Equals

func (this EAParam) Equals(other EAParam) bool

type Event

type Event struct {
	ArrivedTime time.Time

	EntityId string

	EventId    string // used by MongoDB and so on. expected to compliant with RFC 4122 UUID string format
	EventType  string // e.g., "FuncCall", "_JSON"
	EventParam EAParam

	Deferred bool // Function Calls and Packets are deferred, however syslogs are not deferred

	JavaSpecific *Event_JavaSpecific
}

func EventFromJSONMap

func EventFromJSONMap(m map[string]interface{}, arrivedTime time.Time, entityId string) (ev Event, err error)

func (*Event) MakeAcceptAction

func (this *Event) MakeAcceptAction() (act *Action, err error)

func (Event) String

func (this Event) String() string

func (*Event) ToJSONMap

func (this *Event) ToJSONMap() map[string]interface{}

func (Event) Validate

func (this Event) Validate() error

type Event_JavaSpecific

type Event_JavaSpecific struct {
	ThreadName string

	NrStackTraceElements int
	StackTraceElements   []Event_JavaSpecific_StackTraceElement

	NrParams int
	Params   []Event_JavaSpecific_Param
}

type Event_JavaSpecific_Param

type Event_JavaSpecific_Param struct {
	Name  string
	Value string
}

type Event_JavaSpecific_StackTraceElement

type Event_JavaSpecific_StackTraceElement struct {
	LineNumber int
	ClassName  string
	MethodName string
	FileName   string
}

type Fault

type Fault struct {
	TriggeredTime time.Time
}

type Reader

type Reader interface {
	Read(p []byte) (n int, err error)
}

type ReaderWriter

type ReaderWriter interface {
	Reader
	Writer
}

type SingleTrace

type SingleTrace struct {
	ActionSequence []Action // NOTE: Action holds the corresponding Evt
}

type TransitionEntity

type TransitionEntity struct {
	Id   string
	Conn net.Conn

	EventToMain    chan *Event
	ActionFromMain chan *Action
}

type Writer

type Writer interface {
	Write(p []byte) (n int, err error)
}

Jump to

Keyboard shortcuts

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