2015-04-05 04:53:41 -04:00
|
|
|
/*
|
|
|
|
* Minimalist Object Storage, (C) 2015 Minio, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package donut
|
|
|
|
|
2015-06-25 15:55:13 -04:00
|
|
|
import "io"
|
2015-04-05 04:53:41 -04:00
|
|
|
|
|
|
|
// Collection of Donut specification interfaces
|
|
|
|
|
2015-07-02 23:31:22 -04:00
|
|
|
// Interface is a collection of object storage and management interface
|
|
|
|
type Interface interface {
|
2015-04-07 00:42:54 -04:00
|
|
|
ObjectStorage
|
2015-04-05 04:53:41 -04:00
|
|
|
Management
|
|
|
|
}
|
|
|
|
|
2015-04-08 19:28:14 -04:00
|
|
|
// ObjectStorage is a donut object storage interface
|
2015-04-07 00:42:54 -04:00
|
|
|
type ObjectStorage interface {
|
2015-06-24 22:43:38 -04:00
|
|
|
// Storage service operations
|
2015-06-26 18:32:24 -04:00
|
|
|
GetBucketMetadata(bucket string) (BucketMetadata, error)
|
2015-04-07 00:42:54 -04:00
|
|
|
SetBucketMetadata(bucket string, metadata map[string]string) error
|
2015-07-02 23:31:22 -04:00
|
|
|
ListBuckets() ([]BucketMetadata, error)
|
|
|
|
MakeBucket(bucket string, ACL string) error
|
2015-04-07 00:42:54 -04:00
|
|
|
|
2015-06-24 22:43:38 -04:00
|
|
|
// Bucket operations
|
2015-07-02 23:31:22 -04:00
|
|
|
ListObjects(bucket string, resources BucketResourcesMetadata) ([]ObjectMetadata, BucketResourcesMetadata, error)
|
2015-04-07 00:42:54 -04:00
|
|
|
|
2015-06-24 22:43:38 -04:00
|
|
|
// Object operations
|
2015-07-02 23:31:22 -04:00
|
|
|
GetObject(w io.Writer, bucket, object string) (int64, error)
|
|
|
|
GetPartialObject(w io.Writer, bucket, object string, start, length int64) (int64, error)
|
2015-06-27 02:22:30 -04:00
|
|
|
GetObjectMetadata(bucket, object string) (ObjectMetadata, error)
|
2015-07-09 17:42:04 -04:00
|
|
|
// bucket, object, expectedMD5Sum, size, reader, metadata, signature
|
|
|
|
CreateObject(string, string, string, int64, io.Reader, map[string]string, *Signature) (ObjectMetadata, error)
|
2015-07-02 23:31:22 -04:00
|
|
|
|
|
|
|
Multipart
|
|
|
|
}
|
|
|
|
|
|
|
|
// Multipart API
|
|
|
|
type Multipart interface {
|
|
|
|
NewMultipartUpload(bucket, key, contentType string) (string, error)
|
|
|
|
AbortMultipartUpload(bucket, key, uploadID string) error
|
2015-07-09 22:01:15 -04:00
|
|
|
CreateObjectPart(string, string, string, int, string, string, int64, io.Reader, *Signature) (string, error)
|
|
|
|
CompleteMultipartUpload(bucket, key, uploadID string, data io.Reader, signature *Signature) (ObjectMetadata, error)
|
2015-07-02 23:31:22 -04:00
|
|
|
ListMultipartUploads(bucket string, resources BucketMultipartResourcesMetadata) (BucketMultipartResourcesMetadata, error)
|
|
|
|
ListObjectParts(bucket, key string, resources ObjectResourcesMetadata) (ObjectResourcesMetadata, error)
|
2015-04-05 04:53:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Management is a donut management system interface
|
|
|
|
type Management interface {
|
|
|
|
Heal() error
|
|
|
|
Rebalance() error
|
|
|
|
Info() (map[string][]string, error)
|
|
|
|
|
2015-06-25 15:55:13 -04:00
|
|
|
AttachNode(hostname string, disks []string) error
|
|
|
|
DetachNode(hostname string) error
|
2015-06-24 22:43:38 -04:00
|
|
|
|
|
|
|
SaveConfig() error
|
|
|
|
LoadConfig() error
|
|
|
|
}
|