mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
graph: remove unused functions parameters
Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
parent
db2ac8655d
commit
723f587b56
3 changed files with 10 additions and 12 deletions
|
@ -263,7 +263,7 @@ func (graph *Graph) Register(img *image.Image, layerData io.Reader) (err error)
|
||||||
// (FIXME: make that mandatory for drivers).
|
// (FIXME: make that mandatory for drivers).
|
||||||
graph.driver.Remove(img.ID)
|
graph.driver.Remove(img.ID)
|
||||||
|
|
||||||
tmp, err := graph.mktemp("")
|
tmp, err := graph.mktemp()
|
||||||
defer os.RemoveAll(tmp)
|
defer os.RemoveAll(tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("mktemp failed: %s", err)
|
return fmt.Errorf("mktemp failed: %s", err)
|
||||||
|
@ -301,7 +301,7 @@ func (graph *Graph) TempLayerArchive(id string, sf *streamformatter.StreamFormat
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tmp, err := graph.mktemp("")
|
tmp, err := graph.mktemp()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ func (graph *Graph) TempLayerArchive(id string, sf *streamformatter.StreamFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
// mktemp creates a temporary sub-directory inside the graph's filesystem.
|
// mktemp creates a temporary sub-directory inside the graph's filesystem.
|
||||||
func (graph *Graph) mktemp(id string) (string, error) {
|
func (graph *Graph) mktemp() (string, error) {
|
||||||
dir := filepath.Join(graph.root, "_tmp", stringid.GenerateNonCryptoID())
|
dir := filepath.Join(graph.root, "_tmp", stringid.GenerateNonCryptoID())
|
||||||
if err := system.MkdirAll(dir, 0700); err != nil {
|
if err := system.MkdirAll(dir, 0700); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -332,7 +332,7 @@ func (graph *Graph) mktemp(id string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (graph *Graph) newTempFile() (*os.File, error) {
|
func (graph *Graph) newTempFile() (*os.File, error) {
|
||||||
tmp, err := graph.mktemp("")
|
tmp, err := graph.mktemp()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ func (graph *Graph) Delete(name string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tmp, err := graph.mktemp("")
|
tmp, err := graph.mktemp()
|
||||||
graph.idIndex.Delete(id)
|
graph.idIndex.Delete(id)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err := os.Rename(graph.imageRoot(id), tmp); err != nil {
|
if err := os.Rename(graph.imageRoot(id), tmp); err != nil {
|
||||||
|
|
|
@ -158,7 +158,7 @@ func (p *v1Puller) pullRepository(askedTag string) error {
|
||||||
for _, ep := range p.repoInfo.Index.Mirrors {
|
for _, ep := range p.repoInfo.Index.Mirrors {
|
||||||
ep += "v1/"
|
ep += "v1/"
|
||||||
broadcaster.Write(p.sf.FormatProgress(stringid.TruncateID(img.ID), fmt.Sprintf("Pulling image (%s) from %s, mirror: %s", img.Tag, p.repoInfo.CanonicalName, ep), nil))
|
broadcaster.Write(p.sf.FormatProgress(stringid.TruncateID(img.ID), fmt.Sprintf("Pulling image (%s) from %s, mirror: %s", img.Tag, p.repoInfo.CanonicalName, ep), nil))
|
||||||
if isDownloaded, err = p.pullImage(broadcaster, img.ID, ep, repoData.Tokens); err != nil {
|
if isDownloaded, err = p.pullImage(broadcaster, img.ID, ep); err != nil {
|
||||||
// Don't report errors when pulling from mirrors.
|
// Don't report errors when pulling from mirrors.
|
||||||
logrus.Debugf("Error pulling image (%s) from %s, mirror: %s, %s", img.Tag, p.repoInfo.CanonicalName, ep, err)
|
logrus.Debugf("Error pulling image (%s) from %s, mirror: %s, %s", img.Tag, p.repoInfo.CanonicalName, ep, err)
|
||||||
continue
|
continue
|
||||||
|
@ -170,7 +170,7 @@ func (p *v1Puller) pullRepository(askedTag string) error {
|
||||||
if !success {
|
if !success {
|
||||||
for _, ep := range repoData.Endpoints {
|
for _, ep := range repoData.Endpoints {
|
||||||
broadcaster.Write(p.sf.FormatProgress(stringid.TruncateID(img.ID), fmt.Sprintf("Pulling image (%s) from %s, endpoint: %s", img.Tag, p.repoInfo.CanonicalName, ep), nil))
|
broadcaster.Write(p.sf.FormatProgress(stringid.TruncateID(img.ID), fmt.Sprintf("Pulling image (%s) from %s, endpoint: %s", img.Tag, p.repoInfo.CanonicalName, ep), nil))
|
||||||
if isDownloaded, err = p.pullImage(broadcaster, img.ID, ep, repoData.Tokens); err != nil {
|
if isDownloaded, err = p.pullImage(broadcaster, img.ID, ep); err != nil {
|
||||||
// It's not ideal that only the last error is returned, it would be better to concatenate the errors.
|
// It's not ideal that only the last error is returned, it would be better to concatenate the errors.
|
||||||
// As the error is also given to the output stream the user will see the error.
|
// As the error is also given to the output stream the user will see the error.
|
||||||
lastErr = err
|
lastErr = err
|
||||||
|
@ -224,7 +224,7 @@ func (p *v1Puller) pullRepository(askedTag string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *v1Puller) pullImage(out io.Writer, imgID, endpoint string, token []string) (layersDownloaded bool, err error) {
|
func (p *v1Puller) pullImage(out io.Writer, imgID, endpoint string) (layersDownloaded bool, err error) {
|
||||||
var history []string
|
var history []string
|
||||||
history, err = p.session.GetRemoteHistory(imgID, endpoint)
|
history, err = p.session.GetRemoteHistory(imgID, endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -139,7 +139,6 @@ func (s *TagStore) createImageIndex(images []string, tags map[string][]string) [
|
||||||
type imagePushData struct {
|
type imagePushData struct {
|
||||||
id string
|
id string
|
||||||
endpoint string
|
endpoint string
|
||||||
tokens []string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookupImageOnEndpoint checks the specified endpoint to see if an image exists
|
// lookupImageOnEndpoint checks the specified endpoint to see if an image exists
|
||||||
|
@ -184,7 +183,6 @@ func (p *v1Pusher) pushImageToEndpoint(endpoint string, imageIDs []string, tags
|
||||||
imageData <- imagePushData{
|
imageData <- imagePushData{
|
||||||
id: id,
|
id: id,
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
tokens: repo.Tokens,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// close the channel to notify the workers that there will be no more images to check.
|
// close the channel to notify the workers that there will be no more images to check.
|
||||||
|
@ -197,7 +195,7 @@ func (p *v1Pusher) pushImageToEndpoint(endpoint string, imageIDs []string, tags
|
||||||
// is very important that is why we are still iterating over the ordered list of imageIDs.
|
// is very important that is why we are still iterating over the ordered list of imageIDs.
|
||||||
for _, id := range imageIDs {
|
for _, id := range imageIDs {
|
||||||
if _, push := shouldPush[id]; push {
|
if _, push := shouldPush[id]; push {
|
||||||
if _, err := p.pushImage(id, endpoint, repo.Tokens); err != nil {
|
if _, err := p.pushImage(id, endpoint); err != nil {
|
||||||
// FIXME: Continue on error?
|
// FIXME: Continue on error?
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -254,7 +252,7 @@ func (p *v1Pusher) pushRepository(tag string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *v1Pusher) pushImage(imgID, ep string, token []string) (checksum string, err error) {
|
func (p *v1Pusher) pushImage(imgID, ep string) (checksum string, err error) {
|
||||||
jsonRaw, err := p.graph.RawJSON(imgID)
|
jsonRaw, err := p.graph.RawJSON(imgID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("Cannot retrieve the path for {%s}: %s", imgID, err)
|
return "", fmt.Errorf("Cannot retrieve the path for {%s}: %s", imgID, err)
|
||||||
|
|
Loading…
Reference in a new issue