mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon: access to distribution internals
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
6fcb36ff14
commit
ea36c3cbaf
4 changed files with 32 additions and 0 deletions
|
@ -922,6 +922,10 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
|
|||
return d, nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) DistributionServices() images.DistributionServices {
|
||||
return daemon.imageService.DistributionServices()
|
||||
}
|
||||
|
||||
func (daemon *Daemon) waitForStartupDone() {
|
||||
<-daemon.startupDone
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package images // import "github.com/docker/docker/daemon/images"
|
|||
import (
|
||||
"context"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/docker/docker/container"
|
||||
daemonevents "github.com/docker/docker/daemon/events"
|
||||
"github.com/docker/docker/distribution"
|
||||
"github.com/docker/docker/distribution/metadata"
|
||||
"github.com/docker/docker/distribution/xfer"
|
||||
"github.com/docker/docker/image"
|
||||
|
@ -74,6 +76,24 @@ type ImageService struct {
|
|||
uploadManager *xfer.LayerUploadManager
|
||||
}
|
||||
|
||||
type DistributionServices struct {
|
||||
DownloadManager distribution.RootFSDownloadManager
|
||||
V2MetadataService metadata.V2MetadataService
|
||||
LayerStore layer.Store // TODO: lcow
|
||||
ImageStore image.Store
|
||||
ReferenceStore dockerreference.Store
|
||||
}
|
||||
|
||||
func (i *ImageService) DistributionServices() DistributionServices {
|
||||
return DistributionServices{
|
||||
DownloadManager: i.downloadManager,
|
||||
V2MetadataService: metadata.NewV2MetadataService(i.distributionMetadataStore),
|
||||
LayerStore: i.layerStores[runtime.GOOS],
|
||||
ImageStore: i.imageStore,
|
||||
ReferenceStore: i.referenceStore,
|
||||
}
|
||||
}
|
||||
|
||||
// CountImages returns the number of images stored by ImageService
|
||||
// called from info.go
|
||||
func (i *ImageService) CountImages() int {
|
||||
|
|
|
@ -121,6 +121,10 @@ func newStoreFromGraphDriver(root string, driver graphdriver.Driver, os string)
|
|||
return ls, nil
|
||||
}
|
||||
|
||||
func (ls *layerStore) Driver() graphdriver.Driver {
|
||||
return ls.driver
|
||||
}
|
||||
|
||||
func (ls *layerStore) loadLayer(layer ChainID) (*roLayer, error) {
|
||||
cl, ok := ls.layerMap[layer]
|
||||
if ok {
|
||||
|
|
|
@ -54,6 +54,10 @@ func (rl *roLayer) TarStreamFrom(parent ChainID) (io.ReadCloser, error) {
|
|||
return rl.layerStore.driver.Diff(rl.cacheID, parentCacheID)
|
||||
}
|
||||
|
||||
func (rl *roLayer) CacheID() string {
|
||||
return rl.cacheID
|
||||
}
|
||||
|
||||
func (rl *roLayer) ChainID() ChainID {
|
||||
return rl.chainID
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue