|
|
@ -1,7 +1,6 @@ |
|
|
|
package fs |
|
|
|
package fs |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"errors" |
|
|
|
|
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"os" |
|
|
@ -37,8 +36,8 @@ func start(ctrlChannel <-chan string, errorChannel chan<- error) { |
|
|
|
// Bucket Operations
|
|
|
|
// Bucket Operations
|
|
|
|
|
|
|
|
|
|
|
|
func (storage *storage) ListBuckets(prefix string) ([]mstorage.BucketMetadata, error) { |
|
|
|
func (storage *storage) ListBuckets(prefix string) ([]mstorage.BucketMetadata, error) { |
|
|
|
if mstorage.IsValidBucket(bucket) == false { |
|
|
|
if mstorage.IsValidBucket(prefix) == false { |
|
|
|
return []mstorage.BucketMetadata{}, mstorage.BucketNameInvalid{Bucket: bucket} |
|
|
|
return []mstorage.BucketMetadata{}, mstorage.BucketNameInvalid{Bucket: prefix} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
files, err := ioutil.ReadDir(storage.root) |
|
|
|
files, err := ioutil.ReadDir(storage.root) |
|
|
@ -56,7 +55,7 @@ func (storage *storage) ListBuckets(prefix string) ([]mstorage.BucketMetadata, e |
|
|
|
Name: file.Name(), |
|
|
|
Name: file.Name(), |
|
|
|
Created: file.ModTime(), // TODO - provide real created time
|
|
|
|
Created: file.ModTime(), // TODO - provide real created time
|
|
|
|
} |
|
|
|
} |
|
|
|
metadataList = append(metadata, metadataList) |
|
|
|
metadataList = append(metadataList, metadata) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return metadataList, nil |
|
|
|
return metadataList, nil |
|
|
|