codex-storage / nim-codex

Decentralized Durability Engine
Apache License 2.0
62 stars 22 forks source link

Get storage space information via API #768

Open veaceslavdoina opened 5 months ago

veaceslavdoina commented 5 months ago

When we run Codex storage node and would like to sell the storage we need to know the actual disk space available.

We have two numbers here

I wold be useful to get available storage space via API, so we can use that value for automation to setup marketplace and set totalSize

curl --request POST \
  --url http://localhost:8080/api/codex/v1/sales/availability \
  --header 'Content-Type: application/json' \
  --data '{
    "totalSize": "8000000",
    "duration": "7200",
    "minPrice": "10",
    "maxCollateral": "10"
  }'
AuHau commented 5 months ago

Isn't /space endpoint sufficient for this?

Btw. are you trying to basically "sell all storage quota"? Not sure if that is completely smart, because the quota is shared for data downloaded by the node (eq. if you call /download endpoint). So I would suggest selling only portion of the quota. Not sure what is the right number here - maybe 66%? But then if it is only "storer node" then maybe it is fine? Not sure...