# Interface: LakebasePoolManager

Manages multiple Lakebase connection pools keyed by an identifier (e.g. userId).

Used for On-Behalf-Of (OBO) scenarios where each user needs their own pool with their own OAuth token refresh, enabling features like Row-Level Security.

## Properties[​](#properties "Direct link to Properties")

### size[​](#size "Direct link to size")

```ts
readonly size: number;

```

Number of active pools.

## Methods[​](#methods "Direct link to Methods")

### closeAll()[​](#closeall "Direct link to closeAll()")

```ts
closeAll(): Promise<void>;

```

Close all managed pools and stop cleanup (for graceful shutdown).

#### Returns[​](#returns "Direct link to Returns")

`Promise`<`void`>

***

### closePool()[​](#closepool "Direct link to closePool()")

```ts
closePool(key: string): Promise<void>;

```

Close and remove a specific pool.

#### Parameters[​](#parameters "Direct link to Parameters")

| Parameter | Type     |
| --------- | -------- |
| `key`     | `string` |

#### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`void`>

***

### getPool()[​](#getpool "Direct link to getPool()")

```ts
getPool(
   key: string, 
   perPoolConfig: Partial<LakebasePoolConfig>, 
   tokenFingerprint?: string): Pool;

```

Get an existing pool or create a new one for the given key. When creating, merges `perPoolConfig` with the base config passed to the factory.

If `tokenFingerprint` is provided and differs from the cached pool's fingerprint, the stale pool is closed and a fresh one is created with the new config (including the updated `workspaceClient`).

#### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter           | Type                                                                                       |
| ------------------- | ------------------------------------------------------------------------------------------ |
| `key`               | `string`                                                                                   |
| `perPoolConfig`     | `Partial`<[`LakebasePoolConfig`](./docs/api/appkit/Interface.LakebasePoolConfig.md)> |
| `tokenFingerprint?` | `string`                                                                                   |

#### Returns[​](#returns-2 "Direct link to Returns")

`Pool`

***

### hasPool()[​](#haspool "Direct link to hasPool()")

```ts
hasPool(key: string): boolean;

```

Check whether a pool exists for the given key.

#### Parameters[​](#parameters-2 "Direct link to Parameters")

| Parameter | Type     |
| --------- | -------- |
| `key`     | `string` |

#### Returns[​](#returns-3 "Direct link to Returns")

`boolean`
