From c3bcf3928a24ff11f4a6588bdb1a75917ab77ab3 Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Tue, 17 May 2016 08:56:31 -0700 Subject: [PATCH 1/4] use markdown footnotes for DAGNode --- README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8ec096e29..f54d152e9 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ A valid (read: that follows this interface) IPFS core implementation, must expos ##### `JavaScript` - ipfs.object.new([callback]) -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] If no `callback` is passed, a promise is returned. @@ -84,13 +84,13 @@ If no `callback` is passed, a promise is returned. - Object, with format `{ Data: , Links: [] }` - Buffer, requiring that the encoding is specified on the options. If no encoding is specified, Buffer is treated as the Data field -- [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js). +- [DAGNode][] `options` is a optional argument of type object, that can contain the following properties: - `enc`, the encoding of the Buffer (json, yml, etc), if passed a Buffer. -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] If no `callback` is passed, a promise is returned. @@ -115,7 +115,7 @@ If no `callback` is passed, a promise is returned. - `enc`, the encoding of multihash (base58, base64, etc), if any. -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] If no `callback` is passed, a promise is returned. @@ -223,7 +223,7 @@ If no `callback` is passed, a promise is returned. - `enc`, the encoding of multihash (base58, base64, etc), if any. -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) that resulted by the operation of adding a Link. +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] that resulted by the operation of adding a Link. If no `callback` is passed, a promise is returned. @@ -250,7 +250,7 @@ If no `callback` is passed, a promise is returned. - `enc`, the encoding of multihash (base58, base64, etc), if any. -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) that resulted by the operation of adding a Link. +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] that resulted by the operation of adding a Link. If no `callback` is passed, a promise is returned. @@ -277,7 +277,7 @@ If no `callback` is passed, a promise is returned. - `enc`, the encoding of multihash (base58, base64, etc), if any. -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) that resulted by the operation of adding a Link. +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] that resulted by the operation of adding a Link. If no `callback` is passed, a promise is returned. @@ -304,6 +304,9 @@ If no `callback` is passed, a promise is returned. - `enc`, the encoding of multihash (base58, base64, etc), if any. -`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode](https://github.com/vijayee/js-ipfs-merkle-dag/blob/master/src/dag-node.js) that resulted by the operation of adding a Link. +`callback` must follow `function (err, node) {}` signature, where `err` is an error if the operation was not successful and `node` is a MerkleDAG node of the type [DAGNode][] that resulted by the operation of adding a Link. If no `callback` is passed, a promise is returned. + + +[DAGNode]: https://github.com/vijayee/js-ipfs-merkle-dag From e9f08c3bbb3e48d56c18a08c2f64f9c6a78825a9 Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Tue, 17 May 2016 09:01:06 -0700 Subject: [PATCH 2/4] linkify multihash --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f54d152e9..0000fa8b3 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.get(multihash, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -126,7 +126,7 @@ If no `callback` is passed, a promise is returned. ##### `Go` **WIP** ##### `JavaScript` - ipfs.object.data(multihash, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -147,7 +147,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.links(multihash, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -172,7 +172,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.stat(multihash, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -212,7 +212,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.patch.addLink(multihash, DAGLink, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -239,7 +239,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.patch.rmLink(multihash, DAGLink, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -266,7 +266,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.patch.appendData(multihash, data, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -293,7 +293,7 @@ If no `callback` is passed, a promise is returned. ##### `JavaScript` - ipfs.object.patch.setData(multihash, data, [options, callback]) -`multihash` is a [multihash]() which can be passed as: +`multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) - String, the toString version of the multihash (or of an encoded version) @@ -310,3 +310,4 @@ If no `callback` is passed, a promise is returned. [DAGNode]: https://github.com/vijayee/js-ipfs-merkle-dag +[multihash]: http://github.com/jbenet/multihash From aeb8ccec540dbbb1673f33f41570aa5d96691faa Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Tue, 17 May 2016 09:20:22 -0700 Subject: [PATCH 3/4] blocks api draft --- README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0000fa8b3..e3584ac89 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,82 @@ test.all(common) A valid (read: that follows this interface) IPFS core implementation, must expose the following API. +## Block + +### `block.put` + +> Create a new IPFS Block. + +##### `Go` **WIP** + +##### `JavaScript` - ipfs.block.put(data, [callback]) + +Where `data` can be a + +- Buffer, requiring that the encoding is specified on the options. If no + encoding is specified, Buffer is treated as the Data field +- [Block][] instance + +`callback` has the signature `function (err, block) {}`, where `err` is an error +if the operation was not successful. and `block` is a [Block][]. + + + + +### `block.get` + +> Retrieve an IPFS Block from the underlying Block Store by its mulithash. + +##### `Go` **WIP** + +##### `JavaScript` - ipfs.block.get(multihash, [callback]) + +`multihash` is a [multihash][] which can be passed as a + +- Buffer, the raw Buffer of the multihash (or of and encoded version) +- String, the toString version of the multihash (or of an encoded version) + +`callback` must follow the signature `function (err, node) {}`, where `err` is +an error if the operation was not successful and `block` is a [Block][]. + +If no `callback` is passed, a promise is returned. + + + + +### `block.stat` + +> Returns various stats of an IPFS Block + +##### `Go` **WIP** + +##### `JavaScript` - ipfs.block.stat(multihash, [options, callback]) + +`multihash` is a [multihash][] which can be passed as: + +- Buffer, the raw Buffer of the multihash (or of and encoded version) +- String, the toString version of the multihash (or of an encoded version) + +`callback` must follow the signature `function (err, stats) {}`, where `err` is +an error if the operation was not successful and `stats` is an object with +the format + +```JavaScript +{ + Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD', + NumLinks: 0, + BlockSize: 10, + LinksSize: 2, + DataSize: 8, + CumulativeSize: 10 +} +``` + +If no `callback` is passed, a promise is returned. + + + + ## Object ### `object.new` @@ -119,10 +195,6 @@ If no `callback` is passed, a promise is returned. If no `callback` is passed, a promise is returned. -### `object.data` - -> Returns the Data field of an object - ##### `Go` **WIP** ##### `JavaScript` - ipfs.object.data(multihash, [options, callback]) @@ -309,5 +381,6 @@ If no `callback` is passed, a promise is returned. If no `callback` is passed, a promise is returned. +[Block]: https://github.com/ipfs/js-ipfs-block [DAGNode]: https://github.com/vijayee/js-ipfs-merkle-dag [multihash]: http://github.com/jbenet/multihash From afc2a02f560c1b9b853ad77def780a9383042bfd Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Tue, 17 May 2016 09:35:21 -0700 Subject: [PATCH 4/4] update block stat format --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e3584ac89..afe6c1d2a 100644 --- a/README.md +++ b/README.md @@ -116,12 +116,8 @@ the format ```JavaScript { - Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD', - NumLinks: 0, - BlockSize: 10, - LinksSize: 2, - DataSize: 8, - CumulativeSize: 10 + Key: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD', + Size: 10 } ```