Adding List(path) to object storage definition and accompanying definition to fs

This commit is contained in:
Frederick F. Kautz IV
2014-12-10 18:54:04 -08:00
parent 9142de1dd5
commit cae9b288b0
6 changed files with 78 additions and 55 deletions
+13 -5
View File
@@ -5,23 +5,31 @@ import (
"os"
"path"
"path/filepath"
"github.com/minio-io/minio/pkgs/storage"
)
type FileSystemStorage struct {
RootDir string
}
func (storage FileSystemStorage) GetList() ([]byte, error) {
fileInfos, err := ioutil.ReadDir(storage.RootDir)
func (fsStorage FileSystemStorage) List(listPath string) ([]storage.ObjectDescription, error) {
fileInfos, err := ioutil.ReadDir(path.Join(fsStorage.RootDir, listPath))
if err != nil {
return nil, err
}
var list []byte
var descriptions []storage.ObjectDescription
for _, fi := range fileInfos {
list = append(list, "{"+fi.Name()+"}\n"...)
description := storage.ObjectDescription{
Path: fi.Name(),
IsDir: fi.IsDir(),
Hash: "", // TODO
}
descriptions = append(descriptions, description)
}
return list, nil
return descriptions, nil
}
func (storage FileSystemStorage) Get(objectPath string) ([]byte, error) {