想法
存储是在数据生命的任何地方,而清单是故意混在一起的:计算机、浏览器、管理下的云存储、数据库或桶,与自己的证书相连。在字节的位置上,它们不同,在如何到达它们方面不同。
| 型 型 | 其数据系何地 | 联系 |
|---|---|---|
| 计算机计算机 | 下,在 ~/.iagenify/files | storage.files |
| 电话电话 | 浏览器中的 | 连接您提供的文档 |
| IaGenify 云云 | 管理为您管理 | storage.run() |
| 连接数据库或桶 | 由您的提供者提供,您的全权证书 | storage.run() |
机器如何到达
您不注册它。 在第一个密钥交换 SDK 机器身份、 环境、 检测到的资源 以及机器出现在列表中。 之后, 保存相同的身份, 因为存储身份与会话缓存 。
const pc = await api.storage.get(); // this machine
pc.id;
pc.type; // "filesystem"
pc.hostname;
pc.isDefault;
await api.storage.list(); // every storage on the accountpc = api.storage.get() # this machine
pc.id
pc.type # "filesystem"
pc.machine_id
pc.is_default
api.storage.list() # every storage on the account为什么电脑保存档案
计算机存储服务器上没有计算机存储的字节,而且这是强制的,而不仅仅是意图:拒绝针对一个的上传 storage_is_local。在那里工作的代理人通过机器本身阅读和写作。
// Refused — a computer is not a destination for an upload
await api.files.create({ name: "notes.md", content }).save({ localOnly: false });
// IaGenifyError: storage_is_local
// This is the way: the file is written on the machine
await pc.files.write("notes.md", content);# Refused — a computer is not a destination for an upload
api.files.create(name="notes.md", content=content).save(local_only=False)
# IaGenifyError: storage_is_local
# This is the way: the file is written on the machine
pc.files.write("notes.md", content)默认存储
每个账户都有一个账户,它就是没有目的地的储蓄去的地方。 计算机违约情况很差,因为这个原因,它无法接收一个账户,所以默认通常指在管理下的云存储处。
await api.getStorage(); // the default
await api.storage.remove(id); // allowed even for the default
// another storage inherits the flagapi.get_storage() # the default
api.storage.remove(storage_id) # allowed even for the default:
# another storage inherits the flag