Move timeutils functions to the only places where they are used.

- Move time json marshaling to the jsonlog package: this is a docker
  internal hack that we should not promote as a library.
- Move Timestamp encoding/decoding functions to the API types: This is
  only used there. It could be a standalone library but I don't this
it's worth having a separated repo for this. It could introduce more
complexity than it solves.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-12-15 14:49:41 -05:00
parent 202e73c7ad
commit 0585b88aee
7 changed files with 25 additions and 246 deletions

View file

@ -13,8 +13,6 @@
// "bytes"
//-
// "unicode/utf8"
//+
//+ "github.com/docker/docker/pkg/timeutils"
// )
//
// func (mj *JSONLog) MarshalJSON() ([]byte, error) {
@ -43,7 +41,7 @@
// }
// buf.WriteString(`"time":`)
//- obj, err = mj.Created.MarshalJSON()
//+ timestamp, err = timeutils.FastMarshalJSON(mj.Created)
//+ timestamp, err = FastTimeMarshalJSON(mj.Created)
// if err != nil {
// return err
// }
@ -69,8 +67,6 @@ package jsonlog
import (
"bytes"
"unicode/utf8"
"github.com/docker/docker/pkg/timeutils"
)
// MarshalJSON marshals the JSONLog.
@ -111,7 +107,7 @@ func (mj *JSONLog) MarshalJSONBuf(buf *bytes.Buffer) error {
buf.WriteString(`,`)
}
buf.WriteString(`"time":`)
timestamp, err = timeutils.FastMarshalJSON(mj.Created)
timestamp, err = FastTimeMarshalJSON(mj.Created)
if err != nil {
return err
}