code: func (s *GlobalStore) Import(r io.Reader) (n int, err error) {
  	tr := tar.NewReader(r)
  
  	for {
  		hdr, err := tr.Next()
  		if err != nil {
  			if err == io.EOF {
  				break
  			}
  			return n, err
  		}
  
  		data, err := ioutil.ReadAll(tr)
  		if err != nil {
  			return n, err
  		}
  
  		var c mock.ExportedChunk
  		if err = json.Unmarshal(data, &c); err != nil {
  			return n, err
  		}
  
  		key := common.Hex2Bytes(hdr.Name)
  
  		batch := new(leveldb.Batch)
  		for _, addr := range c.Addrs {
  			batch.Put(indexForHashesPerNode(addr, key), nil)
  			batch.Put(indexForNodesWithHash(key, addr), nil)
  			batch.Put(indexForNodes(addr), nil)
  		}
  
  		batch.Put(indexForHashes(key), nil)
  		batch.Put(indexDataKey(key), c.Data)
  
  		if err = s.db.Write(batch, nil); err != nil {
  			return n, err
  		}
  
  		n++
  	}
  	return n, err
  }
docs: // Import reads tar archive from a reader that contains exported chunk data.
  // It returns the number of chunks imported and an error.