The idea
A storage is anywhere your data lives, and the list is deliberately mixed: a computer, a browser device, managed cloud storage, and databases or buckets you connect with your own credentials. They differ in where the bytes are — not in how you reach them.
| Kind | Where its data is | Reached with |
|---|---|---|
| computer | on that machine, under ~/.iagenify/files | storage.files |
| phone | in that browser | a files bridge you supply |
| IaGenify Cloud | managed for you | storage.run() |
| connected database or bucket | with your provider, your credentials | storage.run() |
How a machine arrives
You do not register it. On the first key exchange the SDK reports the machine id, the environment and the detected resources, and the machine appears in the list. It keeps the same identity afterwards because the storage id is cached with the session.
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 accountWhy a computer keeps its files
A computer storage holds no bytes on the server, and that is enforced rather than merely intended: an upload aimed at one is refused with storage_is_local. An agent working there reads and writes through the machine itself.
// 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)The default storage
Every account has one, and it is where a save with no destination goes. A computer is a poor default for that reason — it cannot receive one — so the default normally points at managed cloud storage.
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