Ideia
Un storage è in ogni parte di vita dei dati, e la lista è deliberament miscelada: un computer, un dispositivo de browser, cloud managed storage, e bases de dabdas o baldes connet con le vostre proprie credenciali. Differiscent in cui i bytes sono — non in come li raggiunge.
| Gentile | Quando i suoi dati sono | Atinse con |
|---|---|---|
| computer | su quella macchina, sotto ~/.iagenify/files | storage.files |
| telefono | in quel browser | un ponte de files che tu providenzi |
| IaGenify Cloud | gestit per te | storage.run() |
| Base de datos o cubo conectado | con il provider, i suoi credenciali | storage.run() |
Como arriva una machina
Non lo registra. Nel primo scambio di tasche il SDK informa id la macchina, l'ambiente e i recursos detectati, e la macchina appare in la lista. Mantiene la stessa identitât poi perché l'identit de stoccaj è memorizat con la sessione.
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 accountPor què un computer mantiene is seus files
Un archivio del computer non tiene octes sul server, e che è implementat in lugar de meramente intenzione: un upload mirat a uno è negat con storage_is_local. Un agent che lavora li lee e scrie a travers la macchina stessa.
// 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)Il stoccaggio predefinit
Ogni conto ha un, e è dove va un salva senza destino. Un computer è un default deficiente per tal motivo — non può ricever un — así que il default normalmente indica a storage cloud gestit.
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