-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Prompted by ipfs/ipfs-webui#1900 – this is BREAKING CHANGE for v1 API, so marking this as something we can discuss if we ever want to create v2.
PinResults.count is used for two things:
(1) Reading pin count per status (used in ipfs pin remote service ls --stat):
GET /pins?limit=1&status=queued
GET /pins?limit=1&status=pinning
GET /pins?limit=1&status=failed
GET /pins?limit=1&status=pinned
(2) pagination (where it acts as an equivalent of more: true:
If the value in
PinResults.countis bigger than the length ofPinResults.results, the client can infer there are more results that can be queried.
Problem
- Calculating
PinResults.countis expensive, especially when running expensive filters likecid,nameorstatus- ipfs-desktop/webui is checking CID status via
GET /pins?cid=Qm1.Qm2...Qm10which
- ipfs-desktop/webui is checking CID status via
Proposed change
- remove
PinResults.count - add
PinResults.more(true/false bool) - add
/service/pins/healthcheckthat allows inexpensive health check - add
/service/pins/statsthat returns total pin counts for each status - switch ecosystem to new fields
This would be a breaking change that requires v2.x.x of this spec and coordinated effort across the stack:
go-ipfs, js-ipfs, ipfs-webui, ipfs-desktop and Pinata.
Is it really breaking? Needs analysis.
I've been thinking a bit about a way to do this in backward compatible way and we could have PinResults.count as an optional field, and always return 1 so the pagination and health checks in old clients still works.
👉 Before we consider doing this, the main question is how old client in go-ipfs will react to an unexpected PinResults.more – if it is ignored and nothing crashes, then we have a better path forward.
If not, we would break our users, and need to coordinate go-ipfs/ipfs-webui/ipfs-desktop and Pinata to make the change around the same time to limit the damage. TBD is this is acceptable, considering the performanc benfits in the long run.