Client is the main class exposed by CyborgDB. It exposes the functionality necessary to create, load, list and delete indexes. Operations within encrypted indexes (such as upsert and query) are contained within the EncryptedIndex class returned by create_index and load_index.

Constructor

Client(index_location: DBConfig,
       config_location: DBConfig,
       items_location: DBConfig,
       cpu_threads: int = 0,
       gpu_accelerate: bool = False)

Initializes a new CyborgDB Client instance.

Parameters

ParameterTypeDefaultDescription
index_locationDBConfig-Configuration for index storage location. Use a dictionary with keys location, table_name, and connection_string.
config_locationDBConfig-Configuration for index metadata storage. Uses the same dictionary structure as index_location.
items_locationDBConfigNONE(Optional) Configuration for encrypted item storage. Uses the same dictionary structure as index_location.
cpu_threadsint0(Optional) Number of CPU threads to use for computations (defaults to 0 = all cores).
gpu_accelerateboolFalse(Optional) Indicates whether to use GPU acceleration (defaults to False).

Exceptions

Example Usage

import cyborgdb_core as cyborgdb

index_location = cyborgdb.DBConfig(location='redis', connection_string="redis://localhost")
config_location = cyborgdb.DBConfig(location='redis', connection_string="redis://localhost")
items_location = cyborgdb.DBConfig(location='postgres', table_name="items", connection_string="host=localhost dbname=postgres")

# Construct the Client object
client = cyborgdb.Client(index_location=index_location,
                    config_location=config_location,
                    items_location=items_location,
                    cpu_threads=4,
                    gpu_accelerate=True)

# Proceed with further operations