minio/pkg/storage/donut/donut.go

51 lines
1.2 KiB
Go
Raw Normal View History

2015-03-18 17:27:10 -04:00
package donut
import (
"io"
)
2015-03-18 17:27:10 -04:00
// INTERFACES
// Donut interface
type Donut interface {
CreateBucket(bucket string) error
GetObject(bucket, object string) (io.ReadCloser, error)
2015-03-22 15:36:51 -04:00
GetObjectMetadata(bucket, object string) (map[string]string, error)
2015-03-22 18:33:52 -04:00
GetObjectWriter(bucket, object string) (ObjectWriter, error)
ListBuckets() ([]string, 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 {
CreateBucket(bucket string) error
GetBuckets() ([]string, error)
GetDonutMetadata(bucket, object string) (map[string]string, error)
2015-03-22 18:33:52 -04:00
GetMetadata(bucket, object string) (map[string]string, error)
GetReader(bucket, object string) (io.ReadCloser, error)
GetWriter(bucket, object string) (Writer, error)
ListObjects(bucket string) ([]string, error)
2015-03-18 17:27:10 -04:00
}
// ObjectWriter interface
2015-03-18 17:27:10 -04:00
type ObjectWriter interface {
Close() error
CloseWithError(error) error
GetMetadata() (map[string]string, error)
2015-03-22 18:33:52 -04:00
SetMetadata(map[string]string) error
Write([]byte) (int, 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
}