await storage.run({ action: "usage" });storage.run(action="usage")Why ask before writing
A write past the plan's space is refused with quota_exceeded. Reads and deletes keep working — that asymmetry is deliberate, so you can always get data out and make room — but a write that fails halfway through a batch leaves you to work out what landed.
const before = await storage.run({ action: "usage" });
// Write in batches, and stop on the first refusal rather than pushing through
for (const batch of batches) {
try {
await storage.run({ action: "insert", collection, documents: JSON.stringify(batch) });
} catch (err) {
if (err.code === "quota_exceeded") break;
throw err;
}
}import json
from iagenify import IaGenifyError
before = storage.run(action="usage")
# Write in batches, and stop on the first refusal rather than pushing through
for batch in batches:
try:
storage.run(action="insert", collection=collection, documents=json.dumps(batch))
except IaGenifyError as error:
if error.code == "quota_exceeded":
break
raiseThis storage, or the account
| Question | Ask |
|---|---|
| How full is this one? | run({ action: "usage" }) |
| What does the plan give, across services? | api.cloud.usage() |
| Which files are taking the space? | api.files.list(), and sort by size |
The account-level view is the one that tells you whether buying space would help, because that is where the plan's allowance lives.