lukechampine/user

Feature Request: Contract file removal

grigzy28 opened this issue · 4 comments

Removal of the expired contracts files/links from the ~/.config/user/contracts-available(and enabled) directories that the user program determines has expired either when uploading or downloading.

Sounds good to me. We could rename like we do now with a _old suffix.

I have an idea of how this could be implemented. Using the contracts menu, along with the list/enabled/disabled commands, include an expired command so that it goes thru each non _old contract in the contracts-available folder and checks if it is still active by querying the siad for current block height and then renames/disables (if still linked in the enabled folder) thus removing it from the user contracts list. This would be an on-demand type of action requiring user control, possibly a precursor to an automated process of when doing it when uploading/downloading and you hadn't renewed the contract.

user contracts prune sounds good to me. Or maybe tidy, like go mod tidy.

This should be pretty easy to implement, and the code could be reused later if we want to do it automatically.

I think that contract can be deleted in the case if 2 conditions is done:

  1. We have contracts more then we need. Some hosts was offile and we created new contracts. Offcose we need t have some user settings like how much data we want to store per month and how much data we need to upload/download
  2. Contract don't have a stored data at all or this contract have data which was already updated on other hosts and have minimal redunancy for this data was reached.