Require storage drivers to report their name
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
f3443f8f64
commit
b645555422
5 changed files with 20 additions and 0 deletions
|
@ -94,6 +94,9 @@ func New(accountName, accountKey, container, realm string) (*Driver, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement the storagedriver.StorageDriver interface.
|
// Implement the storagedriver.StorageDriver interface.
|
||||||
|
func (d *driver) Name() string {
|
||||||
|
return driverName
|
||||||
|
}
|
||||||
|
|
||||||
// GetContent retrieves the content stored at "path" as a []byte.
|
// GetContent retrieves the content stored at "path" as a []byte.
|
||||||
func (d *driver) GetContent(path string) ([]byte, error) {
|
func (d *driver) GetContent(path string) ([]byte, error) {
|
||||||
|
|
|
@ -71,6 +71,10 @@ func New(rootDirectory string) *Driver {
|
||||||
|
|
||||||
// Implement the storagedriver.StorageDriver interface
|
// Implement the storagedriver.StorageDriver interface
|
||||||
|
|
||||||
|
func (d *driver) Name() string {
|
||||||
|
return driverName
|
||||||
|
}
|
||||||
|
|
||||||
// GetContent retrieves the content stored at "path" as a []byte.
|
// GetContent retrieves the content stored at "path" as a []byte.
|
||||||
func (d *driver) GetContent(path string) ([]byte, error) {
|
func (d *driver) GetContent(path string) ([]byte, error) {
|
||||||
rc, err := d.ReadStream(path, 0)
|
rc, err := d.ReadStream(path, 0)
|
||||||
|
|
|
@ -64,6 +64,10 @@ func New() *Driver {
|
||||||
|
|
||||||
// Implement the storagedriver.StorageDriver interface.
|
// Implement the storagedriver.StorageDriver interface.
|
||||||
|
|
||||||
|
func (d *driver) Name() string {
|
||||||
|
return driverName
|
||||||
|
}
|
||||||
|
|
||||||
// GetContent retrieves the content stored at "path" as a []byte.
|
// GetContent retrieves the content stored at "path" as a []byte.
|
||||||
func (d *driver) GetContent(path string) ([]byte, error) {
|
func (d *driver) GetContent(path string) ([]byte, error) {
|
||||||
d.mutex.RLock()
|
d.mutex.RLock()
|
||||||
|
|
|
@ -261,6 +261,10 @@ func New(params DriverParameters) (*Driver, error) {
|
||||||
|
|
||||||
// Implement the storagedriver.StorageDriver interface
|
// Implement the storagedriver.StorageDriver interface
|
||||||
|
|
||||||
|
func (d *driver) Name() string {
|
||||||
|
return driverName
|
||||||
|
}
|
||||||
|
|
||||||
// GetContent retrieves the content stored at "path" as a []byte.
|
// GetContent retrieves the content stored at "path" as a []byte.
|
||||||
func (d *driver) GetContent(path string) ([]byte, error) {
|
func (d *driver) GetContent(path string) ([]byte, error) {
|
||||||
content, err := d.Bucket.Get(d.s3Path(path))
|
content, err := d.Bucket.Get(d.s3Path(path))
|
||||||
|
|
|
@ -35,6 +35,11 @@ const CurrentVersion Version = "0.1"
|
||||||
// StorageDriver defines methods that a Storage Driver must implement for a
|
// StorageDriver defines methods that a Storage Driver must implement for a
|
||||||
// filesystem-like key/value object storage.
|
// filesystem-like key/value object storage.
|
||||||
type StorageDriver interface {
|
type StorageDriver interface {
|
||||||
|
// Name returns the human-readable "name" of the driver, useful in error
|
||||||
|
// messages and logging. By convention, this will just be the registration
|
||||||
|
// name, but drivers may provide other information here.
|
||||||
|
Name() string
|
||||||
|
|
||||||
// GetContent retrieves the content stored at "path" as a []byte.
|
// GetContent retrieves the content stored at "path" as a []byte.
|
||||||
// This should primarily be used for small objects.
|
// This should primarily be used for small objects.
|
||||||
GetContent(path string) ([]byte, error)
|
GetContent(path string) ([]byte, error)
|
||||||
|
|
Loading…
Reference in a new issue