How can i set a Pin expiration?

Hi all, i would like to set a Pin expiration. how could i code this? and how to i test the expiration?

Appreciate if there is any solution given.

Thanks.

https://cluster.ipfs.io has support for pin expiration. See --expire-in in ipfs-cluster-ctl pin add help.

You can play around following https://cluster.ipfs.io/documentation/quickstart/.

@hector
after pin expire-in is over. i will saw the following status. if i do a ipfs cat , i still can download the content. how i can restrict from download after the expiry?

> xxx : UNPINNED | 2020-12-09T07:24:12.956162387Z
> xxx : UNPINNED | 2020-12-09T07:24:12.956162387Z

@hector
is it i need to perform garbage collections? with this ipfs repo gc command? i noticed it only clear the cache, the file still can retrieve by ipfs cat? if there anyway to permanent remove file when unpinned or expiry?

Thanks in advanced.

It has to do with garbage collection and with not having any other copy anywhere in the network of that file, otherwise it will be transparently retrieved. There are many threads where the “how to permanently delete data” question has been answered.

@hector

Thanks for the quick reply. is there any go-ipfs-api shell can perform garbage collection because i’m working with go lang? By the way, after pin expire-in is over, it wont automatically remove until we perform garbage collection? please correct if i’m wrong.

correct. Pin expiration only unpins.

You have https://docs.ipfs.io/reference/http/api/#api-v0-repo-gc and the cluster api also has an ipfs/gc method https://cluster.ipfs.io/documentation/reference/api/.

is that mean i shall have a cron job to execute ipfs repo gc everyday in order to remove all unpins files? btw, is there any go repo gc library because i’m trigger all ipfs function using shell “github.com/ipfs/go-ipfs-api

image

Probably.

is there any go repo gc library because i’m trigger all ipfs function using shell “

While that library does not have an specific method to call RepoGC(), you can use Request() to call any API path manually. https://godoc.org/github.com/ipfs/go-ipfs-api#Shell.Request

Thanks sharing. i really learn a lot from you.