Browse Source

graph: remove unused functions parameters

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Antonio Murdaca 9 years ago
parent
commit
723f587b56
3 changed files with 10 additions and 12 deletions
  1. 5 5
      graph/graph.go
  2. 3 3
      graph/pull_v1.go
  3. 2 4
      graph/push_v1.go

+ 5 - 5
graph/graph.go

@@ -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)
@@ -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
 	}
@@ -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
@@ -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
 	}
@@ -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 {

+ 3 - 3
graph/pull_v1.go

@@ -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
@@ -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
@@ -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 {

+ 2 - 4
graph/push_v1.go

@@ -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
@@ -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.
@@ -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
 			}
@@ -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)