services/content: move service client into package

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-02-28 17:10:59 -08:00
parent 4793f968e5
commit 5da4e1d0d2
10 changed files with 136 additions and 102 deletions

View file

@ -11,10 +11,17 @@ import (
)
var (
errNotFound = errors.New("content: not found")
errExists = errors.New("content: exists")
// ErrNotFound is returned when an item is not found.
//
// Use IsNotFound(err) to detect this condition.
ErrNotFound = errors.New("content: not found")
BufPool = sync.Pool{
// ErrExists is returned when something exists when it may not be expected.
//
// Use IsExists(err) to detect this condition.
ErrExists = errors.New("content: exists")
bufPool = sync.Pool{
New: func() interface{} {
return make([]byte, 1<<20)
},
@ -52,9 +59,9 @@ type Ingester interface {
}
func IsNotFound(err error) bool {
return errors.Cause(err) == errNotFound
return errors.Cause(err) == ErrNotFound
}
func IsExists(err error) bool {
return errors.Cause(err) == errExists
return errors.Cause(err) == ErrExists
}