This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Description
- Users can set the amount of storage their Batnode offers
- Batnode tracks max storage (which is set by the user)
- On Batnode initialization, current storage is set as a property to Batnode object
- When a user tries to store a file on a host candidate, the candidate's available storage is calculated and compared: shard size <= max storage - available storage
- Optimization challenge: checking available storage without reading each file and adding up the data it uses
- Optimization challenge: if two nodes contact a host node at the same time, asking if it has enough storage for their shard, the host node will say yes to both of them because it has stored neither, but by saying yes to both, it agrees to store more data than it has the capacity to store. There needs to be an in-memory data structure of available storage that can be updated immediately when a node agrees to store a shard even if it hasn't already stored that shard.
- An edge case to this, though, is that this data structure may be rendered inaccurate if the shard it agreed to store never made it over the wire!