What is GCBlockstore used for? (Garbage collection)

Hello :slight_smile:
I have some questions.
Please forgive me for asking at the code level.

In go-ipfs/gc/gc.go there is a function called AllKeysChan() inside function GC().
keychan, err := bs.AllKeysChan(ctx)

where bs is an object of bstore.GCBlockstore.

Currently, keychan has more CID objects than when ipfs pin list was done.

That is, my point is, what kind of data does GCBlockstore have and why does it have more CID objects than pinned data?

Below is the result of ipfs pin list for a certain file. The number of the object is 4.

bafkreiadunodw7mxna2jj76n66koetdxv7p2zbdyy2h77shvzdq76fu6gu
bafkreiga5uc6gmdjcwatumbfhhq4mr2oesvo3ssin7zcgbybc7wfiwqsua
bafkreia7ik3qqbgbxsgf2klakzq4swyafb7vyx76aro3ewozmshmcoocsa
bafkreidhf5fivj4b4tt475abvcby5gr5xsa2sntnn26ru6c2eavkxpucc4


Below is the result of keychan. The number of the object is 5.

bafkreiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354
bafkreiadunodw7mxna2jj76n66koetdxv7p2zbdyy2h77shvzdq76fu6gu
bafkreiga5uc6gmdjcwatumbfhhq4mr2oesvo3ssin7zcgbybc7wfiwqsua
bafkreia7ik3qqbgbxsgf2klakzq4swyafb7vyx76aro3ewozmshmcoocsa
bafkreidhf5fivj4b4tt475abvcby5gr5xsa2sntnn26ru6c2eavkxpucc4

If you donโ€™t understand a question, feel free to answer! Iโ€™ll be waiting.
Thanks.

Because AllKeysChan includes all blocks and there may be more blocks than pinned blocks. And the difference of those blocks is what is GCโ€™ed.

There might be some special blocks that are not GCed and are not in the pinset (i.e. mfs content).

2 Likes

I belive other non pinned GC exampted data is the DHTserver storage.

1 Like

@hector @Jorropo

Thanks for your reply!! I definitely help with your answers.