Remove events from Runtime
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
0b06fa8518
commit
8830866eed
@ -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 {
|
||||
|
@ -370,10 +370,6 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
|
||||
return o, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) Events(ctx context.Context) <-chan *plugin.Event {
|
||||
return r.events
|
||||
}
|
||||
|
||||
func (r *Runtime) handleEvents(ctx context.Context, s shim.ShimClient) error {
|
||||
events, err := s.Events(r.eventsContext, &shim.EventsRequest{})
|
||||
if err != nil {
|
||||
|
@ -43,6 +43,4 @@ type Runtime interface {
|
||||
Tasks(context.Context) ([]Task, error)
|
||||
// Delete removes the task in the runtime.
|
||||
Delete(context.Context, Task) (*Exit, error)
|
||||
// Events returns events for the runtime and all tasks created by the runtime
|
||||
Events(context.Context) <-chan *Event
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user