Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

feat: expose getFormat function #292

Merged
merged 1 commit into from
Oct 27, 2020
Merged

feat: expose getFormat function #292

merged 1 commit into from
Oct 27, 2020

Conversation

achingbrain
Copy link
Member

It's useful to be able to get the format implementations out of ipld
just before ipld.put operations in the HTTP API server of IPFS.

This is because we've serialized the node on the client for transmission
over HTTP so need to deserialize it before passing it into ipld.put
for it to be serialized (and as such, verified) again.

We can duplicate the list of resolvers and logic behind the addition
of new resolvers from ipld or we can just expose the getFormat function
which we do here to reduce any code duplication.

It's useful to be able to get the format implementations out of ipld
just before `ipld.put` operations in the HTTP API server of IPFS.

This is because we've serialized the node on the client for transmission
over HTTP so need to deserialize it before passing it into `ipld.put`
for it to be serialized (and as such, verified) again.

We can duplicate the list of resolvers and logic behind the addition
of new resolvers from ipld or we can just expose the `getFormat` function
which we do here to reduce any code duplication.
@achingbrain achingbrain requested a review from vmx October 26, 2020 15:58
@codecov
Copy link

codecov bot commented Oct 26, 2020

Codecov Report

Merging #292 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #292   +/-   ##
=======================================
  Coverage   88.23%   88.23%           
=======================================
  Files           3        3           
  Lines         153      153           
=======================================
  Hits          135      135           
  Misses         18       18           
Impacted Files Coverage Δ
src/index.js 86.76% <100.00%> (ø)

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 5bdfe5c...01bbe50. Read the comment docs.

Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine to me, it'd be nice if we migrated to the "codec" language but I guess "format" is baked in here already

Copy link
Member

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for also remembering to put it into the README.

@vmx vmx merged commit 78c8769 into master Oct 27, 2020
@vmx vmx deleted the feat/expose-get-format branch October 27, 2020 10:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants