Remove events from Runtime

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-21 11:43:41 -07:00
parent 0b06fa8518
commit 8830866eed
3 changed files with 21 additions and 11 deletions

View File

@@ -28,21 +28,37 @@ type RuntimeInfo struct {
Options map[string]string
}
func (r RuntimeInfo) MarshalBinary() ([]byte, error) {
type marshaledRuntimeInfo struct {
Name string
Options map[string]string
}
func (r *RuntimeInfo) MarshalBinary() ([]byte, error) {
buf := bytes.NewBuffer(nil)
if err := gob.NewEncoder(buf).Encode(r); err != nil {
if err := gob.NewEncoder(buf).Encode(marshaledRuntimeInfo{
Name: r.Name,
Options: r.Options,
}); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func (r RuntimeInfo) UnmarshalBinary(data []byte) error {
func (r *RuntimeInfo) UnmarshalBinary(data []byte) error {
buf := data
if len(buf) == 0 {
return errors.New("RuntimeInfo: no data")
}
reader := bytes.NewReader(buf)
return gob.NewDecoder(reader).Decode(&r)
var (
mr marshaledRuntimeInfo
reader = bytes.NewReader(buf)
)
if err := gob.NewDecoder(reader).Decode(&mr); err != nil {
return err
}
r.Name = mr.Name
r.Options = mr.Options
return nil
}
type Store interface {