# Federation

## Federation

::: aifastdb.Federation

Heterogeneous storage federation — unified interface for graph, document, and vector stores.

```python
from aifastdb import Federation

with Federation() as fed:
    fed.register_graph("social", "./social")
    fed.register_document("docs", "./docs.jsonl")
    result = fed.query("social", {"target": "person", "limit": 10})
    fed.write("docs", {"op": "CreateDocument", "id": "d1", "content": "Hi"})
```

### Transactions

```python
tx = fed.begin_transaction(["social", "docs"])
tx.write("social", {"op": "CreateEntity", "name": "Eve", "entity_type": "person"})
tx.write("docs", {"op": "CreateDocument", "id": "e1", "content": "Eve note"})
tx.commit()   # or tx.rollback()
```

## FederatedTransaction

::: aifastdb.FederatedTransaction
