Hello.
I would like to know what is the difference between blockstore
and datastore
.
When I analyzed the code, it seems that datastore
simply has the function of key-value DB (e.g., Put, Delete, Get, Has)
In blockstore
, it looks like it uses CID as a key and calls the datastore
function internally to perform a specific function (e.g., DeleteBlock, GCLock).
In other words, is it right that blockstore
has datastore
functions + GC processing?
Thank you.
When I analyzed the code, it seems that datastore
simply has the function of key-value DB (e.g., Put, Delete, Get, Has)
Yes exactly
In blockstore
, it looks like it uses CID as a key and calls the datastore
function internally to perform a specific function (e.g., DeleteBlock, GCLock).
Exactly
Datastore
is a generic KV store used to store such as MFS metadata, DHTServer data, PeerStore data (note, not the default option), or blockstore
data.
Blockstore
only deals with IPLD blocks, some blockstore
implementations use a blockstore
as storage (such as for badgerds
), other writes files on disk (such as flatfs
).