forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request containers#8950 from mheon/exorcise_driver
Exorcise Driver code from libpod/define
- Loading branch information
Showing
5 changed files
with
19 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,26 @@ | ||
package driver | ||
|
||
import ( | ||
cstorage "github.com/containers/storage" | ||
"github.com/containers/podman/v2/libpod/define" | ||
"github.com/containers/storage" | ||
) | ||
|
||
// Data handles the data for a storage driver | ||
type Data struct { | ||
Name string `json:"Name"` | ||
Data map[string]string `json:"Data"` | ||
} | ||
|
||
// 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) { | ||
// GetDriverData returns information on a given store's running graph driver. | ||
func GetDriverData(store storage.Store, layerID string) (*define.DriverData, 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) (*Data, error) { | ||
name, err := GetDriverName(store) | ||
if err != nil { | ||
return nil, err | ||
} | ||
metaData, err := GetDriverMetadata(store, layerID) | ||
metaData, err := driver.Metadata(layerID) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if mountTimes, err := store.Mounted(layerID); mountTimes == 0 || err != nil { | ||
delete(metaData, "MergedDir") | ||
} | ||
|
||
return &Data{ | ||
Name: name, | ||
return &define.DriverData{ | ||
Name: driver.String(), | ||
Data: metaData, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters