Closed josephmturner closed 1 year ago
Could elaborate on what "nonexistent" means in this context? Is it a hyperdrive which has no data but which you are accessing via a valid public key?
Would you hope to have an error if there was zero peers found for the drive maybe?
One reason I avoided erroring was that it's hard to tell whether it exists or not just from the initial GET
. One might end up finding peers a few seconds later or similar.
Would you hope to have an error if there was zero peers found for the drive maybe?
Yes, I think this is what I had in mind.
One reason I avoided erroring was that it's hard to tell whether it exists or not just from the initial
GET
. One might end up finding peers a few seconds later or similar.
Good point. Could we maybe set a timeout after which hyper-gateway gives up with an error?
Instead of throwing an error, we can detect that the drive is empty by seeing the ETag
is 0
.
At the moment we try to do a full lookup for peers before returning: https://github.com/RangerMauve/hyper-sdk/blob/master/index.js#L235
So if you get a HEAD and it's ETag is 0
, it must be a drive with no peers.
It appears that drives with no peers have ETag 1
. Is that expected?
Currently, loading a nonexistent hyperdrive returns an empty array. Instead, I think hypercore-fetch should signal an error indicating that the hyperdrive could not be found.