Where are the JSON-like IPLD data store?

Command ipfs object get brings me some JSON-like data of the object i request

$ ipfs object get QmQgQUbBeMTnH1j3QWwNw9LkXjpWDJrjyGYfZpnPp8x5Lu
{
    "Links": [
        {
            "Name": "",
            "Hash": "QmYN9f4cRGPReJDSi3YoFTt5eTVS2Jo9ePN3wH3TfgbB8u",
            "Size": 262158
        },
        {
            "Name": "",
            "Hash": "QmTJ1rwQQ7FC4HiwmxS1jFe2eJeb6kyxgRWKGyHjf7nYMN",
            "Size": 262158
        },
        {
            "Name": "",
            "Hash": "QmSEuztdUaJNLGhf3Hrpd9f8eHXftusY8QCbqUbzGv7LNX",
            "Size": 210174
        }
    ],
    "Data": "\u0008\u0002\u0018��, ��\u0010 ��\u0010 ��\u000c"
}

I know these are the IPLD data which record links between blocks, but where are they store?

Are they in blocks (.ipfs/blocks folder) or in the .ipfs/datastore folder? (Assuming they are local, not come from other ipfs node)

I want to dive into the code of these two things:

1. How these IPLD data generate and store in local
2. How to search in a huge amount of IPLD data to find the cid I request

Can someone tell me the repo link about the implementation? Thanks a lot

Hello,

I am going to put repo names in brackets, they are all under github.com/ipfs.

In short words, ipfs uses [go-unixfs] to create a IPFS-unixfs object which is serialized into a protobuf which is then wrapped in PB-DAG IPLD nodes in [go-merkledag] (and also serialized to protobuf). This is then passed to a DAG service ([go-ipld-format]), which passes it to a blockservice ([go-blockservice]), which passes it to a Exchange ([go-ipfs-exchange-interface]) which, on a write, will announce the block on the DHT (and create a provider record that ends up in the datastore [go-datastore]), and also pass the block itself to the [go-blockstore]. This finally passes the block to the configured [go-datastore], which might be [go-ds-flatfs] or [go-ds-badger], which writes it to disk.

When using flatfs, your object would be in .ipfs/blocks.

1 Like