Merge pull request #320 from fkautz/pr_out_removing_block_size_from_donut_writer_no_longer_necessary

master
Frederick F. Kautz IV 10 years ago
commit 982a52e0d4
  1. 2
      pkg/donutbox/donutbox.go
  2. 2
      pkg/donutbox/donutmem/donutmem.go
  3. 11
      pkg/donutbox/donutmem/donutmem_test.go
  4. 2
      pkg/storage/encoded/encoded.go

@ -14,7 +14,7 @@ type DonutBox interface {
SetBucketMetadata(bucket string, metadata map[string]string) error SetBucketMetadata(bucket string, metadata map[string]string) error
// object operations // object operations
GetObjectWriter(bucket, object string, column, blockSize uint) (*NewObject, error) GetObjectWriter(bucket, object string, column uint) (*NewObject, error)
GetObjectReader(bucket, object string, column uint) (io.Reader, error) GetObjectReader(bucket, object string, column uint) (io.Reader, error)
GetObjectMetadata(bucket, object string, column uint) (map[string]string, error) GetObjectMetadata(bucket, object string, column uint) (map[string]string, error)
} }

@ -125,7 +125,7 @@ func (donutMem donutMem) SetBucketMetadata(bucketKey string, metadata map[string
} }
// object operations // object operations
func (donutMem donutMem) GetObjectWriter(bucketKey, objectKey string, column uint, blockSize uint) (*donutbox.NewObject, error) { func (donutMem donutMem) GetObjectWriter(bucketKey, objectKey string, column uint) (*donutbox.NewObject, error) {
key := getKey(bucketKey, objectKey, column) key := getKey(bucketKey, objectKey, column)
reader, writer := io.Pipe() reader, writer := io.Pipe()
returnObject := donutbox.CreateNewObject(writer) returnObject := donutbox.CreateNewObject(writer)

@ -19,14 +19,14 @@ func (s *MySuite) TestCreateAndReadObject(c *C) {
data := "Hello World" data := "Hello World"
donut := NewDonutMem() donut := NewDonutMem()
writer, err := donut.GetObjectWriter("foo", "bar", 0, 2) writer, err := donut.GetObjectWriter("foo", "bar", 0)
c.Assert(writer, IsNil) c.Assert(writer, IsNil)
c.Assert(err, Not(IsNil)) c.Assert(err, Not(IsNil))
err = donut.CreateBucket("foo") err = donut.CreateBucket("foo")
c.Assert(err, IsNil) c.Assert(err, IsNil)
writer, err = donut.GetObjectWriter("foo", "bar", 0, 2) writer, err = donut.GetObjectWriter("foo", "bar", 0)
c.Assert(err, IsNil) c.Assert(err, IsNil)
count, err := writer.Write([]byte(data)) count, err := writer.Write([]byte(data))
c.Assert(count, Equals, len(data)) c.Assert(count, Equals, len(data))
@ -41,7 +41,7 @@ func (s *MySuite) TestCreateAndReadObject(c *C) {
c.Assert(result, DeepEquals, []byte(data)) c.Assert(result, DeepEquals, []byte(data))
// try writing, should see error // try writing, should see error
writer, err = donut.GetObjectWriter("foo", "bar", 0, 2) writer, err = donut.GetObjectWriter("foo", "bar", 0)
c.Assert(writer, IsNil) c.Assert(writer, IsNil)
c.Assert(err, Not(IsNil)) c.Assert(err, Not(IsNil))
@ -83,7 +83,7 @@ func (s *MySuite) TestObjectList(c *C) {
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
object := "foo" + strconv.Itoa(i) object := "foo" + strconv.Itoa(i)
objects = append(objects, object) objects = append(objects, object)
writer, err := donut.GetObjectWriter("foo", object, 0, 2) writer, err := donut.GetObjectWriter("foo", object, 0)
c.Assert(err, IsNil) c.Assert(err, IsNil)
writer.Write([]byte(object)) writer.Write([]byte(object))
writer.Close() writer.Close()
@ -126,7 +126,7 @@ func (s *MySuite) TestObjectMetadata(c *C) {
c.Assert(result, IsNil) c.Assert(result, IsNil)
c.Assert(err, Not(IsNil)) c.Assert(err, Not(IsNil))
writer, err := donut.GetObjectWriter("foo", "bar", 1, 2) writer, err := donut.GetObjectWriter("foo", "bar", 1)
c.Assert(err, IsNil) c.Assert(err, IsNil)
_, err = writer.Write([]byte("Hello World")) _, err = writer.Write([]byte("Hello World"))
c.Assert(err, IsNil) c.Assert(err, IsNil)
@ -148,5 +148,4 @@ func (s *MySuite) TestObjectMetadata(c *C) {
result, err = donut.GetObjectMetadata("foo", "bar", 0) result, err = donut.GetObjectMetadata("foo", "bar", 0)
c.Assert(err, Not(IsNil)) c.Assert(err, Not(IsNil))
c.Assert(result, IsNil) c.Assert(result, IsNil)
} }

@ -296,7 +296,7 @@ func (diskStorage StorageDriver) CreateObject(bucketKey, objectKey, contentType,
splitStream := split.Stream(reader, uint64(blockSize)) splitStream := split.Stream(reader, uint64(blockSize))
writers := make([]*donutbox.NewObject, 16) writers := make([]*donutbox.NewObject, 16)
for i := 0; i < 16; i++ { for i := 0; i < 16; i++ {
newWriter, err := diskStorage.donutBox.GetObjectWriter(bucketKey, objectKey, uint(i), uint(blockSize)) newWriter, err := diskStorage.donutBox.GetObjectWriter(bucketKey, objectKey, uint(i))
if err != nil { if err != nil {
closeAllWritersWithError(writers, err) closeAllWritersWithError(writers, err)
return err return err

Loading…
Cancel
Save