# Residency

> USearch for Swift

Where the payload lives is the constructor's name, as in the C lifecycle verbs, so a residency an index lacks has no constructor to call.
`initRam` and `initVram` start empty, `loadRam`, `loadVram` and their `Buffer` forms copy a checkpoint in, and `viewRam` and `viewNvme` serve one in place.
Each takes only the placement its own hardware has, one shard per named memory domain, device, or path, and an empty list derives the placement from the machine:

```swift
let inRam = try DenseIndex.initRam(options, memoryDomains: [0, 1])          // one graph per socket
let inVram = try DenseIndex.initVram(options, devices: [0, 1])              // sharded, never replicated
let onNvme = try DenseIndex.viewNvme("index.safegraphs.json", config: DenseViewNvmeConfig(paths: ["/mnt/nvme0"]))
```

An NVMe index serves a checkpoint in place, so it is only ever viewed, and until NVMe checkpoints carry keys, `viewNvme` reports `unsupported`.
Placement never comes back out of a checkpoint, which records where it was written, never where a reader must keep it, so `metadataRead` answers a `DenseMetadata` naming dimensions, metric, quantization and connectivity alone.
`valuesPerKey` is absent from it too, bounding a live handle's mutable state rather than the serialized form.

`import USearch`

## Residency

Where an executor computes, and with it where the arenas it makes keep their memory.

```swift
struct Residency
```

Conforms to: `Hashable`, `Sendable`, `CustomStringConvertible`, `Equatable`

## ram

Host memory, walked by host threads.

```swift
static let ram: Residency
```

## vram

Device memory, walked by device streams; no host read reaches it.

```swift
static let vram: Residency
```

## nvme

NVMe drives, read through host submission rings into host memory.

```swift
static let nvme: Residency
```

## description

The residency rendered as the library spells it.

```swift
var description: String { get }
```

## init

Reads a spelling back, and nil for one no residency carries.

```swift
init?(name: String)
```

