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

feat: update to latest ipld-resolver #137

Merged
merged 4 commits into from
Feb 8, 2017
Merged

Conversation

daviddias
Copy link
Contributor


pull(
ipldResolver.getStream(new CID(hash)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there no stream method on the resolver anymore Oo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's only available internally, to make the API match straight up what is the dag API.

Copy link
Contributor

Choose a reason for hiding this comment

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

:(

node: node,
cid: new CID(node.multihash)
}, (err) => cb(err, node))
ipldResolver.put(node, new CID(node.multihash), (err) => cb(err, node))
Copy link
Contributor

Choose a reason for hiding this comment

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

this is much worse than before in terms of readability (the change in the resolver api)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

much worse as in 2 to 3 or 2 to 9 in a scale of 0 to 10?

Copy link
Contributor

@dignifiedquire dignifiedquire Feb 8, 2017

Choose a reason for hiding this comment

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

  • readability before: 8
  • readability after: 2

this comes from two things

  1. no named parameters, before the naming made clear what belonged where and as what it was used
  2. put(node, cid, cb) is a confusing signature, as put is closest associated with something like a key value store, where you would have put(key, value, cb). But here you first pass the node, then an id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has to support two variants -- https://github.com/ipld/js-ipld-resolver#putnode-cid--format-hashalg-callback --, how would you like for this to be?

Copy link
Contributor

Choose a reason for hiding this comment

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

How about

resolver.put(node, {cid: cid}, callback)
resolver.put(node, {format: 'dag-pb', hash: 'sha2-256'}, callback)

// or this could work as well, by doing an `Cid.isCid(arguments[0])` check

resolver.put(cid, node, callback)
resolver.put(node, {format: 'dag-pb', hash: 'sha2-256'}, callback)

I am not a 100% sure about these, haven't had time to think through them, but they seem to be better than the current version to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given the presented concerns, I'll go with the first version, the second one is doable, but being able to have node as first and second arguments seems confusing to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -20,7 +20,8 @@ module.exports = (node, name, ipldResolver) => {
function visitor (node) {
return pull(
pull.values(node.links),
paramap((link, cb) => ipldResolver.get(new CID(link.multihash), cb))
paramap((link, cb) => ipldResolver.get(new CID(link.multihash), cb)),
pull.asyncMap((result, cb) => cb(null, result.value))
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this asyncMap, this should be just pull.map((result) => result.value))

@@ -33,7 +33,7 @@ module.exports = (hash, ipldResolver, options) => {
return pull.empty()
}
return pull(
ipldResolver.getStream(new CID(item.hash)),
ipldResolver._getStream(new CID(item.hash)),
Copy link
Contributor

Choose a reason for hiding this comment

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

why this breaking change on the ipldresolver api?

Copy link
Contributor

Choose a reason for hiding this comment

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

nvm, saw the answer above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can expose it again with the new version that also understands paths. (The internal battle between less is more or more being actually more)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thoughts on this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daviddias
Copy link
Contributor Author

daviddias commented Feb 8, 2017

Started seeing npm test died unexpectedly in circle after aegir update. @dignifiedquire ?

image

@daviddias daviddias closed this Feb 8, 2017
@daviddias daviddias removed the status/in-progress In progress label Feb 8, 2017
@daviddias daviddias reopened this Feb 8, 2017
@daviddias daviddias added the status/in-progress In progress label Feb 8, 2017
@daviddias daviddias merged commit 211dfb6 into master Feb 8, 2017
@daviddias daviddias removed the status/in-progress In progress label Feb 8, 2017
@daviddias daviddias deleted the feat/new-ipld-resolver branch February 8, 2017 21:25
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.

2 participants