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

More DAG API goodness #123

Merged
merged 8 commits into from
Mar 13, 2017
Merged

More DAG API goodness #123

merged 8 commits into from
Mar 13, 2017

Conversation

daviddias
Copy link
Contributor

@daviddias daviddias commented Mar 9, 2017

Given:

Tasks:

  • update dag.put to return CID
  • update dag.get to accept CID and CID+Path as String
  • dag.tree

Other:

- a CID in its String format concatenated with the path to be resolved
- `options` - a object that might contain the following values:
- `stream` - bool - if set to true, it will return a Node.js Readable Stream.
- `pull` - bool - if set to true, it will return a pull-stream.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dignifiedquire what is your take on this (options for streaming)? See #121

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not a big fan of this, if we want a streaming interface make it multiple methods, i.e.

  • .ls callback, no streaming
  • .lsStream node stream
  • .lsPull pull stream

or sth like that

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed comment about JS specific things, section is under JavaScript so makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dignifiedquire understood. Right now it is PITA because we have places where 'xStream' is returning a pull-stream, other places where there is an option (really legacy) for buffer: true and a lot of internals that are pull-streams and the 'external' (ie js-ipfs) is Node.js Streams for the sake of not breaking API.

I would be down to just sit, define a language for this different options (or through options object or through different methods) and then apply as a golden rule throughout all the modules.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, we should try unify this api, agreed

Copy link
Contributor Author

@daviddias daviddias Mar 9, 2017

Choose a reason for hiding this comment

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

Ok, I'll come up with a proposal then based on things we've discussed. I've some cool ideas, I believe :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

here you go #126

@daviddias daviddias mentioned this pull request Mar 9, 2017
@daviddias daviddias self-assigned this Mar 9, 2017
@daviddias daviddias mentioned this pull request Mar 11, 2017
src/dag.js Outdated
@@ -51,7 +51,7 @@ module.exports = (common) => {
}
})

describe('.put', () => {
describe.only('.put', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

b: [1, 2, 3],
c: {
ca: [5, 6, 7],
cb: 'foo"'
Copy link
Contributor

Choose a reason for hiding this comment

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

why the "?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typo :)

}

ipfs.dag.get('zdpuAmtur968yprkhG9N5Zxn6MFVoqAWBbhUAkNLJs2UtkTq5/a', errOrLog)
// Returns:
Copy link
Contributor

Choose a reason for hiding this comment

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

logs, not returns

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 daviddias merged commit 8004b2b into master Mar 13, 2017
@daviddias daviddias deleted the feat/more-dag-api branch March 13, 2017 14:33
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