Update GRPC for consistency

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-20 17:47:59 -07:00
parent 13e7d3c393
commit 94eafaab60
56 changed files with 3941 additions and 2802 deletions

View File

@@ -1,7 +1,10 @@
package containers
import (
"bytes"
"context"
"encoding/gob"
"errors"
"time"
)
@@ -13,13 +16,35 @@ type Container struct {
ID string
Labels map[string]string
Image string
Runtime string
Runtime RuntimeInfo
Spec []byte
RootFS string
CreatedAt time.Time
UpdatedAt time.Time
}
type RuntimeInfo 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 {
return nil, err
}
return buf.Bytes(), nil
}
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)
}
type Store interface {
Get(ctx context.Context, id string) (Container, error)
List(ctx context.Context, filter string) ([]Container, error)