We're currently working on extracting the Gateway code from kubo to go-libipfs (ipfs/kubo#8524). After the extraction, we should improve the code, such that it is more useable. There are currently a few points that, in my opinion, make the Gateway handler harder to use than it should:
- It requires more APIs than necessary.
- From
NodeAPI.Block(), we only use Get and Stat, but we are requiring the full interface (Get, Put, Rm, Stat).
- From
NodeAPI.Dag(), we only use Get, but we are requiring the full APIDagService interface, which contains a lot more functions.
- The handler requires both an online and offline APIs. The offline API is only used once with the
Dag().Get function. Perhaps we could add an option to that method Offline: true or LocalOnly: true or NoFetch: true instead. This would allow us to only require the consumers of the Gateway code to provide one Node API.
Things to do:
We're currently working on extracting the Gateway code from
kubotogo-libipfs(ipfs/kubo#8524). After the extraction, we should improve the code, such that it is more useable. There are currently a few points that, in my opinion, make the Gateway handler harder to use than it should:NodeAPI.Block(), we only useGetandStat, but we are requiring the full interface (Get,Put,Rm,Stat).NodeAPI.Dag(), we only useGet, but we are requiring the fullAPIDagServiceinterface, which contains a lot more functions.Dag().Getfunction. Perhaps we could add an option to that methodOffline: trueorLocalOnly: trueorNoFetch: trueinstead. This would allow us to only require the consumers of the Gateway code to provide one Node API.Things to do: