code: func (s *LDBStore) Export(out io.Writer) (int64, error) {
  	tw := tar.NewWriter(out)
  	defer tw.Close()
  
  	it := s.db.NewIterator()
  	defer it.Release()
  	var count int64
  	for ok := it.Seek([]byte{keyIndex}); ok; ok = it.Next() {
  		key := it.Key()
  		if (key == nil) || (key[0] != keyIndex) {
  			break
  		}
  
  		var index dpaDBIndex
  
  		hash := key[1:]
  		decodeIndex(it.Value(), &index)
  		po := s.po(hash)
  		datakey := getDataKey(index.Idx, po)
  		log.Trace("store.export", "dkey", fmt.Sprintf("%x", datakey), "dataidx", index.Idx, "po", po)
  		data, err := s.db.Get(datakey)
  		if err != nil {
  			log.Warn(fmt.Sprintf("Chunk %x found but could not be accessed: %v", key, err))
  			continue
  		}
  
  		hdr := &tar.Header{
  			Name: hex.EncodeToString(hash),
  			Mode: 0644,
  			Size: int64(len(data)),
  		}
  		if err := tw.WriteHeader(hdr); err != nil {
  			return count, err
  		}
  		if _, err := tw.Write(data); err != nil {
  			return count, err
  		}
  		count++
  	}
  
  	return count, nil
  }
docs: // Export writes all chunks from the store to a tar archive, returning the
  // number of chunks written.