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

# Client

The `cyborg::Client` class manages storage configurations and acts as a factory for creating or loading encrypted indexes.

## Constructor

```cpp theme={null}
cyborg::Client(const DBConfig& index_location,
               const DBConfig& config_location,
               const DBConfig& items_location,
               const int cpu_threads,
               const bool gpu_accelerate);
```

Initializes a new instance of `Client`.

### Parameters

| Parameter         | Type                            | Description                                                                                          |
| ----------------- | ------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `index_location`  | [`DBConfig`](../types#DBConfig) | Configuration for index storage location.                                                            |
| `config_location` | [`DBConfig`](../types#DBConfig) | Configuration for index metadata storage.                                                            |
| `items_location`  | [`DBConfig`](../types#DBConfig) | Configuration intended to be used in a future release. Pass in a DBConfig with a Location of 'None'. |
| `cpu_threads`     | `int`                           | Number of CPU threads to use (e.g., `0` to use all available cores).                                 |
| `gpu_accelerate`  | `bool`                          | Whether to enable GPU acceleration (requires CUDA).                                                  |

### Exceptions

<AccordionGroup>
  <Accordion title="std::invalid_argument">
    * Throws if the `cpu_threads` parameter is less than `0`.
    * Throws if any [`DBConfig`](../types#DBConfig) is invalid.
    * Throws if the GPU is not available when `gpu_accelerate` is `true`.
  </Accordion>

  <Accordion title="std::runtime_exception">
    * Throws if the backing store is not available.
    * Throws if the Client could not be initialized.
  </Accordion>
</AccordionGroup>

### Example Usage

```cpp theme={null}
#include "cyborgdb_core/client.hpp"

cyborg::DBConfig index_location(Location::kMemory);
cyborg::DBConfig config_location(Location::kRedis, "index_metadata", "redis://localhost");
cyborg::DBConfig items_location(Location::kNone); // No item storage
int cpu_threads = 4;
bool use_gpu = true;

cyborg::Client client(index_loc, config_loc, items_loc, cpu_threads, use_gpu);
```
