> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# KvDurability

> Class exported by @botmesh/core/spi.

Defined in: [durability/journal.ts:382](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L382)

A [DurabilityBackend](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend.md) over any [DurableKv](https://botmesh.afaya.com.co/api/core/interfaces/DurableKv.md). Store packages build their
backends this way (`new KvDurability(new PostgresDurableKv(pool))`).

## Extended by

* [`MemoryDurability`](https://botmesh.afaya.com.co/api/core/classes/MemoryDurability)
* [`FileDurability`](https://botmesh.afaya.com.co/api/core/classes/FileDurability)

## Implements

* [`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend)

## Constructors

### Constructor

```ts theme={null}
new KvDurability(kv, options?): KvDurability;
```

Defined in: [durability/journal.ts:388](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L388)

#### Parameters

| Parameter | Type |
| - | - |
| `kv` | [`DurableKv`](https://botmesh.afaya.com.co/api/core/interfaces/DurableKv) |
| `options?` | [`KvDurabilityOptions`](https://botmesh.afaya.com.co/api/core/spi/interfaces/KvDurabilityOptions) |

#### Returns

`KvDurability`

## Properties

### inbox

```ts theme={null}
readonly inbox: InboxJournal;
```

Defined in: [durability/journal.ts:383](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L383)

#### Implementation of

[`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend).[`inbox`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend#inbox)

***

### outbox

```ts theme={null}
readonly outbox: OutboxJournal;
```

Defined in: [durability/journal.ts:384](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L384)

#### Implementation of

[`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend).[`outbox`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend#outbox)

***

### exclusive

```ts theme={null}
readonly exclusive: boolean;
```

Defined in: [durability/journal.ts:385](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L385)

`true` when only one process can use the backend at a time (memory, file). A restarted
process then knows every lease of its `instanceId` is its own dead incarnation's.

#### Implementation of

[`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend).[`exclusive`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend#exclusive)

***

### scopeName

```ts theme={null}
readonly scopeName: string | undefined;
```

Defined in: [durability/journal.ts:387](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L387)

The scope of this view (`undefined` = the unscoped tables).

***

### kv

```ts theme={null}
readonly kv: DurableKv;
```

Defined in: [durability/journal.ts:388](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L388)

## Methods

### scope()

```ts theme={null}
scope(name): KvDurability;
```

Defined in: [durability/journal.ts:397](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L397)

A view over the same KV holding only the records of `name` (tables `inbox:<name>` / `outbox:<name>`).

#### Parameters

| Parameter | Type |
| - | - |
| `name` | `string` |

#### Returns

`KvDurability`

#### Implementation of

[`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend).[`scope`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend#scope)

***

### start()

```ts theme={null}
start(): Promise<void>;
```

Defined in: [durability/journal.ts:402](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L402)

Called by `bot.start()` before anything is replayed.

#### Returns

`Promise`\<`void`>

#### Implementation of

[`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend).[`start`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend#start)

***

### stop()

```ts theme={null}
stop(): Promise<void>;
```

Defined in: [durability/journal.ts:403](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L403)

Called by `bot.stop()` after the provider stopped.

#### Returns

`Promise`\<`void`>

#### Implementation of

[`DurabilityBackend`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend).[`stop`](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend#stop)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.