api.storage

create()

api.storage.create({ service, label }) → Promise<ConnectedStorage>

打开 IaGenify 云层存储。没有主机,没有证书,没有旋转用的东西, 并且它与您连接的电话相同。

POST /api/cloud/storages201no credentials to supply
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

参数

servicestring必填

nosql · sql · object失踪 SDK 扔掷

labelstring

显示名称。 默认情况下, 服务本身的名称 。

三服务

服务是读写时
nosql 点数文献数据库——收集和文件。运行 ({ 动作: " find" { "Infote" } { "gaggate" } )
平方米关系数据库——表格和 SQL.运行({{ 动作: "sql"})
对象对象对象储存——键和字节。run({ action: "objects" | "put" | "remove" })
const base = await api.storage.create({ service: "nosql", label: "App data" });

base.id;
base.label;      // "App data"
base.type;       // "database"
base.service;    // "nosql"
base.provider;   // "iagenify"

await base.run({ action: "insert", collection: "events", documents: JSON.stringify([{ at: Date.now() }]) });
await base.run({ action: "count", collection: "events" });
import json, time

base = api.storage.create(service="nosql", label="App data")

base.id
base.label      # "App data"
base.type       # "database"
base.service    # "nosql"
base.provider   # "iagenify"

base.run(action="insert", collection="events", documents=json.dumps([{"at": int(time.time() * 1000)}]))
base.run(action="count", collection="events")

为什么这不连接你自己

IaGenify 云云已连接
全权证书全权证书全权证书 全权证书 全权证书 全权证书 全权证书 全权证书 全权证书 全权证书 全权证书 全权证书 全权证书 全权证书无以供给和旋转
设置设置设置设置设置设置设置一次呼叫某账户在别处的账户
空间空间空间空间空间空间空间你们的计谋所给于你们的,可以展;以至你们所支付的报酬,
便捷性属于我们的和它永远是你的

不论哪种方式,电话都是相同的,所以这不是你被锁在其中的决定——读一个的代码读另一个的代码。

有多少,有多少

该计划决定每个服务有多少存储器, 每个服务获得多少空间。 在您用 api.cloud.usage(),这比通过拒绝发现限制要好。

const usage = await api.cloud.usage();
// per service: what is used, what the plan includes, what is available

const base = await api.storage.create({ service: "nosql", label: "App data" });
usage = api.cloud.usage()
# per service: what is used, what the plan includes, what is available

base = api.storage.create(service="nosql", label="App data")
超过配额的写作被拒绝, 读不是

quota_exceeded 停止添加; 读取和删除继续工作, 这样你就可以随时把数据拿出来, 腾出空间。 这种不对称是故意的。

错误

代码状态触发条件
invalid_service400三个人中没有一个被 SDK 缺席时。
cloud_storage_limit403计划对这项服务的计算已经计算完毕。
cloud_service_unavailable503现在不能提供这项服务。