You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
package donut
|
|
|
|
import "io"
|
|
|
|
// INTERFACES
|
|
|
|
// Donut interface
|
|
type Donut interface {
|
|
CreateBucket(bucket string) error
|
|
GetObject(bucket, object string) (io.ReadCloser, error)
|
|
GetObjectMetadata(bucket, object string) (map[string]string, error)
|
|
GetObjectWriter(bucket, object string) (ObjectWriter, error)
|
|
ListBuckets() ([]string, error)
|
|
ListObjects(bucket string) ([]string, error)
|
|
}
|
|
|
|
// Bucket interface
|
|
type Bucket interface {
|
|
GetNodes() ([]string, error)
|
|
}
|
|
|
|
// Node interface
|
|
type Node interface {
|
|
GetBuckets() ([]string, error)
|
|
GetDonutMetadata(bucket, object string) (map[string]string, error)
|
|
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)
|
|
}
|
|
|
|
// ObjectWriter interface
|
|
type ObjectWriter interface {
|
|
Close() error
|
|
CloseWithError(error) error
|
|
GetMetadata() (map[string]string, error)
|
|
SetMetadata(map[string]string) error
|
|
Write([]byte) (int, error)
|
|
}
|
|
|
|
// Writer interface
|
|
type Writer interface {
|
|
ObjectWriter
|
|
|
|
GetDonutMetadata() (map[string]string, error)
|
|
SetDonutMetadata(map[string]string) error
|
|
}
|
|
|