2017-07-21 20:43:30 +00:00
|
|
|
package driver
|
|
|
|
|
|
|
|
import cstorage "github.com/containers/storage"
|
|
|
|
|
2017-07-23 23:01:37 +00:00
|
|
|
// Data handles the data for a storage driver
|
|
|
|
type Data struct {
|
2017-07-21 20:43:30 +00:00
|
|
|
Name string
|
|
|
|
Data map[string]string
|
|
|
|
}
|
|
|
|
|
2017-07-23 23:01:37 +00:00
|
|
|
// GetDriverName returns the name of the driver for the given store
|
2017-07-21 20:43:30 +00:00
|
|
|
func GetDriverName(store cstorage.Store) (string, error) {
|
|
|
|
driver, err := store.GraphDriver()
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
return driver.String(), nil
|
|
|
|
}
|
|
|
|
|
2017-07-23 23:01:37 +00:00
|
|
|
// GetDriverMetadata returns the metadata regarding the driver for the layer in the given store
|
2017-07-21 20:43:30 +00:00
|
|
|
func GetDriverMetadata(store cstorage.Store, layerID string) (map[string]string, error) {
|
|
|
|
driver, err := store.GraphDriver()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return driver.Metadata(layerID)
|
|
|
|
}
|