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

API review #48

Closed
vmx opened this issue Oct 31, 2018 · 5 comments
Closed

API review #48

vmx opened this issue Oct 31, 2018 · 5 comments
Assignees
Labels
api-review Tackle during the API review

Comments

@vmx
Copy link
Member

vmx commented Oct 31, 2018

@mikeal and I want to review the current API and see how they can be made more ergonomic.

The goal is to have a nice to use and easy to implement API which aligns well with the current vision of IPLD. Breaking the API is possible and even very likely.

Currently also the spec and the format implementations are not in sync at the moment (see the open issues for more information).

Parts of it is that it will use async/await, hence aligns well with the Awesome Endeavour: Async Iterators.

We can use this issue for further discussion/referencing things.

/cc @hacdias

@richardschneider
Copy link

Where is the current spec for IPLD?

@vmx
Copy link
Member Author

vmx commented Oct 31, 2018

@richardschneider Most recent one is at ipld/specs#72

@richardschneider
Copy link

Before reviewing the API, I would like to see the IPLD use case(s) or a list of requirements. Are they available somewhere?

@mikeal
Copy link
Contributor

mikeal commented Oct 31, 2018

Can we scope this to interface-ipld-format rather than "IPLD?"

The use cases for IPLD are too numerous, we're effectively talking about building data-structures to support every application vertical. The case for interface-ipld-format is more limited.

The main purpose of the interface is to provide a codec agnostic way to interact with Blocks. The primary consumer is IPFS. It needs to be able to:

  • serialize
  • de-serialize
  • traverse paths
  • list all paths (IPFS needs this, I don't think it has another use case)

Limiting the scope of the interface is that it operates on a single block at a time. For path traversals, it only resolves the path available in a single block, returning enough information for the consumer to continue traversing the path through subsequent blocks.

The interface is defined so that codecs can match the API and be plugged in to anything that consumes IPLD codecs.

Note that, based on ipld/specs#72, this interface is meant to support any IPLD codec, including those that do not support the IPLD Data Model (git, eth, etc).

@vmx vmx added api-review Tackle during the API review ready labels Nov 14, 2018
vmx added a commit that referenced this issue Nov 22, 2018
The whole IPLD APIs get a review to make them more consistent and
easier to use.

The biggest change is that there's not `resolve` API anymore. From
now on you access the properties of the JavaScript objects directly.

Issues that were taken into account:

 - #31
   - [x] Remove `isLink()` method from formats: `isLink()` is no
         longer needed as all links will be CID objects you can easily
         check for
 - #44
   - [x] Proposal: Move resolver to use CID instances for links: Not
         applicable anymore as `resolve.resolve()` is removed
 - #46
   - [x] properties: align spec with implementation: Covered by spec
 - #49
   - [x] Define how `toJSON()` should look like: Binary and CIDs are
         defined with example
 - #34
   - [x] Implementation of nested objects: Won’t fix as `tree()` is
         not part of the API anymore

Closes #48.
@vmx vmx mentioned this issue Nov 22, 2018
5 tasks
@ghost ghost assigned vmx Nov 22, 2018
@ghost ghost added in progress and removed ready labels Nov 22, 2018
@vmx
Copy link
Member Author

vmx commented May 8, 2019

The current review is done. Some of the discussions of a next generation API happen over here https://github.com/ipld/js-ipld-stack.

@vmx vmx closed this as completed May 8, 2019
@ghost ghost removed the in progress label May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-review Tackle during the API review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants