Implement bucket policy handler and with galore of cleanup

This commit is contained in:
Harshavardhana
2015-02-15 17:03:27 -08:00
parent 7d8c34e055
commit eeae64935e
18 changed files with 827 additions and 407 deletions

View File

@@ -26,6 +26,7 @@ import (
"time"
mstorage "github.com/minio-io/minio/pkg/storage"
"github.com/minio-io/minio/pkg/utils/policy"
)
type storage struct {
@@ -57,6 +58,14 @@ func (storage *storage) CopyObjectToWriter(w io.Writer, bucket string, object st
}
}
func (storage *storage) StoreBucketPolicy(bucket string, policy interface{}) error {
return mstorage.ApiNotImplemented{Api: "PutBucketPolicy"}
}
func (storage *storage) GetBucketPolicy(bucket string) (interface{}, error) {
return policy.BucketPolicy{}, mstorage.ApiNotImplemented{Api: "GetBucketPolicy"}
}
func (storage *storage) StoreObject(bucket, key, contentType string, data io.Reader) error {
objectKey := bucket + ":" + key
@@ -145,12 +154,10 @@ func (b ByBucketName) Len() int { return len(b) }
func (b ByBucketName) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
func (b ByBucketName) Less(i, j int) bool { return b[i].Name < b[j].Name }
func (storage *storage) ListBuckets(prefix string) ([]mstorage.BucketMetadata, error) {
func (storage *storage) ListBuckets() ([]mstorage.BucketMetadata, error) {
var results []mstorage.BucketMetadata
for key, bucket := range storage.bucketdata {
if strings.HasPrefix(key, prefix) {
results = append(results, bucket.metadata)
}
for _, bucket := range storage.bucketdata {
results = append(results, bucket.metadata)
}
sort.Sort(ByBucketName(results))
return results, nil