minio/pkg/storage/donut/donut.go

48 lines
1.2 KiB
Go
Raw Normal View History

2015-03-18 17:27:10 -04:00
package donut
import "io"
// INTERFACES
// Donut interface
type Donut interface {
CreateBucket(bucket string) error
ListBuckets() ([]string, error)
2015-03-18 17:27:10 -04:00
GetObjectWriter(bucket, object string) (ObjectWriter, error)
GetObject(bucket, object string) (io.ReadCloser, error)
// GetObjectMetadata(bucket, object string) (map[string]string, error)
// GetObjectWriter(bucket, object string) (ObjectWriter, error)
// ListObjects(bucket string) ([]string, error)
2015-03-18 17:27:10 -04:00
}
// Bucket interface
2015-03-18 17:27:10 -04:00
type Bucket interface {
GetNodes() ([]string, error)
2015-03-18 17:27:10 -04:00
}
2015-03-22 05:53:21 -04:00
// Node interface
type Node interface {
GetBuckets() ([]string, error)
2015-03-22 05:53:21 -04:00
GetWriter(bucket, object string) (Writer, error)
GetReader(bucket, object string) (io.ReadCloser, error)
GetMetadata(bucket, object string) (map[string]string, error)
GetDonutMetadata(bucket, object string) (map[string]string, error)
2015-03-18 17:27:10 -04:00
}
// ObjectWriter interface
2015-03-18 17:27:10 -04:00
type ObjectWriter interface {
Write([]byte) (int, error)
2015-03-18 17:27:10 -04:00
Close() error
CloseWithError(error) error
SetMetadata(map[string]string) error
GetMetadata() (map[string]string, error)
2015-03-18 17:27:10 -04:00
}
2015-03-22 05:53:21 -04:00
// Writer interface
type Writer interface {
2015-03-18 17:27:10 -04:00
ObjectWriter
GetDonutMetadata() (map[string]string, error)
SetDonutMetadata(map[string]string) error
2015-03-18 17:27:10 -04:00
}