Remove events from Runtime
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user