Files
.copr
.github
.tool
cmd
cni
completions
contrib
docs
hack
libpod
common
driver
driver.go
image
layers
testdata
boltdb_state.go
boltdb_state_internal.go
common_test.go
container.go
container_api.go
container_attach.go
container_commit.go
container_graph.go
container_graph_test.go
container_inspect.go
container_internal.go
container_top.go
diff.go
errors.go
finished_32.go
finished_64.go
in_memory_state.go
info.go
networking.go
oci.go
options.go
pod.go
runtime.go
runtime_ctr.go
runtime_img.go
runtime_img_test.go
runtime_pod.go
state.go
state_test.go
stats.go
storage.go
util.go
util_test.go
version.go
logo
pkg
test
utils
vendor
version
.gitignore
.papr.sh
.papr.yml
.papr_prepare.sh
.travis.yml
API.md
CONTRIBUTING.md
Dockerfile
Dockerfile.CentOS
Dockerfile.Fedora
LICENSE
Makefile
OWNERS
README.md
Vagrantfile
changelog.txt
code-of-conduct.md
commands.md
crio-umount.conf
docker
install.md
libpod.conf
seccomp.json
transfer.md
troubleshooting.md
vendor.conf
baude 6ba6ecf59b Migrate Create|Commit to ginkgo
Migrate create and commit bats tests to the ginkgo
test suite.  In doing so, some structures had to be
moved to pkg/podmanstructs/podmanstructs.go so we
could do better verification of test results.

Signed-off-by: baude <bbaude@redhat.com>

Closes: 
Approved by: rhatdan
2018-02-02 22:44:40 +00:00

41 lines
1.0 KiB
Go

package driver
import (
cstorage "github.com/containers/storage"
"github.com/projectatomic/libpod/pkg/inspect"
)
// GetDriverName returns the name of the driver for the given store
func GetDriverName(store cstorage.Store) (string, error) {
driver, err := store.GraphDriver()
if err != nil {
return "", err
}
return driver.String(), nil
}
// GetDriverMetadata returns the metadata regarding the driver for the layer in the given store
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)
}
// GetDriverData returns the Data struct with information of the driver used by the store
func GetDriverData(store cstorage.Store, layerID string) (*inspect.Data, error) {
name, err := GetDriverName(store)
if err != nil {
return nil, err
}
metaData, err := GetDriverMetadata(store, layerID)
if err != nil {
return nil, err
}
return &inspect.Data{
Name: name,
Data: metaData,
}, nil
}