Implement list and fix test

This commit is contained in:
bel
2019-06-21 17:57:00 -06:00
parent ade973d19d
commit 52479ed8a0
12 changed files with 161 additions and 29 deletions

View File

@@ -2,7 +2,6 @@ package storage
import (
"bytes"
"errors"
"io/ioutil"
"strings"
@@ -19,7 +18,20 @@ func NewMinio(addr, user, pass string) (*Minio, error) {
}
func (m *Minio) List(ns []string, limits ...string) ([]string, error) {
return nil, errors.New("not impl")
namespace := resolveNamespace(ns)
limits = resolveLimits(limits)
done := make(chan struct{})
defer close(done)
keys := []string{}
for resp := range m.db.ListObjects(namespace, "", true, done) {
if resp.Key < limits[0] {
continue
} else if resp.Key > limits[1] {
break
}
keys = append(keys, resp.Key)
}
return keys, nil
}
func (m *Minio) Get(key string, ns ...string) ([]byte, error) {