Skip to content

Commit

Permalink
Merge pull request moby#16308 from runcom/graph-unparam
Browse files Browse the repository at this point in the history
graph: remove unused functions parameters
  • Loading branch information
LK4D4 committed Sep 16, 2015
2 parents c1e59b9 + 723f587 commit 5b99591
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 5 additions & 5 deletions graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (graph *Graph) Register(img *image.Image, layerData io.Reader) (err error)
// (FIXME: make that mandatory for drivers).
graph.driver.Remove(img.ID)

tmp, err := graph.mktemp("")
tmp, err := graph.mktemp()
defer os.RemoveAll(tmp)
if err != nil {
return fmt.Errorf("mktemp failed: %s", err)
Expand Down Expand Up @@ -301,7 +301,7 @@ func (graph *Graph) TempLayerArchive(id string, sf *streamformatter.StreamFormat
if err != nil {
return nil, err
}
tmp, err := graph.mktemp("")
tmp, err := graph.mktemp()
if err != nil {
return nil, err
}
Expand All @@ -323,7 +323,7 @@ func (graph *Graph) TempLayerArchive(id string, sf *streamformatter.StreamFormat
}

// 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())
if err := system.MkdirAll(dir, 0700); err != nil {
return "", err
Expand All @@ -332,7 +332,7 @@ func (graph *Graph) mktemp(id string) (string, error) {
}

func (graph *Graph) newTempFile() (*os.File, error) {
tmp, err := graph.mktemp("")
tmp, err := graph.mktemp()
if err != nil {
return nil, err
}
Expand All @@ -345,7 +345,7 @@ func (graph *Graph) Delete(name string) error {
if err != nil {
return err
}
tmp, err := graph.mktemp("")
tmp, err := graph.mktemp()
graph.idIndex.Delete(id)
if err == nil {
if err := os.Rename(graph.imageRoot(id), tmp); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions graph/pull_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (p *v1Puller) pullRepository(askedTag string) error {
for _, ep := range p.repoInfo.Index.Mirrors {
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))
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.
logrus.Debugf("Error pulling image (%s) from %s, mirror: %s, %s", img.Tag, p.repoInfo.CanonicalName, ep, err)
continue
Expand All @@ -170,7 +170,7 @@ func (p *v1Puller) pullRepository(askedTag string) error {
if !success {
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))
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.
// As the error is also given to the output stream the user will see the error.
lastErr = err
Expand Down Expand Up @@ -224,7 +224,7 @@ func (p *v1Puller) pullRepository(askedTag string) error {
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
history, err = p.session.GetRemoteHistory(imgID, endpoint)
if err != nil {
Expand Down
6 changes: 2 additions & 4 deletions graph/push_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ func (s *TagStore) createImageIndex(images []string, tags map[string][]string) [
type imagePushData struct {
id string
endpoint string
tokens []string
}

// lookupImageOnEndpoint checks the specified endpoint to see if an image exists
Expand Down Expand Up @@ -184,7 +183,6 @@ func (p *v1Pusher) pushImageToEndpoint(endpoint string, imageIDs []string, tags
imageData <- imagePushData{
id: id,
endpoint: endpoint,
tokens: repo.Tokens,
}
}
// close the channel to notify the workers that there will be no more images to check.
Expand All @@ -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.
for _, id := range imageIDs {
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?
return err
}
Expand Down Expand Up @@ -254,7 +252,7 @@ func (p *v1Pusher) pushRepository(tag string) error {
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)
if err != nil {
return "", fmt.Errorf("Cannot retrieve the path for {%s}: %s", imgID, err)
Expand Down

0 comments on commit 5b99591

Please sign in to comment.