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

Commit

Permalink
feat: dag.resolve API
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Feb 2, 2017
1 parent 01b4e32 commit d50384e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
13 changes: 13 additions & 0 deletions API/dag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@ If no `callback` is passed, a [promise][] is returned.

`callback` must follow `function (err, dagNode) {}` signature, where `err` is an error if the operation was not successful and `dagNode` is the IPLD format DAG node retrieved.

#### `dag.resolve`

> Resolves an IPLD path
##### `Go` **WIP**

##### `JavaScript` - ipfs.dag.resolve(cid, path, callback)

- `cid` is a [CID][https://github.com/ipfs/js-cid] instance.
- `path` is a String that represents a valid path to be resolved

`callback` must follow `function (err, value) {}` signature, where `err` is an error if the operation was not successful and `value` is the value it was retrieved.

If no `callback` is passed, a [promise][] is returned.
47 changes: 47 additions & 0 deletions src/dag-resolve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-env mocha */
/* eslint max-nested-callbacks: ["error", 8] */

'use strict'

const expect = require('chai').expect
const dagPB = require('ipld-dag-pb')
const DAGNode = dagPB.DAGNode
const dagCBOR = require('ipld-dag-pb')

module.exports = (common) => {
describe('.dag.resolve', () => {
let ipfs

before((done) => {
common.setup((err, factory) => {
expect(err).to.not.exist
factory.spawnNode((err, node) => {
expect(err).to.not.exist
ipfs = node
done()
})
})
})

after((done) => {
common.teardown(done)
})

describe('callback API', () => {
describe('.resolve', () => {
it.skip('dag-pb local scope', (done) => {})
it.skip('dag-pb one level', (done) => {})
it.skip('dag-pb two levels', (done) => {})
it.skip('dag-cbor local scope', (done) => {})
it.skip('dag-cbor one level', (done) => {})
it.skip('dag-cbor two levels', (done) => {})
it.skip('from dag-pb to dag-cbor', (done) => {})
it.skip('from dag-cbor to dag-pb', (done) => {})
})
})

describe('promise API', () => {
describe('.resolve', () => {})
})
})
}

0 comments on commit d50384e

Please sign in to comment.