UNPKG

@langchain/community

Version:
1 lines • 3.9 kB
{"version":3,"file":"cassandra.d.ts","names":["BaseStore","CassandraClientArgs","CassandraKVOptions","CassandraKVStore","Uint8Array","Promise","AsyncGenerator"],"sources":["../../src/storage/cassandra.d.ts"],"sourcesContent":["import { BaseStore } from \"@langchain/core/stores\";\nimport { CassandraClientArgs } from \"../utils/cassandra.js\";\n/**\n * Configuration options for initializing a CassandraKVStore.\n * These options extend generic Cassandra client arguments with specific settings\n * for key-value store operations.\n *\n * @interface CassandraKVOptions\n * @extends CassandraClientArgs Custom arguments for the Cassandra client, such as connection settings.\n *\n * @property {string} keyspace The name of the Cassandra keyspace to be used by the key-value store.\n * The keyspace must exist.\n *\n * @property {string} table The name of the table within the specified keyspace dedicated to storing\n * key-value pairs. The table will be created if it does not exist.\n *\n * @property {string} [keyDelimiter=\"/\"] An optional delimiter used to structure complex keys. Defaults to '/'.\n * This delimiter is used for parsing complex keys (e.g., hierarchical keys) when performing\n * operations that involve key prefixes or segmentation.\n */\nexport interface CassandraKVOptions extends CassandraClientArgs {\n keyspace: string;\n table: string;\n keyDelimiter?: string;\n}\n/**\n * A concrete implementation of BaseStore for interacting with a Cassandra database.\n * It provides methods to get, set, delete, and yield keys based on specified criteria.\n */\nexport declare class CassandraKVStore extends BaseStore<string, Uint8Array> {\n lc_namespace: string[];\n private cassandraTable;\n private options;\n private colKey;\n private colKeyMap;\n private colVal;\n private keyDelimiter;\n protected inClauseSize: number;\n protected yieldKeysFetchSize: number;\n constructor(options: CassandraKVOptions);\n /**\n * Retrieves the values associated with an array of keys from the Cassandra database.\n * It chunks requests for large numbers of keys to manage performance and Cassandra limitations.\n * @param keys An array of keys for which to retrieve values.\n * @returns A promise that resolves with an array of Uint8Array or undefined, corresponding to each key.\n */\n mget(keys: string[]): Promise<(Uint8Array | undefined)[]>;\n /**\n * Sets multiple key-value pairs in the Cassandra database.\n * Each key-value pair is processed to ensure compatibility with Cassandra's storage requirements.\n * @param keyValuePairs An array of key-value pairs to set in the database.\n * @returns A promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, Uint8Array][]): Promise<void>;\n /**\n * Deletes multiple keys and their associated values from the Cassandra database.\n * @param keys An array of keys to delete from the database.\n * @returns A promise that resolves when all specified keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Yields keys from the Cassandra database optionally based on a prefix, based\n * on the store's keyDelimiter. This method pages through results efficiently\n * for large datasets.\n * @param prefix An optional prefix to filter the keys to be yielded.\n * @returns An async generator that yields keys from the database.\n */\n yieldKeys(prefix?: string): AsyncGenerator<string>;\n private ensureTable;\n private processInChunks;\n}\n//# sourceMappingURL=cassandra.d.ts.map"],"mappings":";;;;;;;AAoBA;AASA;;;;;;;;;;AAAuD;;;;;UATtCE,kBAAAA,SAA2BD;;;;;;;;;cASvBE,gBAAAA,SAAyBH,kBAAkBI;;;;;;;;;;uBAUvCF;;;;;;;wBAOCG,SAASD;;;;;;;+BAOFA,gBAAgBC;;;;;;2BAMpBA;;;;;;;;8BAQGC"}