ipld / js-ipld

The JavaScript Implementation of IPLD
https://ipld.io
MIT License
119 stars 37 forks source link

feat: add support for batch puts #238

Closed hugomrdias closed 4 years ago

hugomrdias commented 4 years ago

This PR add a new method to put Blocks in batch to the datastore.

supports: https://github.com/ipfs/js-ipfs-unixfs-importer/pull/38

codecov[bot] commented 4 years ago

Codecov Report

Merging #238 into master will decrease coverage by 1.68%. The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
- Coverage   86.84%   85.16%   -1.69%     
==========================================
  Files           2        2              
  Lines         152      155       +3     
==========================================
  Hits          132      132              
- Misses         20       23       +3
Impacted Files Coverage Δ
src/index.js 83.45% <80%> (-1.85%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1312244...b928703. Read the comment docs.

achingbrain commented 4 years ago

Could you expand on the use case for this a little? My impression of the API for this module was that it abstracts interactions with the block store, encapsulating node serialization, etc so it seems weird to be passing blocks directly into it.

It also already has putMany (though it's essentially serial as implemented so needs improving).

hugomrdias commented 4 years ago

Could you expand on the use case for this a little? My impression of the API for this module was that it abstracts interactions with the block store, encapsulating node serialization, etc so it seems weird to be passing blocks directly into it.

Yep for me it was weird to have blockstore inside IPLD, it shouldn't handle persistence only data formats. Also it made no sense to create another Array with map when we can send Blocks directly. This is related to performance work in unixfs so it made sense.

It also already has putMany (though it's essentially serial as implemented so needs improving).

Yes putMany its.. well as you said needs improving.

vmx commented 4 years ago

The problem this PR is addressing will be solved on a different layer. For more information see https://github.com/ipfs/js-ipfs-unixfs-importer/pull/38.