# `RepoHandle`

A class in `fastatp.server.peer_server` ([source](https://github.com/jacoblapenna/fastatp/blob/main/fastatp/server/peer_server.py#L383)).

```python
RepoHandle(server: PeerServer, host: _HostedRepo)
```

A write + admin handle to one hosted repo.

This is the **only** write path to a non-primary repo. There is
deliberately no `emit(did=...)` string-target write API: a confused or
swapped DID string could otherwise write a record into the wrong repo —
signed under the wrong identity and/or exposed to the wrong subscribers. A
handle cannot be confused with another repo's handle. Private
channels are exactly `server.register(...)` handles.

## Attributes

- `did: str`
- `repo: Repo`
- `seq: int`
- `public: bool`
- `owner_pull: bool | OwnerRule`
- `expires_at: datetime | None`

## Methods

### `put_record`

```python
async put_record(collection: str, rkey: str, record: RecordLike) -> CommitEvent | None
```

### `delete_record`

```python
async delete_record(collection: str, rkey: str) -> CommitEvent | None
```

### `apply_writes`

```python
async apply_writes(writes: list[WriteOp]) -> CommitEvent | None
```

### `emit_account`

```python
async emit_account(*, active: bool = True, status: str | None = None) -> None
```

Re-announce this repo's hosting status (#account).

### `emit_identity`

```python
async emit_identity(*, handle: str | None = None) -> None
```

Prod subscribers to refresh this DID's identity (#identity).

### `emit_sync`

```python
async emit_sync() -> None
```

Announce the head to subscribers after a push landed through
`repo.import_car` (which emits nothing by itself).

### `expire`

```python
async expire() -> None
```

Retire this repo now — the channel-owner's "TTL reached / done with
it" intent. A semantic alias that **delegates** to `unregister`
so the two can never drift; kept as the name a channel reads
naturally.

### `unregister`

```python
async unregister() -> None
```

Stop hosting this repo and cut its live subscribers.
