lukechampine / user

A CLI renter for Sia
MIT License
12 stars 2 forks source link

Feature Request: Contract file removal #9

Open grigzy28 opened 5 years ago

grigzy28 commented 5 years ago

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.

lukechampine commented 5 years ago

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

grigzy28 commented 5 years ago

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.

lukechampine commented 5 years ago

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.

vargrant commented 4 years ago

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.