Removing block size from donut writer, no longer necessary

master
Frederick F. Kautz IV 10 years ago
parent 639f542ac9
commit d6be8d3517
  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
// 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)
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
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)
reader, writer := io.Pipe()
returnObject := donutbox.CreateNewObject(writer)

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

@ -295,7 +295,7 @@ func (diskStorage StorageDriver) CreateObject(bucketKey string, objectKey string
splitStream := split.Stream(reader, uint64(blockSize))
writers := make([]*donutbox.NewObject, 16)
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 {
closeAllWritersWithError(writers, err)
return err

Loading…
Cancel
Save