2015-04-05 04:53:41 -04:00
|
|
|
/*
|
2015-07-24 20:51:40 -04:00
|
|
|
* Minio Cloud Storage, (C) 2015 Minio, Inc.
|
2015-04-05 04:53:41 -04:00
|
|
|
*
|
|
|
|
* 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-08-03 19:17:21 -04:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/minio/minio/pkg/probe"
|
2015-10-02 02:51:17 -04:00
|
|
|
signv4 "github.com/minio/minio/pkg/signature"
|
2015-08-03 19:17:21 -04:00
|
|
|
)
|
2015-04-05 04:53:41 -04:00
|
|
|
|
|
|
|
// Collection of Donut specification interfaces
|
|
|
|
|
2015-07-24 21:09:53 -04:00
|
|
|
// Interface is a collection of cloud storage and management interface
|
2015-07-02 23:31:22 -04:00
|
|
|
type Interface interface {
|
2015-07-24 21:09:53 -04:00
|
|
|
CloudStorage
|
2015-04-05 04:53:41 -04:00
|
|
|
Management
|
|
|
|
}
|
|
|
|
|
2015-07-24 21:09:53 -04:00
|
|
|
// CloudStorage is a donut cloud storage interface
|
|
|
|
type CloudStorage interface {
|
2015-06-24 22:43:38 -04:00
|
|
|
// Storage service operations
|
2015-10-02 02:51:17 -04:00
|
|
|
GetBucketMetadata(bucket string, signature *signv4.Signature) (BucketMetadata, *probe.Error)
|
|
|
|
SetBucketMetadata(bucket string, metadata map[string]string, signature *signv4.Signature) *probe.Error
|
|
|
|
ListBuckets(signature *signv4.Signature) ([]BucketMetadata, *probe.Error)
|
|
|
|
MakeBucket(bucket string, ACL string, location io.Reader, signature *signv4.Signature) *probe.Error
|
2015-04-07 00:42:54 -04:00
|
|
|
|
2015-06-24 22:43:38 -04:00
|
|
|
// Bucket operations
|
2015-10-02 02:51:17 -04:00
|
|
|
ListObjects(string, BucketResourcesMetadata, *signv4.Signature) ([]ObjectMetadata, BucketResourcesMetadata, *probe.Error)
|
2015-04-07 00:42:54 -04:00
|
|
|
|
2015-06-24 22:43:38 -04:00
|
|
|
// Object operations
|
2015-08-03 19:17:21 -04:00
|
|
|
GetObject(w io.Writer, bucket, object string, start, length int64) (int64, *probe.Error)
|
2015-10-02 02:51:17 -04:00
|
|
|
GetObjectMetadata(bucket, object string, signature *signv4.Signature) (ObjectMetadata, *probe.Error)
|
2015-07-09 17:42:04 -04:00
|
|
|
// bucket, object, expectedMD5Sum, size, reader, metadata, signature
|
2015-10-02 02:51:17 -04:00
|
|
|
CreateObject(string, string, string, int64, io.Reader, map[string]string, *signv4.Signature) (ObjectMetadata, *probe.Error)
|
2015-07-02 23:31:22 -04:00
|
|
|
|
|
|
|
Multipart
|
|
|
|
}
|
|
|
|
|
|
|
|
// Multipart API
|
|
|
|
type Multipart interface {
|
2015-10-02 02:51:17 -04:00
|
|
|
NewMultipartUpload(bucket, key, contentType string, signature *signv4.Signature) (string, *probe.Error)
|
|
|
|
AbortMultipartUpload(bucket, key, uploadID string, signature *signv4.Signature) *probe.Error
|
|
|
|
CreateObjectPart(string, string, string, int, string, string, int64, io.Reader, *signv4.Signature) (string, *probe.Error)
|
|
|
|
CompleteMultipartUpload(bucket, key, uploadID string, data io.Reader, signature *signv4.Signature) (ObjectMetadata, *probe.Error)
|
|
|
|
ListMultipartUploads(string, BucketMultipartResourcesMetadata, *signv4.Signature) (BucketMultipartResourcesMetadata, *probe.Error)
|
|
|
|
ListObjectParts(string, string, ObjectResourcesMetadata, *signv4.Signature) (ObjectResourcesMetadata, *probe.Error)
|
2015-04-05 04:53:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Management is a donut management system interface
|
|
|
|
type Management interface {
|
2015-08-03 19:17:21 -04:00
|
|
|
Heal() *probe.Error
|
|
|
|
Rebalance() *probe.Error
|
|
|
|
Info() (map[string][]string, *probe.Error)
|
2015-04-05 04:53:41 -04:00
|
|
|
|
2015-08-03 19:17:21 -04:00
|
|
|
AttachNode(hostname string, disks []string) *probe.Error
|
|
|
|
DetachNode(hostname string) *probe.Error
|
2015-06-24 22:43:38 -04:00
|
|
|
}
|