code: func (tgzProv *TargzMetadataProvider) GetMetadataAsTarEntries() ([]byte, error) {
  	code, err := tgzProv.getCode()
  	if err != nil {
  		return nil, err
  	}
  
  	is := bytes.NewReader(code)
  	gr, err := gzip.NewReader(is)
  	if err != nil {
  		logger.Errorf("Failure opening codepackage gzip stream: %s", err)
  		return nil, err
  	}
  
  	statedbTarBuffer := bytes.NewBuffer(nil)
  	tw := tar.NewWriter(statedbTarBuffer)
  
  	tr := tar.NewReader(gr)
  
  	// For each file in the code package tar,
  	// add it to the statedb artifact tar if it has "statedb" in the path
  	for {
  		header, err := tr.Next()
  		if err == io.EOF {
  			// We only get here if there are no more entries to scan
  			break
  		}
  		if err != nil {
  			return nil, err
  		}
  
  		if !strings.HasPrefix(header.Name, ccPackageStatedbDir) {
  			continue
  		}
  
  		if err = tw.WriteHeader(header); err != nil {
  			logger.Error("Error adding header to statedb tar:", err, header.Name)
  			return nil, err
  		}
  		if _, err := io.Copy(tw, tr); err != nil {
  			logger.Error("Error copying file to statedb tar:", err, header.Name)
  			return nil, err
  		}
  		logger.Debug("Wrote file to statedb tar:", header.Name)
  	}
  
  	if err = tw.Close(); err != nil {
  		return nil, err
  	}
  
  	logger.Debug("Created metadata tar")
  
  	return statedbTarBuffer.Bytes(), nil
  }
docs: // GetMetadataAsTarEntries extracts metata data from ChaincodeDeploymentSpec