> ## 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.

# LeaseProvider

> Interface exported by @botmesh/core.

Defined in: [coordination/lease.ts:46](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L46)

A fenced, expiring lease per key. Implementations must make each call atomic:

* `acquire` grants the key when it is free or expired (a new, larger token), or
  extends it when `owner` already holds it (same token); else returns `null`.
* `renew` extends the lease only when `owner` still holds it with `token`.
* `release` frees the key only when `owner` holds it with `token` (else no-op).
  Tokens never go backwards for a key, even across release and expiry.

## Methods

### acquire()

```ts theme={null}
acquire(
   key, 
   owner, 
   ttlMs
): Promise<LeaseGrant | null>;
```

Defined in: [coordination/lease.ts:47](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L47)

#### Parameters

| Parameter | Type |
| - | - |
| `key` | `string` |
| `owner` | `string` |
| `ttlMs` | `number` |

#### Returns

`Promise`\<[`LeaseGrant`](https://botmesh.afaya.com.co/api/core/spi/interfaces/LeaseGrant) | `null`>

***

### renew()

```ts theme={null}
renew(
   key, 
   owner, 
   token, 
   ttlMs
): Promise<boolean>;
```

Defined in: [coordination/lease.ts:48](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L48)

#### Parameters

| Parameter | Type |
| - | - |
| `key` | `string` |
| `owner` | `string` |
| `token` | `number` |
| `ttlMs` | `number` |

#### Returns

`Promise`\<`boolean`>

***

### release()

```ts theme={null}
release(
   key, 
   owner, 
   token
): Promise<void>;
```

Defined in: [coordination/lease.ts:49](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L49)

#### Parameters

| Parameter | Type |
| - | - |
| `key` | `string` |
| `owner` | `string` |
| `token` | `number` |

#### Returns

`Promise`\<`void`>


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