Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Spec refining: Merkle-paths to an array's index #20

Closed
TimDaub opened this issue Aug 16, 2016 · 6 comments
Closed

Spec refining: Merkle-paths to an array's index #20

TimDaub opened this issue Aug 16, 2016 · 6 comments
Labels
status/deferred Conscious decision to pause or backlog

Comments

@TimDaub
Copy link

TimDaub commented Aug 16, 2016

Hi,

it is likely that this already came up in some other repository. If so maybe just link there and I'll elaborate there. My question is:

Say I have the following ipld object:

{
  "someKey": "andValue",
  "listOfKeys": [
    {
      "someKey": "aValueIWouldLikeToRetrieve"
   },
   ...
  ]
}

Let's assume this object can be addressed using this hash: QmAAAA...AAA.
How can I address the x-th index of /QmAAAA...AAA/listOfKeys/?
Or to formulate a general question: How can specific indexes in a list/array in IPLD using merkle-paths be addressed?

@nicola
Copy link
Member

nicola commented Aug 16, 2016

Hey thanks @TimDaub for your question, we are going to write a better spec to include example and cases like this. The agreement has been to follow the json-pointers spec closely, so in this case:

hash/listOfKeys/0/someKey === "aValueIWouldLikeToRetrieve"

Let me know if there are other questions about this

@TimDaub
Copy link
Author

TimDaub commented Aug 16, 2016

Thanks to @sohkai I just found this example in the spec:

> ipld cat --json QmCCC...CCC/doge.jpg
{
  "subfiles": [
    {
      "/": "QmPHPs1P3JaWi53q5qqiNauPhiTqa3S1mbszcVPHKGNWRh"
    },
    {
      "/": "QmPCuqUTNb21VDqtp5b8VsNzKEMtUsZCCVsEUBrjhERRSR"
    },
    {
      "/": "QmS7zrNSHEt5GpcaKrwdbnv1nckBreUxWnLaV4qivjaNr3"
    }
  ]
}

> ipld cat --yml QmCCC...CCC/doge.jpg
---
subfiles:
  - /: QmPHPs1P3JaWi53q5qqiNauPhiTqa3S1mbszcVPHKGNWRh
  - /: QmPCuqUTNb21VDqtp5b8VsNzKEMtUsZCCVsEUBrjhERRSR
  - /: QmS7zrNSHEt5GpcaKrwdbnv1nckBreUxWnLaV4qivjaNr3

> ipld cat --json QmCCC...CCC/doge.jpg/subfiles/1/
{
  "data": "\u0008\u0002\u0012��\u0008����\u0000\u0010JFIF\u0000\u0001\u0001\u0001\u0000H\u0000H..."
}

All good :)

@nicola
Copy link
Member

nicola commented Aug 16, 2016

hey @RichardLitt, can we keep the need spec label? I think they aim at the new spec (which looks less like a tutorial, more like a spec). It's basically a way to keep track of what needs a better spec!

@RichardLitt
Copy link
Contributor

Added back!

@nicola
Copy link
Member

nicola commented Sep 12, 2016

(sorry little change in the way we work in writing the spec, will leave this issue open until we are done with writing it)

@nicola nicola reopened this Sep 12, 2016
@nicola nicola changed the title Merkle-paths to an array's index Spec refining: Merkle-paths to an array's index Sep 12, 2016
@nicola nicola added the spec label Sep 12, 2016
@nicola nicola mentioned this issue Sep 19, 2016
2 tasks
@daviddias daviddias added the status/deferred Conscious decision to pause or backlog label Mar 19, 2018
@rvagg
Copy link
Member

rvagg commented Aug 14, 2019

Closing due to staleness as per team agreement to clean up the issue tracker a bit (ipld/team-mgmt#28). This doesn't mean this issue is off the table entirely, it's just not on the current active stack but may be revisited in the near future. If you feel there is something pertinent here, please speak up, reopen, or open a new issue. [/boilerplate]

@rvagg rvagg closed this as completed Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/deferred Conscious decision to pause or backlog
Projects
None yet
Development

No branches or pull requests

5 participants