Implement delimiter, path prefix

This commit is contained in:
Harshavardhana
2015-02-26 17:23:42 -08:00
parent 01e84c596c
commit 53669a0854
10 changed files with 168 additions and 80 deletions

View File

@@ -32,7 +32,7 @@ type Storage interface {
// Object Operations
CopyObjectToWriter(w io.Writer, bucket string, object string) (int64, error)
GetObjectMetadata(bucket string, object string) (ObjectMetadata, error)
ListObjects(bucket, prefix string, count int) ([]ObjectMetadata, bool, error)
ListObjects(bucket string, resources BucketResourcesMetadata) ([]ObjectMetadata, BucketResourcesMetadata, error)
StoreObject(bucket string, key string, contentType string, data io.Reader) error
}
@@ -42,8 +42,12 @@ type BucketMetadata struct {
}
type ObjectMetadata struct {
Bucket string
Key string
Bucket string
Key string
Maxkeys int
Prefix string
Marker string
Delimiter string
ContentType string
Created time.Time
@@ -51,6 +55,21 @@ type ObjectMetadata struct {
Size int64
}
// Various types of bucket resources
type BucketResourcesMetadata struct {
Prefix string
Marker string
Maxkeys int
Delimiter string
IsTruncated bool
CommonPrefixes []string
Policy bool
// TODO
Logging string
Notification string
}
func IsValidBucket(bucket string) bool {
if len(bucket) < 3 || len(bucket) > 63 {
return false