لا شيء هنا هو مخبأ: الأحجام هي الأحجام المسجلة لكل مخزن، والسقفات يعاد حسابها من الخطة و الإضافات في اللحظة التي تسأل. يدعو اثنان أي جانب من الكتابة الكبيرة يعطي جوابين مختلفين.
القيمة المُعادة
{
pack: "go", // "free" | "go" | "starter"
nosql: {
usedBytes: 8_720_384,
includedBytes: 1_048_576_000, // ceiling × how many the plan allows
quotaBytes: 1_048_576_000, // included + the add-on pool
perBaseBytes: 524_288_000, // the ceiling of ONE storage
bases: 2,
maxBases: 2,
overQuota: false,
available: true,
storages: [
{ id: "…", label: "App data", usedBytes: 8_716_288, quotaBytes: 524_288_000, overQuota: false },
{ id: "…", label: "Reporting", usedBytes: 4_096, quotaBytes: 524_288_000, overQuota: false }
]
},
sql: { /* same shape */ },
object: { /* same shape */ , hostingBytes: 2_310_144 },
addons: {
databaseGb: 0,
objectGb: 1,
renewsAt: "2026-11-02T10:14:00.000Z",
lapsed: false,
monthlyCredits: 200,
pricePerGb: { database: 100, object: 200 }
}
}{
"pack": "go", # "free" | "go" | "starter"
"nosql": {
"usedBytes": 8_720_384,
"includedBytes": 1_048_576_000, # ceiling × how many the plan allows
"quotaBytes": 1_048_576_000, # included + the add-on pool
"perBaseBytes": 524_288_000, # the ceiling of ONE storage
"bases": 2,
"maxBases": 2,
"overQuota": False,
"available": True,
"storages": [
{"id": "…", "label": "App data", "usedBytes": 8_716_288, "quotaBytes": 524_288_000, "overQuota": False},
{"id": "…", "label": "Reporting", "usedBytes": 4_096, "quotaBytes": 524_288_000, "overQuota": False},
],
},
"sql": {}, # same shape as nosql
"object": {"hostingBytes": 2_310_144}, # same shape as nosql, plus hostingBytes
"addons": {
"databaseGb": 0,
"objectGb": 1,
"renewsAt": "2026-11-02T10:14:00.000Z",
"lapsed": False,
"monthlyCredits": 200,
"pricePerGb": {"database": 100, "object": 200},
},
}مجموع الخدمة، الميدان حسب الميدان
usedBytesintegerكل ما تحمله الخدمة object أنه مُدرج hostingBytes.
includedBytesintegerperBaseBytes × maxBases - ما تقدمه الخطة قبل أي إضافة
quotaBytesintegerincludedBytes بالإضافة إلى المسبح الإضافي المتاح لهذه الخدمة
perBaseBytesintegerسقف مخزن وحيد الرقم الذي تم الحكم عليه بالكتابة
basesintegerكم عدد المخازن الموجودة لهذه الخدمة.
maxBasesintegerعدد ما تسمح به الخطة. bases يعني رفض واحد آخر.
overQuotaboolean« متى المجمل » أي ما يكون المحق : quotaBytes أو أي تخزين واحد يمر بسقفه الخاص
availablebooleanما إذا كان يمكن استخدام الخدمة الآن.
storagesarrayقيد واحد لكل مخزن: id, label, usedBytes, quotaBytes, overQuota.
ما هو العدد الذي يظهر، وما الذي يجب العمل على
يمكن أن يكون شريط التقدم في مجموع الخدمة عند 40% بينما يتم رفض إدخال، لأن تخزين واحد كامل. أظهر الرقم لكل مخزن حيثما كان المستخدم على وشك الكتابة، واحتفظ بالمجموع لموجز.
function roomFor(usage, storage) {
const service = usage[storage.service]; // "nosql" | "sql" | "object"
const base = service.storages.find((s) => s.id === storage.id);
return base ? Math.max(0, base.quotaBytes - base.usedBytes) : null;
}def room_for(usage, storage):
service = usage[storage.service] # "nosql" | "sql" | "object"
base = next((s for s in service["storages"] if s["id"] == storage.id), None)
return max(0, base["quotaBytes"] - base["usedBytes"]) if base else Noneلـ سببان
It is true when the service total passes what the account has, and when a single storage passes its own ceiling — the second being the case a total can never reveal. Reading the per-storage flag tells you which.
جاريتات، على كائن فقط
ما يبقيه مضيفي الحساب على الإنترنت. يتم إخراجه من سقف الجسم قبل حساب الرقم المطابق للخزنة، IaGenify -لحساب الحساب
الـ اض// كتلة
databaseGb · objectGbintegerGigabytes حالياً محتجزة، حسب الإضافة.
renewsAtstring|nullعندما تنتهي الفترة، يقسم المبلغ الذي يُشتري قبل ذلك المبلغ تناسبيا.
lapsedbooleanولم يكن من الممكن دفع مبلغ التجديد: فصندوق النقدية المشترك معلق، والسقف يعود إلى الخطة.
monthlyCreditsintegerما هي تكلفة إضافة إلى كل فترة، كل معا.
pricePerGbobject{ database: 100, object: 200 } - الأرصدة الدائنة لكل غيغابايت عن كل فترة.
وبالإضافة إلى ذلك، يتم تعليق السقف مرة أخرى إلى أسفل، لذلك التخزين الذي كان مريحا يصبح كاملا دون أي شيء مكتوب. يتم إعادة تجربة بركة السباحة، وتعود بمجرد أن تكون الأرصدة هناك.
هناك أمران يستحقان أن يفعلا بها
// 1. Before creating a storage — is one allowed at all?
const usage = await api.cloud.usage();
if (usage.nosql.bases >= usage.nosql.maxBases) {
// api.storage.create() would answer cloud_storage_limit
}
// 2. Before a large write — will it fit?
const bytes = Buffer.byteLength(payload);
const left = usage.object.storages[0].quotaBytes - usage.object.storages[0].usedBytes;
if (bytes > left) {
// Free something, or api.cloud.addons.buy({ service: "object", gb: 1 })
}# 1. Before creating a storage — is one allowed at all?
usage = api.cloud.usage()
if usage["nosql"]["bases"] >= usage["nosql"]["maxBases"]:
pass # api.storage.create() would answer cloud_storage_limit
# 2. Before a large write — will it fit?
size = len(payload)
first = usage["object"]["storages"][0]
if size > first["quotaBytes"] - first["usedBytes"]:
pass # Free something, or api.cloud.addons.buy(service="object", gb=1)