Update list statuses to use filters

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-07-11 09:28:43 -07:00
parent 4322664b88
commit 46deddf460
8 changed files with 135 additions and 99 deletions

View File

@@ -213,7 +213,7 @@ func (*StatusResponse) ProtoMessage() {}
func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{10} }
type ListStatusesRequest struct {
Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
Filters []string `protobuf:"bytes,1,rep,name=filters" json:"filters,omitempty"`
}
func (m *ListStatusesRequest) Reset() { *m = ListStatusesRequest{} }
@@ -1160,11 +1160,20 @@ func (m *ListStatusesRequest) MarshalTo(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Filter) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintContent(dAtA, i, uint64(len(m.Filter)))
i += copy(dAtA[i:], m.Filter)
if len(m.Filters) > 0 {
for _, s := range m.Filters {
dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
return i, nil
}
@@ -1493,9 +1502,11 @@ func (m *StatusResponse) Size() (n int) {
func (m *ListStatusesRequest) Size() (n int) {
var l int
_ = l
l = len(m.Filter)
if l > 0 {
n += 1 + l + sovContent(uint64(l))
if len(m.Filters) > 0 {
for _, s := range m.Filters {
l = len(s)
n += 1 + l + sovContent(uint64(l))
}
}
return n
}
@@ -1709,7 +1720,7 @@ func (this *ListStatusesRequest) String() string {
return "nil"
}
s := strings.Join([]string{`&ListStatusesRequest{`,
`Filter:` + fmt.Sprintf("%v", this.Filter) + `,`,
`Filters:` + fmt.Sprintf("%v", this.Filters) + `,`,
`}`,
}, "")
return s
@@ -2885,7 +2896,7 @@ func (m *ListStatusesRequest) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -2910,7 +2921,7 @@ func (m *ListStatusesRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Filter = string(dAtA[iNdEx:postIndex])
m.Filters = append(m.Filters, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -3595,63 +3606,63 @@ func init() {
}
var fileDescriptorContent = []byte{
// 925 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x6f, 0xe3, 0x44,
0x14, 0xcf, 0x24, 0x8e, 0x69, 0x5f, 0xc2, 0x12, 0x26, 0xa1, 0x8a, 0x8c, 0x70, 0xb2, 0x16, 0x42,
0xd5, 0x2e, 0x75, 0xba, 0x69, 0x6f, 0x48, 0x88, 0x24, 0xbb, 0x40, 0x11, 0x5d, 0x90, 0x37, 0xb0,
0x62, 0x2f, 0xe0, 0x24, 0x13, 0x63, 0x29, 0xf1, 0x78, 0xed, 0x49, 0xc4, 0x72, 0xe2, 0x82, 0x84,
0x2a, 0x0e, 0x7c, 0x81, 0x5e, 0x80, 0x3b, 0x77, 0x3e, 0x41, 0x8f, 0x5c, 0x90, 0x10, 0x87, 0x5d,
0x36, 0x1f, 0x04, 0x21, 0x8f, 0xc7, 0x8e, 0x93, 0xb4, 0xe4, 0x4f, 0xb3, 0xa7, 0xbe, 0x19, 0xbf,
0xdf, 0xfb, 0xfb, 0x7b, 0xf3, 0x52, 0x78, 0xdf, 0xb2, 0xd9, 0xd7, 0xa3, 0x8e, 0xde, 0xa5, 0xc3,
0x5a, 0x97, 0x3a, 0xcc, 0xb4, 0x1d, 0xe2, 0xf5, 0x92, 0xa2, 0xe9, 0xda, 0x35, 0x9f, 0x78,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0x14, 0xf9, 0xdc, 0x43, 0xfb, 0x08,
0x9f, 0x40, 0x9e, 0x53, 0x16, 0x2f, 0x1d, 0xe8, 0x34, 0xb3, 0x2f, 0x9b, 0x8e, 0xa3, 0xc7, 0xe7,
0x2f, 0xd4, 0xcc, 0x9f, 0x2f, 0xd4, 0xcc, 0xb7, 0x13, 0x15, 0x9d, 0x4f, 0x54, 0xf4, 0xfb, 0x44,
0x45, 0x7f, 0x4f, 0x54, 0xf4, 0xf8, 0xdd, 0x4d, 0xff, 0xcf, 0x78, 0x5b, 0x88, 0x1d, 0x99, 0xfb,
0x3a, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0xc6, 0xb1, 0x1a, 0xcd, 0xb2, 0x0c, 0x00, 0x00,
}

View File

@@ -137,7 +137,7 @@ message StatusResponse {
}
message ListStatusesRequest {
string filter = 1;
repeated string filters = 1;
}
message ListStatusesResponse {

View File

@@ -68,7 +68,7 @@ type IngestManager interface {
// ListStatuses returns the status of any active ingestions whose ref match the
// provided regular expression. If empty, all active ingestions will be
// returned.
ListStatuses(ctx context.Context, ref string) ([]Status, error)
ListStatuses(ctx context.Context, filters ...string) ([]Status, error)
// Abort completely cancels the ingest operation targeted by ref.
Abort(ctx context.Context, ref string) error

View File

@@ -7,11 +7,11 @@ import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strconv"
"time"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters"
"github.com/containerd/containerd/log"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
@@ -140,7 +140,7 @@ func (s *store) Status(ctx context.Context, ref string) (Status, error) {
return s.status(s.ingestRoot(ref))
}
func (s *store) ListStatuses(ctx context.Context, re string) ([]Status, error) {
func (s *store) ListStatuses(ctx context.Context, fs ...string) ([]Status, error) {
fp, err := os.Open(filepath.Join(s.root, "ingest"))
if err != nil {
return nil, err
@@ -153,7 +153,7 @@ func (s *store) ListStatuses(ctx context.Context, re string) ([]Status, error) {
return nil, err
}
rec, err := regexp.Compile(re)
filter, err := filters.ParseAll(fs...)
if err != nil {
return nil, err
}
@@ -178,11 +178,9 @@ func (s *store) ListStatuses(ctx context.Context, re string) ([]Status, error) {
continue
}
if !rec.MatchString(stat.Ref) {
continue
if filter.Match(adaptStatus(stat)) {
active = append(active, stat)
}
active = append(active, stat)
}
return active, nil
@@ -210,6 +208,20 @@ func (s *store) status(ingestPath string) (Status, error) {
}, nil
}
func adaptStatus(status Status) filters.Adaptor {
return filters.AdapterFunc(func(fieldpath []string) (string, bool) {
if len(fieldpath) == 0 {
return "", false
}
switch fieldpath[0] {
case "ref":
return status.Ref, true
}
return "", false
})
}
// total attempts to resolve the total expected size for the write.
func (s *store) total(ingestPath string) int64 {
totalS, err := readFileString(filepath.Join(ingestPath, "total"))

View File

@@ -4,6 +4,7 @@ import (
"strings"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/filters"
"github.com/containerd/containerd/images"
)
@@ -69,6 +70,20 @@ func adaptContainer(o interface{}) filters.Adaptor {
})
}
func adaptContentStatus(status content.Status) filters.Adaptor {
return filters.AdapterFunc(func(fieldpath []string) (string, bool) {
if len(fieldpath) == 0 {
return "", false
}
switch fieldpath[0] {
case "ref":
return status.Ref, true
}
return "", false
})
}
func checkMap(fieldpath []string, m map[string]string) (string, bool) {
if len(m) == 0 {
return "", false

View File

@@ -4,11 +4,11 @@ import (
"context"
"encoding/binary"
"io"
"regexp"
"github.com/boltdb/bolt"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters"
"github.com/containerd/containerd/namespaces"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
@@ -109,21 +109,18 @@ func (cs *contentStore) Delete(ctx context.Context, dgst digest.Digest) error {
})
}
func (cs *contentStore) ListStatuses(ctx context.Context, re string) ([]content.Status, error) {
func (cs *contentStore) ListStatuses(ctx context.Context, fs ...string) ([]content.Status, error) {
ns, err := namespaces.NamespaceRequired(ctx)
if err != nil {
return nil, err
}
var rec *regexp.Regexp
if re != "" {
rec, err = regexp.Compile(re)
if err != nil {
return nil, err
}
filter, err := filters.ParseAll(fs...)
if err != nil {
return nil, err
}
var brefs []string
brefs := map[string]string{}
if err := view(ctx, cs.db, func(tx *bolt.Tx) error {
bkt := getIngestBucket(tx, ns)
if bkt == nil {
@@ -131,9 +128,8 @@ func (cs *contentStore) ListStatuses(ctx context.Context, re string) ([]content.
}
return bkt.ForEach(func(k, v []byte) error {
if rec == nil || rec.Match(k) {
brefs = append(brefs, string(v))
}
// TODO(dmcgowan): match name and potentially labels here
brefs[string(k)] = string(v)
return nil
})
}); err != nil {
@@ -141,7 +137,7 @@ func (cs *contentStore) ListStatuses(ctx context.Context, re string) ([]content.
}
statuses := make([]content.Status, 0, len(brefs))
for _, bref := range brefs {
for k, bref := range brefs {
status, err := cs.Store.Status(ctx, bref)
if err != nil {
if errdefs.IsNotFound(err) {
@@ -149,9 +145,11 @@ func (cs *contentStore) ListStatuses(ctx context.Context, re string) ([]content.
}
return nil, err
}
status.Ref = trimKey(status.Ref)
status.Ref = k
statuses = append(statuses, status)
if filter.Match(adaptContentStatus(status)) {
statuses = append(statuses, status)
}
}
return statuses, nil

View File

@@ -243,9 +243,9 @@ func (s *Service) Status(ctx context.Context, req *api.StatusRequest) (*api.Stat
}
func (s *Service) ListStatuses(ctx context.Context, req *api.ListStatusesRequest) (*api.ListStatusesResponse, error) {
statuses, err := s.store.ListStatuses(ctx, req.Filter)
statuses, err := s.store.ListStatuses(ctx, req.Filters...)
if err != nil {
return nil, errdefs.ToGRPCf(err, "could not get status for filter %q", req.Filter)
return nil, errdefs.ToGRPC(err)
}
var resp api.ListStatusesResponse

View File

@@ -113,9 +113,9 @@ func (rs *remoteStore) Status(ctx context.Context, ref string) (content.Status,
}, nil
}
func (rs *remoteStore) ListStatuses(ctx context.Context, filter string) ([]content.Status, error) {
func (rs *remoteStore) ListStatuses(ctx context.Context, filters ...string) ([]content.Status, error) {
resp, err := rs.client.ListStatuses(ctx, &contentapi.ListStatusesRequest{
Filter: filter,
Filters: filters,
})
if err != nil {
return nil, errdefs.FromGRPC(err)