2015-03-14 14:34:26 -04:00
|
|
|
/*
|
2015-03-19 17:35:50 -04:00
|
|
|
* Minimalist Object Storage, (C) 2015 Minio, Inc.
|
2015-03-14 14:34:26 -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.
|
|
|
|
*/
|
|
|
|
|
2015-03-18 15:25:37 -04:00
|
|
|
package donutstorage
|
2015-03-14 14:34:26 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"github.com/minio-io/minio/pkg/storage"
|
2015-03-22 22:55:15 -04:00
|
|
|
"io"
|
2015-03-14 14:34:26 -04:00
|
|
|
)
|
|
|
|
|
2015-03-18 15:25:37 -04:00
|
|
|
// DonutDriver creates a new single disk storage driver using donut without encoding.
|
2015-03-22 22:55:15 -04:00
|
|
|
type DonutDriver struct{}
|
2015-03-14 14:34:26 -04:00
|
|
|
|
2015-03-16 21:20:01 -04:00
|
|
|
const (
|
|
|
|
blockSize = 10 * 1024 * 1024
|
|
|
|
)
|
|
|
|
|
2015-03-14 14:34:26 -04:00
|
|
|
// Start a single disk subsystem
|
2015-03-22 22:55:15 -04:00
|
|
|
func Start() (chan<- string, <-chan error, storage.Storage) {
|
2015-03-14 14:34:26 -04:00
|
|
|
ctrlChannel := make(chan string)
|
|
|
|
errorChannel := make(chan error)
|
2015-03-18 15:25:37 -04:00
|
|
|
s := new(DonutDriver)
|
2015-03-14 14:34:26 -04:00
|
|
|
go start(ctrlChannel, errorChannel, s)
|
|
|
|
return ctrlChannel, errorChannel, s
|
|
|
|
}
|
|
|
|
|
2015-03-18 15:25:37 -04:00
|
|
|
func start(ctrlChannel <-chan string, errorChannel chan<- error, s *DonutDriver) {
|
2015-03-14 14:34:26 -04:00
|
|
|
close(errorChannel)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListBuckets returns a list of buckets
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) ListBuckets() (results []storage.BucketMetadata, err error) {
|
2015-03-22 22:55:15 -04:00
|
|
|
return nil, errors.New("Not Implemented")
|
2015-03-14 14:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateBucket creates a new bucket
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) CreateBucket(bucket string) error {
|
2015-03-22 22:55:15 -04:00
|
|
|
return errors.New("Not Implemented")
|
2015-03-17 02:41:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetBucketMetadata retrieves an bucket's metadata
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) GetBucketMetadata(bucket string) (storage.BucketMetadata, error) {
|
2015-03-22 22:55:15 -04:00
|
|
|
return storage.BucketMetadata{}, errors.New("Not Implemented")
|
2015-03-14 14:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateBucketPolicy sets a bucket's access policy
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) CreateBucketPolicy(bucket string, p storage.BucketPolicy) error {
|
2015-03-14 14:34:26 -04:00
|
|
|
return errors.New("Not Implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetBucketPolicy returns a bucket's access policy
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) GetBucketPolicy(bucket string) (storage.BucketPolicy, error) {
|
2015-03-14 14:34:26 -04:00
|
|
|
return storage.BucketPolicy{}, errors.New("Not Implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetObject retrieves an object and writes it to a writer
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) GetObject(target io.Writer, bucket, key string) (int64, error) {
|
2015-03-22 22:55:15 -04:00
|
|
|
return 0, errors.New("Not Implemented")
|
2015-03-14 14:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetPartialObject retrieves an object and writes it to a writer
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) GetPartialObject(w io.Writer, bucket, object string, start, length int64) (int64, error) {
|
2015-03-14 14:34:26 -04:00
|
|
|
return 0, errors.New("Not Implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetObjectMetadata retrieves an object's metadata
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) GetObjectMetadata(bucket, key string, prefix string) (storage.ObjectMetadata, error) {
|
2015-03-22 22:55:15 -04:00
|
|
|
return storage.ObjectMetadata{}, errors.New("Not Implemented")
|
2015-03-14 14:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ListObjects lists objects
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) ListObjects(bucket string, resources storage.BucketResourcesMetadata) ([]storage.ObjectMetadata, storage.BucketResourcesMetadata, error) {
|
2015-03-22 22:55:15 -04:00
|
|
|
return nil, storage.BucketResourcesMetadata{}, errors.New("Not Implemented")
|
2015-03-14 14:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateObject creates a new object
|
2015-03-18 15:25:37 -04:00
|
|
|
func (donutStorage DonutDriver) CreateObject(bucketKey, objectKey, contentType, md5sum string, reader io.Reader) error {
|
2015-03-22 22:55:15 -04:00
|
|
|
return errors.New("Not Implemented")
|
2015-03-16 20:40:59 -04:00
|
|
|
}
|