# Máquinas são armazenamentos

Canonical URL: https://developers.iagenify.com/pt/sdk/concepts/machines-are-storages/
Language: pt

La macchina che esegue il SDK registra se in tuo conto la prima volta che scambia una chiave. Itè che dè un agent in un luogo da lavoro, e è il motivo per cui i suoi files non lasce la macchina.

Status: registered on first call · files stay local

## Ideia {#idea}

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 {#registering}

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.

```javascript
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 account
```

## Por què un computer mantiene is seus files {#local}

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.

```javascript
// 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);
```

## Il stoccaggio predefinit {#default}

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.

```javascript
await api.getStorage();              // the default
await api.storage.remove(id);        // allowed even for the default
                                     // another storage inherits the flag
```

- [api.storage](/pt/sdk/ref/storage): Conecta, lista, crea e elimina.
- [Il ponte di files](/pt/sdk/runtimes/browser): Dare a un agent operazion de files onde non ha disco.

```python
pc = api.storage.get()   # this machine

pc.id
pc.type          # "filesystem"
pc.machine_id
pc.is_default

api.storage.list()       # every storage on the account
```

```python
# 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)
```

```python
api.get_storage()             # the default
api.storage.remove(storage_id)  # allowed even for the default:
                                # another storage inherits the flag
```
