├── LICENSE ├── README.md ├── mediachain ├── README.md └── example.yml ├── post ├── README.md ├── example.yml ├── paths-1.md ├── paths-2.md ├── paths-3.md ├── paths-4.md ├── paths-5.md ├── paths-6.md ├── paths-7.md └── paths-8.md └── unixfs ├── README.md ├── example.yml ├── paths-1.md ├── paths-2.md ├── paths-3.md ├── paths-4.md ├── paths-5.md ├── paths-6.md ├── paths-7.md ├── paths-8.md └── paths-unixfs.md /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Protocol Labs, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **This repository is no longer maintained, see https://ipld.io for the latest information on IPLD and its use.** 2 | 3 | # IPLD Examples 4 | 5 | [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) 6 | [![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) 7 | [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) 8 | 9 | This repo contains several datastructure examples to use with [IPLD](//github.com/ipfs/specs/tree/master/ipld), the new data format for IPFS. 10 | 11 | These examples aim to be complete. 12 | 13 | ## Contents 14 | 15 | - (todo) [foaf](foaf) SW/LD style FOAF 16 | - (todo) [identity](identity) a basic identity system 17 | - (todo) [keychain](keychain) a draft for [the keychain datastruct](//github.com/ipfs/specs/tree/master/keychain) 18 | - (wip) [mediachain](mediachain) a draft for the Mine [Mediachain](//medium.com/mine-labs/mediachain-483f49cbe37a) 19 | - (todo) [minecraft](minecraft) for a minecraft like game. 20 | - (todo) [multikey](multikey) a draft for [the multikey format](//github.com/jbenet/multikey) 21 | - (todo) [orbit](orbit) a draft for [orbit](//github.com/haadcode/anonymous-networks) 22 | - (ok) [post](post) a draft for [POST](//github.com/ipfs/POST) 23 | - (todo) [schema.org](schema.org) a draft for the [schema.org](//schema.org) datastructs. 24 | - (todo) [sharding](sharding) a draft for [IPFS object sharding](//github.com/ipfs/notes/issues/76) 25 | - (ok) [unixfs](unixfs) a draft for [IPFS unixfs](//github.com/ipfs/specs/tree/master/unixfs) 26 | - (todo) [uport](uport) a draft for the Ethereum/ConsenSys uPort wallet profiles 27 | 28 | ## Experiment 29 | 30 | ### Pathing Semantics 31 | 32 | How to structure pathing and resolution through objects is a troublesome issue. You can read [the IPLD spec here](https://github.com/ipfs/specs/blob/ipld-spec/merkledag/ipld.md) and read [some of the arguments here](https://github.com/ipfs/specs/pull/37). 33 | 34 | The problem boils down to an issue introduced by the combination of **link-local properties** (properties on the link object itself) and **transparent resolution of objects and links** (using a single delimiter for traversing objects and links). 35 | 36 | To resolve this, a number of variations have been presented: 37 | 38 | - **1) transparent, no link properties access** use only `/` but disallow accessing link-local properties. cons: cannot access link properties :( 39 | - **2) transparent, no link properties** use only `/` but disallow using link-local properties. cons: cannot HAVE link properties :c 40 | - **3) transparent, hope for the best** use only `/` and _define_ the order the accesses happen, so that it is not ambiguous. cons: it may be confusing. 41 | - **4) different delimiters, strict** - use different delimiters for "link local" and "link resolving" components (eg `. /` or `/ //`). cons: two delimiters, escaping or incompatibilities 42 | - **5) different delimiters, permissive** like (3) + (4), allow different delimiters to disambiguate "link local" and "link resolving" components 43 | - **6) .object and .link accessors** use explicit `.object` to access the object resolved through, and/or `.link` for accessing link local properties. 44 | - **7) use explicit `link/` to resolve through** (or some other operator string/char) con: a/link/b/link/c/link typing. 45 | - **8) different delimiters, strict and explicit `link/`**, a combination of (4) and (7). 46 | 47 | One goal of this repo is to experiment with these and see which feels best. 48 | 49 | ## Contribute 50 | 51 | Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/ipld-examples/issues)! 52 | 53 | This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). 54 | 55 | [![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) 56 | 57 | ## License 58 | 59 | [MIT](LICENSE) 60 | -------------------------------------------------------------------------------- /mediachain/README.md: -------------------------------------------------------------------------------- 1 | # Mediachain IPLD Example 2 | 3 | [This is an example to exercise IPLD](../). 4 | 5 | [mediachain](https://github.com/mediachain/mediachain) is a datastructure and set of conventions for representing media (images, audio, video) metadata. The outer (encapsulating) "meta-metadata" structure is stable, while the inner (encapsulated) structure is a flexible representation of a 3rd party schema. 6 | 7 | ### Encapsulating Object 8 | The outer scope represents the stable, mediachain-specific data. It looks something like this 9 | ```json 10 | { 11 | "@type": "Mediachain", 12 | "statements": [ 13 | { 14 | "ts": "2007-03-01T13:00:00Z", 15 | "@mediachain_type": "NYPL-0.1", 16 | "link": "Qm..." 17 | } 18 | ] 19 | } 20 | ``` 21 | 22 | ### Encapsulated Object 23 | The inner scope can represent either a standard Mediachain native schema object (see below) or an appropriately labeled 3rd party object, which the client will understand semantically based on the label. The format of this object can vary, with the primary restriction of being encodable as JSON-LD, with no circular references. 24 | 25 | ### Object Types 26 | The standard, native object format is based on [schema.org Creative Work](http://schema.org/CreativeWork) and respective subtypes (MusicRecording, Photograph, etc). The objects should translate cleanly to the corresponding JSON-LD schema.org types. 27 | 28 | ### Resolver Table 29 | TBD 30 | 31 | ### Object Examples 32 | 33 | See [example.yml](example.yml) 34 | 35 | ### See also 36 | - [IIIF](http://iiif.io/api/presentation/2.0/) -- potential standard to interop with 37 | -------------------------------------------------------------------------------- /mediachain/example.yml: -------------------------------------------------------------------------------- 1 | # hashes to Qm-mediachain-song1 2 | --- 3 | @type: MusicRecording 4 | name: Christmas Will Break Your Heart 5 | byArtist: 6 | @type: MusicGroup 7 | name: LCD Soundsystem 8 | inAlbum: 9 | link: /ipfs/Qm-mediachain-album1 10 | author: 11 | @type: Person 12 | link: /ipfs/Qm-mediachain-artist1 13 | image: 14 | @type: Photograph 15 | contentUrl: 16 | link: /ipfs/Qm-literal-photo-bytes 17 | 18 | # hashes to Qm-mediachain-album1 19 | --- 20 | @type: Album 21 | name: LCD Soundsystem's Triumphant Return 22 | 23 | # hashes to Qm-mediachain-artist1 24 | --- 25 | @type: Person 26 | name: James Murphy 27 | bitcoinAddress: 19d3ynnuNKbgFLxp6XsyoxxGSvoAzBYPMw 28 | -------------------------------------------------------------------------------- /post/README.md: -------------------------------------------------------------------------------- 1 | # POST IPLD Example 2 | 3 | [This is an example to exercise IPLD](../). 4 | 5 | [POST](//github.com/ipfs/POST) is a datastructure for representing communications. Think of it like "messages on IPFS". It aims to multiplex the various kinds of specific message datastructures (like email, IM, articles, blog posts, etc). 6 | 7 | 8 | ## Spec 9 | 10 | ### Object Types 11 | 12 | There is one _defined_ object type, and two _latent_ (defined in other specs) object types. 13 | 14 | 15 | - (defined) a `POST` 16 | - (latent) an `Identity`, representing an individual or group (senders or recipients) 17 | - (latent) a `Reference`, a reference to another document 18 | 19 | 20 | #### Object: `POST` 21 | 22 | A `POST` has several fields: 23 | 24 | ## Examples 25 | 26 | ### Object Examples 27 | 28 | See the [example.yml](example.yml) document. 29 | 30 | ### Link Examples 31 | 32 | Some possilbe ways to traverse this datastructure using IPLD pathing: 33 | 34 | - 1) [transparent, no link properties access](paths-1.md) 35 | - 2) [transparent, no link properties](paths-2.md) 36 | - 3) [transparent, hope for the best](paths-3.md) 37 | - 4) [different delimiters, strict](paths-4.md) 38 | - 5) [different delimiters, permissive](paths-5.md) 39 | - 6) [.object and .link accessors](paths-6.md) 40 | - 7) [use explicit `link/` to resolve through](paths-7.md) 41 | - 8) [different delimiters, strict and explicit `link/`](paths-8.md) 42 | -------------------------------------------------------------------------------- /post/example.yml: -------------------------------------------------------------------------------- 1 | # first message (hashes to Qm-post-msg1) 2 | --- 3 | from: 4 | # it links to an identity object 5 | link: /ipfs/Qm-identity-jbenet # (required) 6 | # name is here to cache it. identity names may change. 7 | # this name should be captured at send-time. 8 | name: "Juan Benet" # (required) 9 | # other stuff to cache is possible, like avatar links. 10 | 11 | # (required) to can be a single entry or an array 12 | to: 13 | - link: /ipfs/Qm-identity-diasdavid 14 | name: "David Dias" 15 | - link: /ipfs/Qm-identity-mildred 16 | name: "Mildred" 17 | 18 | # (required) title or subject 19 | title: "IPLD: last issues" 20 | 21 | # (required) date is unsecure. iso timestamp 22 | date: "2016-01-20 13:01:21.0 Z" 23 | 24 | # (optional) references list. always array. use index nums in body. 25 | refs: 26 | - link: /ipfs/Qm-post-issue1 # (required) a ref link can link to anything 27 | title: "IPLD pathing" # (optional) title cached 28 | - link: /ipfs/Qm-post-issue2 29 | title: "IPLD protobuf serialization" 30 | 31 | # (required) body of the post. 32 | # ref-# SHOULD BE expanded by clients to a proper link. 33 | # similarly, providing a link to a document should add it as a ref and link it. 34 | # in-document hyperlinks may be rendered as text hyperlinks (title linked to doc) 35 | # or as hypercards (title, icon, hyperlink, may be expanded in body). 36 | body: | 37 | Hey Mildred and David, 38 | 39 | The last two remaining issues were: 40 | 41 | - [IPLD Pathing](ref-1) 42 | - [IPLD protobuf serialization](ref-2) 43 | 44 | Which I think we have resolved. 45 | 46 | Juan 47 | 48 | # second message (hashes to Qm-post-msg2) 49 | --- 50 | from: 51 | link: /ipfs/Qm-identity-diasdavid 52 | name: "David Dias" 53 | to: 54 | - link: /ipfs/Qm-identity-jbenet 55 | name: "Juan Benet" 56 | - link: /ipfs/Qm-identity-mildred 57 | name: "Mildred" 58 | title: "Re: IPLD: last issues" 59 | date: "2016-01-20 13:10:31 Z" 60 | ref: 61 | - link: /ipfs/Qm-post-msg1 62 | name: "IPLD: last issues" 63 | rel: "response" # (optional) relationship 64 | 65 | # 'from ref-1' in body could be parsed by clients. The body 66 | # clients may opt to seed the body with the previous body 67 | # quoted, just like email clients do today. this way a body 68 | # could include the full text of the original message. But 69 | # note that this is strictly optional, as hash-linking provides 70 | # a way to link to + view the original communication securely 71 | body: | 72 | > from ref-1 73 | > Which I think we have resolved. 74 | 75 | This is great news! Looking forward to using it. 76 | 77 | David 78 | -------------------------------------------------------------------------------- /post/paths-1.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (1) transparent, no link properties access 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(1) transparent, no link properties access" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 7 | --- 8 | bar1: 9 | link: /ipfs/Qm-unixfs-dir3 10 | mode: 0777 11 | size: 120 12 | bar2: 13 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 14 | mode: 0777 15 | size: 140 16 | 17 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link 18 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: no accessible property named "link" 19 | > 20 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/ 21 | --- 22 | bar1: 23 | link: /ipfs/Qm-unixfs-dir3 24 | mode: 0777 25 | size: 120 26 | bar2: 27 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 28 | mode: 0777 29 | size: 140 30 | > 31 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/mode 32 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: no accessible property named "mode" 33 | > 34 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/size 35 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: no accessible property named "size" 36 | > 37 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/ 38 | --- 39 | body: "hello\n" 40 | 41 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/body 42 | hello 43 | 44 | > 45 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/ 46 | --- 47 | files: 48 | - link: Qm-unixfs-file1 49 | size: 10 50 | - link: Qm-unixfs-file2 51 | size: 10 52 | - link: Qm-unixfs-file1 53 | size: 10 54 | > 55 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/body 56 | > # no body 57 | ``` 58 | -------------------------------------------------------------------------------- /post/paths-2.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (2) transparent, no link properties 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(2) transparent, no link properties" style. 4 | 5 | **WARNING**: would need to change [example.yml](./example.yml) to remove link properties. 6 | 7 | ``` 8 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 9 | --- 10 | bar1: 11 | link: /ipfs/Qm-unixfs-dir3 12 | mode: 0777 13 | size: 120 14 | bar2: 15 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 16 | mode: 0777 17 | size: 140 18 | 19 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link 20 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: no property named "link" 21 | > 22 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/ 23 | --- 24 | bar1: 25 | link: /ipfs/Qm-unixfs-dir3 26 | mode: 0777 27 | size: 120 28 | bar2: 29 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 30 | mode: 0777 31 | size: 140 32 | > 33 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/mode 34 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: no property named "mode" 35 | > 36 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/size 37 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: no property named "size" 38 | > 39 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/ 40 | --- 41 | body: "hello\n" 42 | 43 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/body 44 | hello 45 | 46 | > 47 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/ 48 | --- 49 | files: 50 | - link: Qm-unixfs-file1 51 | size: 10 52 | - link: Qm-unixfs-file2 53 | size: 10 54 | - link: Qm-unixfs-file1 55 | size: 10 56 | > 57 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/body 58 | > # no body 59 | ``` 60 | -------------------------------------------------------------------------------- /post/paths-3.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (3) transparent, hope for the best 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(3) transparent, hope for the best" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 7 | --- 8 | link: /ipfs/Qm-unixfs-dir1 9 | mode: 0777 10 | size: 220 11 | 12 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link 13 | "/ipfs/Qm-unixfs-dir1" 14 | > 15 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/ 16 | --- 17 | bar1: 18 | link: /ipfs/Qm-unixfs-dir3 19 | mode: 0777 20 | size: 120 21 | bar2: 22 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 23 | mode: 0777 24 | size: 140 25 | > 26 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/mode 27 | 0777 28 | > 29 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/size 30 | 120 31 | > 32 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/ 33 | --- 34 | body: "hello\n" 35 | 36 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/body 37 | hello 38 | 39 | > 40 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/ 41 | --- 42 | files: 43 | - link: Qm-unixfs-file1 44 | size: 10 45 | - link: Qm-unixfs-file2 46 | size: 10 47 | - link: Qm-unixfs-file1 48 | size: 10 49 | > 50 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/body 51 | > # no body 52 | ``` 53 | -------------------------------------------------------------------------------- /post/paths-4.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (4) different delimiters, strict 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(4) different delimiters, strict" style. 4 | 5 | Here we use: 6 | - `.` to delimit object-local properties (could be `/`) 7 | - `/` to delimit link-object resolution (could be `//`) 8 | 9 | ``` 10 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 11 | # should this return the link or the object?? 12 | --- 13 | link: /ipfs/Qm-unixfs-dir1 14 | mode: 0777 15 | size: 220 16 | 17 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.link 18 | "/ipfs/Qm-unixfs-dir1" 19 | > 20 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/ 21 | # should this return the link or the object?? 22 | --- 23 | bar1: 24 | link: /ipfs/Qm-unixfs-dir3 25 | mode: 0777 26 | size: 120 27 | bar2: 28 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 29 | mode: 0777 30 | size: 140 31 | > 32 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1.mode 33 | 0777 34 | > 35 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1.size 36 | 120 37 | > 38 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/ 39 | --- 40 | body: "hello\n" 41 | 42 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2.body 43 | hello 44 | 45 | > 46 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/ 47 | --- 48 | files: 49 | - link: Qm-unixfs-file1 50 | size: 10 51 | - link: Qm-unixfs-file2 52 | size: 10 53 | - link: Qm-unixfs-file1 54 | size: 10 55 | > 56 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1.body 57 | > # no body 58 | ``` 59 | -------------------------------------------------------------------------------- /post/paths-5.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (5) different delimiters, permissive 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(5) different delimiters, permissive" style. 4 | 5 | Here we use: 6 | - `.` to delimit object-local properties (could be `/`) 7 | - `/` to delimit link-object resolution (could be `//`) 8 | 9 | ``` 10 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 11 | # should this return the link or the object?? 12 | --- 13 | link: /ipfs/Qm-unixfs-dir1 14 | mode: 0777 15 | size: 220 16 | 17 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.link 18 | "/ipfs/Qm-unixfs-dir1" 19 | > 20 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/ 21 | # should this return the link or the object?? 22 | --- 23 | bar1: 24 | link: /ipfs/Qm-unixfs-dir3 25 | mode: 0777 26 | size: 120 27 | bar2: 28 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 29 | mode: 0777 30 | size: 140 31 | > 32 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1.mode 33 | 0777 34 | > 35 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1.size 36 | 120 37 | > 38 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/ 39 | --- 40 | body: "hello\n" 41 | 42 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/body 43 | hello 44 | 45 | > 46 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/ 47 | --- 48 | files: 49 | - link: Qm-unixfs-file1 50 | size: 10 51 | - link: Qm-unixfs-file2 52 | size: 10 53 | - link: Qm-unixfs-file1 54 | size: 10 55 | > 56 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1/body 57 | > # no body 58 | ``` 59 | -------------------------------------------------------------------------------- /post/paths-6.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (6) .object and .link accessors 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(6) .object and .link accessors" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.link 7 | --- 8 | link: /ipfs/Qm-unixfs-dir1 9 | mode: 0777 10 | size: 220 11 | 12 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.link/link 13 | "/ipfs/Qm-unixfs-dir1" 14 | > 15 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/ 16 | --- 17 | bar1: 18 | link: /ipfs/Qm-unixfs-dir3 19 | mode: 0777 20 | size: 120 21 | bar2: 22 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 23 | mode: 0777 24 | size: 140 25 | > 26 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/bar1.link/mode 27 | 0777 28 | > 29 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/bar1.link/size 30 | 120 31 | > 32 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/bar1.object/baz2.object/ 33 | --- 34 | body: "hello\n" 35 | 36 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/bar1.object/baz2.object/body 37 | hello 38 | 39 | > 40 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/bar1.object/baz1.object/ 41 | --- 42 | files: 43 | - link: Qm-unixfs-file1 44 | size: 10 45 | - link: Qm-unixfs-file2 46 | size: 10 47 | - link: Qm-unixfs-file1 48 | size: 10 49 | > 50 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1.object/bar1.object/baz1.object/body 51 | > # no body 52 | ``` 53 | -------------------------------------------------------------------------------- /post/paths-7.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (7) use explicit `link/` to resolve through 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(7) use explicit `link/` to resolve through" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 7 | --- 8 | link: /ipfs/Qm-unixfs-dir1 9 | mode: 0777 10 | size: 220 11 | 12 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link 13 | "/ipfs/Qm-unixfs-dir1" 14 | > 15 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/ 16 | --- 17 | bar1: 18 | link: /ipfs/Qm-unixfs-dir3 19 | mode: 0777 20 | size: 120 21 | bar2: 22 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 23 | mode: 0777 24 | size: 140 25 | > 26 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/mode 27 | 0777 28 | > 29 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/size 30 | 120 31 | > 32 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz2/link/ 33 | --- 34 | body: "hello\n" 35 | 36 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz2/link/body 37 | hello 38 | 39 | > 40 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz1/link/ 41 | --- 42 | files: 43 | - link: Qm-unixfs-file1 44 | size: 10 45 | - link: Qm-unixfs-file2 46 | size: 10 47 | - link: Qm-unixfs-file1 48 | size: 10 49 | > 50 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz1/link/body 51 | > # no body 52 | ``` 53 | -------------------------------------------------------------------------------- /post/paths-8.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (8) different delimiters, strict and explicit `link/` 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(8) different delimiters, strict and explicit `link/`" style. 4 | 5 | Here we use: 6 | - `/` to delimit object-local properties (could be `.`) 7 | - `//` to delimit link-object resolution (could be `/`) 8 | 9 | ``` 10 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1 11 | --- 12 | link: /ipfs/Qm-unixfs-dir1 13 | mode: 0777 14 | size: 220 15 | 16 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link 17 | "/ipfs/Qm-unixfs-dir1" 18 | > 19 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/ 20 | --- 21 | bar1: 22 | link: /ipfs/Qm-unixfs-dir3 23 | mode: 0777 24 | size: 120 25 | bar2: 26 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 27 | mode: 0777 28 | size: 140 29 | > 30 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/mode 31 | 0777 32 | > 33 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/size 34 | 120 35 | > 36 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz2/link/ 37 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1//bar1//baz2// 38 | --- 39 | body: "hello\n" 40 | 41 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz2/link/body 42 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1//bar1//baz2//body 43 | hello 44 | 45 | > 46 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz1/link/ 47 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1//bar1//baz1// 48 | --- 49 | files: 50 | - link: Qm-unixfs-file1 51 | size: 10 52 | - link: Qm-unixfs-file2 53 | size: 10 54 | - link: Qm-unixfs-file1 55 | size: 10 56 | > 57 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/link/bar1/link/baz1/link/body 58 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1//bar1//baz1//body 59 | > # no body 60 | ``` 61 | -------------------------------------------------------------------------------- /unixfs/README.md: -------------------------------------------------------------------------------- 1 | # unixfs IPLD Example 2 | 3 | [This is an example to exercise IPLD](../). 4 | 5 | [unixfs](//github.com/ipfs/spcs/tree/master/unixfs) is a datastructure for representing unix filesystems. Think of it like "files on IPFS". It aims to support basic unix and posix files, as well as all the extended attributes (xattr, etc). 6 | 7 | ## Spec 8 | 9 | ### Object Types 10 | 11 | There are four _defined_ object types 12 | 13 | 14 | - (defined) a `File` object representing files (binary sequences) 15 | - (defined) a `Dir` object representing directories (name to object mappings) 16 | - (defined) an `Archive` object representing bundled filesystems (tar, car, zip) 17 | - (defined) a `Metadata` object to add mimetypes and other metadata. 18 | 19 | 20 | #### Object: `File` 21 | 22 | `File` objects represent unix/posix files, i.e. binary sequences. Like unix files, our `File` can be chunked into multiple subfiles. These are simply other `File` objects, which means a subfile is a `File` in its own right and can be accessed individually. 23 | 24 | Files track: 25 | - `files` a sequence of subfiles to be combined (for now, just concatenated) 26 | - `importer` the id of the importer used to construct the `File` graph 27 | - `body` is the data inside the file 28 | 29 | 30 | #### Object: `Dir` 31 | 32 | `Dir` objects represent unix/posix directories, i.e. maps of filename strings to files or directories. Like unix directories, our `Dir` can be sharded into multiple objects, to support efficient lookups in large directories. Other shards are simply other `Dir` objects, which means they are `Dirs` in their own right and can be accessed individually. 33 | 34 | The names of `Dir` fields are the filenames of the objects. We aim to provide easy lookups. 35 | 36 | #### Object: `Archive` 37 | 38 | `Archive` objects represent unix/posix filesystem archives, i.e. files which themselves contain a sub-filesystem, for example `tar`, `car`, and `zip` archives. Special handling of these sub-filesystems takes advantage of IPFS features like deduplication, integrity checking, fast random access, etc. 39 | 40 | #### Object: `Metadata` 41 | 42 | `Metadata` objects track attributes for files, directories, and archives that can be applied to all. For example: mime types, permissions, and other properties. This allows a simple attribute change to only create 1 more small object, instead of duplicating the whole file root. 43 | 44 | (TODO: this is at odds with mode in the Dir) 45 | 46 | ## Examples 47 | 48 | ### Object Examples 49 | 50 | See the [example.yml](example.yml) document. 51 | 52 | ### Link Examples 53 | 54 | Some possilbe ways to traverse this datastructure using IPLD pathing: 55 | 56 | - 1) [transparent, no link properties access](paths-1.md) 57 | - 2) [transparent, no link properties](paths-2.md) 58 | - 3) [transparent, hope for the best](paths-3.md) 59 | - 4) [different delimiters, strict](paths-4.md) 60 | - 5) [different delimiters, permissive](paths-5.md) 61 | - 6) [.object and .link accessors](paths-6.md) 62 | - 7) [use explicit `link/` to resolve through](paths-7.md) 63 | - 8) [different delimiters, strict and explicit `link/`](paths-8.md) 64 | 65 | And unixfs-aware file/dir pathing: 66 | 67 | - [unixfs pathing](paths-unixfs.md) 68 | -------------------------------------------------------------------------------- /unixfs/example.yml: -------------------------------------------------------------------------------- 1 | # directory, hashes to Qm-unixfs-dir0 2 | --- 3 | foo1: # each entry here is a directory 4 | link: /ipfs/Qm-unixfs-dir1 5 | mode: 0777 # (optional) unix permissions 6 | size: 220 # (required) object size 7 | foo2: 8 | link: /ipfs/Qm-unixfs-dir2 9 | mode: 0777 10 | size: 140 11 | 12 | # directory, hashes to Qm-unixfs-dir1 13 | --- 14 | bar1: 15 | link: /ipfs/Qm-unixfs-dir3 16 | mode: 0777 17 | size: 120 18 | bar2: 19 | link: /ipfs/Qm-unixfs-dir2 # note, same as foo2 above 20 | mode: 0777 21 | size: 140 22 | 23 | # directory, hashes to Qm-unixfs-dir2 24 | --- 25 | baz1: 26 | link: /ipfs/Qm-unixfs-file0 27 | mode: 0755 28 | size: 30 29 | baz2: 30 | link: /ipfs/Qm-unixfs-file1 31 | mode: 0755 32 | size: 10 33 | baz3: 34 | link: /ipfs/Qm-unixfs-file2 35 | mode: 0755 36 | size: 10 37 | 38 | # file, hashes to Qm-unixfs-file0. illustrating file chunking 39 | # > unixfs cat Qm-unixfs-file0 40 | # hello 41 | # world 42 | # hello 43 | # 44 | --- 45 | files: 46 | - link: Qm-unixfs-file1 47 | size: 10 48 | - link: Qm-unixfs-file2 49 | size: 10 50 | - link: Qm-unixfs-file1 51 | size: 10 52 | 53 | 54 | # file, hashes to Qm-unixfs-file1. 55 | # > unixfs cat Qm-unixfs-file1 56 | # hello 57 | # 58 | --- 59 | body: "hello\n" 60 | 61 | # file, hashes to Qm-unixfs-file2. illustrating file sharding 62 | # > unixfs cat Qm-unixfs-file2 63 | # world 64 | # 65 | --- 66 | body: "world\n" 67 | -------------------------------------------------------------------------------- /unixfs/paths-1.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (1) transparent, no link properties access 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(1) transparent, no link properties access" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-post-msg1/title 7 | "IPLD: last issues" 8 | 9 | > ipld cat /ipfs/Qm-post-msg1/date 10 | "2016-01-20 13:01:21.0 Z" 11 | 12 | > ipld cat /ipfs/Qm-post-msg1/from/name 13 | "Juan Benet" (from Qm-identity-jbenet) 14 | # cannot access "Juan Benet" (from Qm-post-msg1) 15 | 16 | > ipld cat /ipfs/Qm-post-msg1/from/name 17 | "Juan Benet" (from Qm-identity-jbenet) 18 | 19 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 20 | "IPLD pathing" (from Qm-post-issue1) 21 | # cannot access "IPLD pathing" (from Qm-post-msg1) 22 | 23 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 24 | "IPLD pathing" (from Qm-post-issue1) 25 | 26 | > ipld cat /ipfs/Qm-post-msg1/refs/0 27 | --- 28 | the document linked by /ipfs/Qm-post-issue1> 29 | ``` 30 | # cannot access the link at /ipfs/Qm-post-msg1/refs/0 31 | 32 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link 33 | cat: /ipfs/Qm-post-msg1/refs/0/link: no accessible property named "link" 34 | # cannot access "/ipfs/Qm-post-issue1" 35 | 36 | > ipld cat /ipfs/Qm-post-msg1/refs/0/ 37 | --- 38 | the document linked by /ipfs/Qm-post-issue1> 39 | ``` 40 | -------------------------------------------------------------------------------- /unixfs/paths-2.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (2) transparent, no link properties 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(2) transparent, no link properties" style. 4 | 5 | **WARNING**: would need to change [example.yml](./example.yml) to remove link properties. 6 | 7 | ``` 8 | > ipld cat /ipfs/Qm-post-msg1/title 9 | "IPLD: last issues" 10 | 11 | > ipld cat /ipfs/Qm-post-msg1/date 12 | "2016-01-20 13:01:21.0 Z" 13 | 14 | > ipld cat /ipfs/Qm-post-msg1/from/name 15 | "Juan Benet" (from Qm-identity-jbenet) 16 | 17 | > ipld cat /ipfs/Qm-post-msg1/from/name 18 | "Juan Benet" (from Qm-identity-jbenet) 19 | 20 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 21 | "IPLD pathing" (from Qm-post-issue1) 22 | 23 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 24 | "IPLD pathing" (from Qm-post-issue1) 25 | 26 | > ipld cat /ipfs/Qm-post-msg1/refs/0 27 | --- 28 | the document linked by /ipfs/Qm-post-issue1> 29 | ``` 30 | 31 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link 32 | cat: /ipfs/Qm-post-msg1/refs/0/link: no property named "link" 33 | 34 | > ipld cat /ipfs/Qm-post-msg1/refs/0/ 35 | --- 36 | the document linked by /ipfs/Qm-post-issue1> 37 | ``` 38 | -------------------------------------------------------------------------------- /unixfs/paths-3.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (3) transparent, hope for the best 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(3) transparent, hope for the best" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-post-msg1/title 7 | "IPLD: last issues" 8 | 9 | > ipld cat /ipfs/Qm-post-msg1/date 10 | "2016-01-20 13:01:21.0 Z" 11 | 12 | > ipld cat /ipfs/Qm-post-msg1/from/name 13 | "Juan Benet" (from Qm-post-msg1) 14 | 15 | > ipld cat /ipfs/Qm-post-msg1/from/name 16 | "Juan Benet" (from Qm-post-msg1) 17 | # cannot access "Juan Benet" (from Qm-identity-jbenet) 18 | 19 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 20 | "IPLD pathing" (from Qm-post-msg1) 21 | 22 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 23 | "IPLD pathing" (from Qm-post-msg1) 24 | # cannot access "IPLD pathing" (from Qm-post-issue1) 25 | 26 | > ipld cat /ipfs/Qm-post-msg1/refs/0 27 | --- 28 | link: /ipfs/Qm-post-issue1 29 | title: IPLD pathing 30 | 31 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link 32 | "/ipfs/Qm-post-issue1" 33 | 34 | > ipld cat /ipfs/Qm-post-msg1/refs/0/ 35 | --- 36 | the document linked by /ipfs/Qm-post-issue1> 37 | ``` 38 | -------------------------------------------------------------------------------- /unixfs/paths-4.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (4) different delimiters, strict 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(4) different delimiters, strict" style. 4 | 5 | Here we use: 6 | - `.` to delimit object-local properties (could be `/`) 7 | - `/` to delimit link-object resolution (could be `//`) 8 | 9 | ``` 10 | > ipld cat /ipfs/Qm-post-msg1/title 11 | "IPLD: last issues" 12 | 13 | > ipld cat /ipfs/Qm-post-msg1/date 14 | "2016-01-20 13:01:21.0 Z" 15 | 16 | > ipld cat /ipfs/Qm-post-msg1/from.name 17 | "Juan Benet" (from Qm-post-msg1) 18 | 19 | > ipld cat /ipfs/Qm-post-msg1/from/name 20 | "Juan Benet" (from Qm-identity-jbenet) 21 | 22 | > ipld cat /ipfs/Qm-post-msg1/refs.0.title 23 | "IPLD pathing" (from Qm-post-msg1) 24 | 25 | > ipld cat /ipfs/Qm-post-msg1/refs.0/title 26 | "IPLD pathing" (from Qm-post-issue1) 27 | 28 | > ipld cat /ipfs/Qm-post-msg1/refs.0 29 | --- 30 | link: /ipfs/Qm-post-issue1 31 | title: IPLD pathing 32 | 33 | > ipld cat /ipfs/Qm-post-msg1/refs.0.link 34 | "/ipfs/Qm-post-issue1" 35 | 36 | > ipld cat /ipfs/Qm-post-msg1/refs.0/ 37 | --- 38 | the document linked by /ipfs/Qm-post-issue1> 39 | ``` 40 | -------------------------------------------------------------------------------- /unixfs/paths-5.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (5) different delimiters, permissive 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(5) different delimiters, permissive" style. 4 | 5 | Here we use: 6 | - `.` to delimit object-local properties (could be `/`) 7 | - `/` to delimit link-object resolution (could be `//`) 8 | 9 | ``` 10 | > ipld cat /ipfs/Qm-post-msg1/title 11 | "IPLD: last issues" 12 | 13 | > ipld cat /ipfs/Qm-post-msg1/date 14 | "2016-01-20 13:01:21.0 Z" 15 | 16 | > ipld cat /ipfs/Qm-post-msg1/from.name 17 | "Juan Benet" (from Qm-post-msg1) 18 | 19 | > ipld cat /ipfs/Qm-post-msg1/from/name 20 | "Juan Benet" (from Qm-identity-jbenet) 21 | 22 | > ipld cat /ipfs/Qm-post-msg1/refs/0.title 23 | > ipld cat /ipfs/Qm-post-msg1/refs.0.title 24 | "IPLD pathing" (from Qm-post-msg1) 25 | 26 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 27 | > ipld cat /ipfs/Qm-post-msg1/refs.0/title 28 | "IPLD pathing" (from Qm-post-issue1) 29 | 30 | > ipld cat /ipfs/Qm-post-msg1/refs/0 31 | --- 32 | link: /ipfs/Qm-post-issue1 33 | title: IPLD pathing 34 | 35 | > ipld cat /ipfs/Qm-post-msg1/refs/0.link 36 | > ipld cat /ipfs/Qm-post-msg1/refs.0.link 37 | "/ipfs/Qm-post-issue1" 38 | 39 | > ipld cat /ipfs/Qm-post-msg1/refs/0/ 40 | > ipld cat /ipfs/Qm-post-msg1/refs.0/ 41 | --- 42 | the document linked by /ipfs/Qm-post-issue1> 43 | ``` 44 | -------------------------------------------------------------------------------- /unixfs/paths-6.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (6) .object and .link accessors 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(6) .object and .link accessors" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-post-msg1/title 7 | "IPLD: last issues" 8 | 9 | > ipld cat /ipfs/Qm-post-msg1/date 10 | "2016-01-20 13:01:21.0 Z" 11 | 12 | > ipld cat /ipfs/Qm-post-msg1/from.link/name 13 | "Juan Benet" (from Qm-post-msg1) 14 | 15 | > ipld cat /ipfs/Qm-post-msg1/from/name 16 | > ipld cat /ipfs/Qm-post-msg1/from.object/name 17 | "Juan Benet" (from Qm-identity-jbenet) 18 | 19 | > ipld cat /ipfs/Qm-post-msg1/refs/0.link/title 20 | "IPLD pathing" (from Qm-post-msg1) 21 | 22 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 23 | > ipld cat /ipfs/Qm-post-msg1/refs/0.object/title 24 | "IPLD pathing" (from Qm-post-issue1) 25 | 26 | > ipld cat /ipfs/Qm-post-msg1/refs/0 27 | --- 28 | link: /ipfs/Qm-post-issue1 29 | title: IPLD pathing 30 | 31 | > ipld cat /ipfs/Qm-post-msg1/refs/0.link/link 32 | "/ipfs/Qm-post-issue1" 33 | 34 | > ipld cat /ipfs/Qm-post-msg1/refs/0/ 35 | > ipld cat /ipfs/Qm-post-msg1/refs/0.object 36 | --- 37 | the document linked by /ipfs/Qm-post-issue1> 38 | ``` 39 | -------------------------------------------------------------------------------- /unixfs/paths-7.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (7) use explicit `link/` to resolve through 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(7) use explicit `link/` to resolve through" style. 4 | 5 | ``` 6 | > ipld cat /ipfs/Qm-post-msg1/title 7 | "IPLD: last issues" 8 | 9 | > ipld cat /ipfs/Qm-post-msg1/date 10 | "2016-01-20 13:01:21.0 Z" 11 | 12 | > ipld cat /ipfs/Qm-post-msg1/from/name 13 | "Juan Benet" (from Qm-post-msg1) 14 | 15 | > ipld cat /ipfs/Qm-post-msg1/from/link/name 16 | "Juan Benet" (from Qm-identity-jbenet) 17 | 18 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 19 | "IPLD pathing" (from Qm-post-msg1) 20 | 21 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link/title 22 | "IPLD pathing" (from Qm-post-issue1) 23 | 24 | > ipld cat /ipfs/Qm-post-msg1/refs/0 25 | --- 26 | link: /ipfs/Qm-post-issue1 27 | title: IPLD pathing 28 | 29 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link 30 | "/ipfs/Qm-post-issue1" 31 | 32 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link/ 33 | --- 34 | the document linked by /ipfs/Qm-post-issue1> 35 | ``` 36 | -------------------------------------------------------------------------------- /unixfs/paths-8.md: -------------------------------------------------------------------------------- 1 | # IPLD Pathing: (8) different delimiters, strict and explicit `link/` 2 | 3 | These examples are IPLD pathing of the unixfs datastructure, in the "(8) different delimiters, strict and explicit `link/`" style. 4 | 5 | Here we use: 6 | - `/` to delimit object-local properties (could be `.`) 7 | - `//` to delimit link-object resolution (could be `/`) 8 | 9 | ``` 10 | > ipld cat /ipfs/Qm-post-msg1/title 11 | "IPLD: last issues" 12 | 13 | > ipld cat /ipfs/Qm-post-msg1/date 14 | "2016-01-20 13:01:21.0 Z" 15 | 16 | > ipld cat /ipfs/Qm-post-msg1/from/name 17 | "Juan Benet" (from Qm-post-msg1) 18 | 19 | > ipld cat /ipfs/Qm-post-msg1/from/link/name 20 | > ipld cat /ipfs/Qm-post-msg1/from//name 21 | "Juan Benet" (from Qm-identity-jbenet) 22 | 23 | > ipld cat /ipfs/Qm-post-msg1/refs/0/title 24 | "IPLD pathing" (from Qm-post-msg1) 25 | 26 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link/title 27 | > ipld cat /ipfs/Qm-post-msg1/refs/0//title 28 | "IPLD pathing" (from Qm-post-issue1) 29 | 30 | > ipld cat /ipfs/Qm-post-msg1/refs/0 31 | --- 32 | link: /ipfs/Qm-post-issue1 33 | title: IPLD pathing 34 | 35 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link 36 | "/ipfs/Qm-post-issue1" 37 | 38 | > ipld cat /ipfs/Qm-post-msg1/refs/0/link/ 39 | > ipld cat /ipfs/Qm-post-msg1/refs/0// 40 | --- 41 | the document linked by /ipfs/Qm-post-issue1> 42 | ``` 43 | -------------------------------------------------------------------------------- /unixfs/paths-unixfs.md: -------------------------------------------------------------------------------- 1 | # unixfs Pathing 2 | 3 | These examples use a "unixfs-aware" pathing, implemented on top of the raw ipld merkle dag. This makes an additional layer which is aware of what the datastructure represents (eg concatenating the bodies of files, etc). This is already sort-of done in `ipfs cat, ls`. (This remains constant throughout the unixfs examples) 4 | 5 | ``` 6 | > unixfs cat /ipfs/Qm-unixfs-dir1/foo1 7 | cat: /ipfs/Qm-unixfs-dir1/foo1: Is a directory 8 | > 9 | > unixfs ls /ipfs/Qm-unixfs-dir1/foo1 10 | bar1 11 | bar2 12 | > 13 | > unixfs cat /ipfs/Qm-unixfs-dir1/foo1/link 14 | cat: /ipfs/Qm-unixfs-dir1/foo1/link: No such file or directory 15 | > 16 | > unixfs cat /ipfs/Qm-unixfs-dir1/foo1/bar1/mode 17 | cat: /ipfs/Qm-unixfs-dir1/foo1/mode: No such file or directory 18 | > 19 | > unixfs stat /ipfs/Qm-unixfs-dir1/foo1/bar1 20 | name: bar1 21 | mode: 0777 22 | size: 120 23 | > 24 | > unixfs stat --fmt line /ipfs/Qm-unixfs-dir1/foo1/bar1 25 | 077 120 bar1 26 | > 27 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2 28 | hello 29 | 30 | > 31 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/body 32 | cat: /ipfs/Qm-unixfs-dir1/foo1/bar1/baz2/body: Not a directory 33 | > 34 | > ipld cat /ipfs/Qm-unixfs-dir1/foo1/bar1/baz1 35 | hello 36 | world 37 | hello 38 | 39 | ``` 40 | --------------------------------------------------------------------------------