minio/pkg/storage/donut/objectwriter.go

40 lines
707 B
Go
Raw Normal View History

package donut
import (
"errors"
)
type objectWriter struct {
metadata map[string]string
}
2015-03-22 05:53:21 -04:00
func (obj objectWriter) Write(data []byte) (length int, err error) {
return 11, nil
}
2015-03-22 05:53:21 -04:00
func (obj objectWriter) Close() error {
return nil
}
2015-03-22 05:53:21 -04:00
func (obj objectWriter) CloseWithError(err error) error {
return errors.New("Not Implemented")
}
2015-03-22 05:53:21 -04:00
func (obj objectWriter) SetMetadata(metadata map[string]string) error {
for k := range obj.metadata {
delete(obj.metadata, k)
}
for k, v := range metadata {
2015-03-22 05:53:21 -04:00
obj.metadata[k] = v
}
return nil
}
2015-03-22 05:53:21 -04:00
func (obj objectWriter) GetMetadata() (map[string]string, error) {
ret := make(map[string]string)
2015-03-22 05:53:21 -04:00
for k, v := range obj.metadata {
ret[k] = v
}
return ret, nil
}