Implement list and fix test
This commit is contained in:
16
minio.go
16
minio.go
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user