Beispiel #1
0
//NewRemoteExecution transform a format.Execution into a friendly RemoteExecution
func NewRemoteExecution(px *format.Execution, name string) *RemoteExecution {
	x := RemoteExecution{
		x:    px,
		name: name,
	}
	x.start = time.Unix(px.GetStart(), 0)
	x.end = time.Unix(px.GetEnd(), 0)

	x.duration = x.end.Sub(x.start)

	return &x
}
Beispiel #2
0
//Unmarshal restore an execution instance from the format.Exception message.
func (x *execution) Unmarshal(f *format.Execution) error {

	b, err := hex.DecodeString(f.GetVersion())
	if err != nil {
		return err
	}
	if len(b) != 20 {
		return fmt.Errorf("invalid sha1 length %d instead of 20", len(b))
	}
	copy(x.version[:], b)

	x.start = time.Unix(f.GetStart(), 0)
	x.end = time.Unix(f.GetEnd(), 0)

	x.errcode = int(f.GetErrcode())
	x.result = bytes.NewBufferString(f.GetResult())

	return nil
}