Merge pull request #282 from fkautz/pr_out_adding_stubes_for_new_single_disk_driver

master
Frederick F. Kautz IV 10 years ago
commit 3af2894a9e
  1. 84
      pkg/storage/singledisk/singledisk.go
  2. 54
      pkg/storage/singledisk/singledisk_test.go

@ -0,0 +1,84 @@
/*
* Mini 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 singledisk
import (
"errors"
"github.com/minio-io/minio/pkg/storage"
"io"
"os"
)
// StorageDriver creates a new single disk storage driver using donut without encoding.
type StorageDriver struct {
root string
}
// Start a single disk subsystem
func Start(root string) (chan<- string, <-chan error, storage.Storage) {
ctrlChannel := make(chan string)
errorChannel := make(chan error)
s := new(StorageDriver)
go start(ctrlChannel, errorChannel, s)
return ctrlChannel, errorChannel, s
}
func start(ctrlChannel <-chan string, errorChannel chan<- error, s *StorageDriver) {
err := os.MkdirAll(s.root, 0700)
errorChannel <- err
close(errorChannel)
}
// ListBuckets returns a list of buckets
func (diskStorage StorageDriver) ListBuckets() ([]storage.BucketMetadata, error) {
return nil, errors.New("Not Implemented")
}
// StoreBucket creates a new bucket
func (diskStorage StorageDriver) StoreBucket(bucket string) error {
return errors.New("Not Implemented")
}
// StoreBucketPolicy sets a bucket's access policy
func (diskStorage StorageDriver) StoreBucketPolicy(bucket string, p storage.BucketPolicy) error {
return errors.New("Not Implemented")
}
// GetBucketPolicy returns a bucket's access policy
func (diskStorage StorageDriver) GetBucketPolicy(bucket string) (storage.BucketPolicy, error) {
return storage.BucketPolicy{}, errors.New("Not Implemented")
}
// CopyObjectToWriter retrieves an object and writes it to a writer
func (diskStorage StorageDriver) CopyObjectToWriter(w io.Writer, bucket string, object string) (int64, error) {
return 0, errors.New("Not Implemented")
}
// GetObjectMetadata retrieves an object's metadata
func (diskStorage StorageDriver) GetObjectMetadata(bucket string, object string, prefix string) (storage.ObjectMetadata, error) {
return storage.ObjectMetadata{}, errors.New("Not Implemented")
}
// ListObjects lists objects
func (diskStorage StorageDriver) ListObjects(bucket string, resources storage.BucketResourcesMetadata) ([]storage.ObjectMetadata, storage.BucketResourcesMetadata, error) {
return nil, storage.BucketResourcesMetadata{}, errors.New("Not Implemented")
}
// StoreObject creates a new object
func (diskStorage StorageDriver) StoreObject(bucket string, key string, contentType string, data io.Reader) error {
return errors.New("Not Implemented")
}

@ -0,0 +1,54 @@
/*
* Mini 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 singledisk
import (
"io/ioutil"
"os"
"testing"
mstorage "github.com/minio-io/minio/pkg/storage"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
type MySuite struct{}
var _ = Suite(&MySuite{})
func (s *MySuite) TestAPISuite(c *C) {
c.Skip("Not implemented yet.")
var storageList []string
create := func() mstorage.Storage {
path, err := ioutil.TempDir(os.TempDir(), "minio-fs-")
c.Check(err, IsNil)
storageList = append(storageList, path)
_, _, store := Start(path)
return store
}
mstorage.APITestSuite(c, create)
removeRoots(c, storageList)
}
func removeRoots(c *C, roots []string) {
for _, root := range roots {
err := os.RemoveAll(root)
c.Check(err, IsNil)
}
}
Loading…
Cancel
Save