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/.

1 Like

@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 HTTP APIs for IPFS | IPFS Docs and the cluster api also has an ipfs/gc method REST API - Pinset orchestration for IPFS.

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. shell package - github.com/ipfs/go-ipfs-api - Go Packages

Thanks sharing. i really learn a lot from you.

@hector, in general if the pinned file is expired, we cant retrieve the content back am i correct?

Cluster will unpin expired pins. As long as they have not been GC’ed or the content can be provided by someone in the network, the content is available, just unpinned.

1 Like