Object Server Vector Searches
The database object server (gxdbobject.h) answers vector searches on a database whose config names its vectors (DataReel 7.4).
Overview
A gxObjectService serves named databases over multiplex channels (gxdbmux.h) on a gxStream server with mutual TLS. In 7.4 a database's config may name its vectors, a .vixset manifest or one .vix file (gxObjectDbConfig::vectors). Two requests read them:
- VECTOR_INFO (gxOBJ_VECTOR_INFO = 8): no body. Reply: u32 version, dimension, element type, metric, number of files, u64 nodes, deleted, then u32 length and the spec.
- VECTOR_SEARCH (gxOBJ_VECTOR_SEARCH = 7): u32 version, k (1 to gxObjVectorMaxK), ef (0: 64, at most gxObjVectorMaxEf), dimension (must be the index's), flags (bit 0: day range, bit 1: strict), tag mask (4 bits), u32 lo[4], hi[4], day_lo, day_hi, then the query as dim float32 values (finite). Reply: u32 version, n, skipped, missing, n results of (u64 id, f32 distance, u32 tags[4], u32 file), then the paths of the files named.
Vector requests never take the database's own lock. On a replicated copy the vectors are searched under the copy's apply lock, so a search never sees a half-applied batch; a search takes its slot (at most vec_max at a time, SetVectorLimits()) before that lock. Every field is length-checked; a bad request is refused with a reason. The example: vector_search_service; the client tool: object_client --vinfo / --vsearch. Linux and Windows (7.4).
gxObjectService
gxObjectService(const std::vector<gxObjectDbConfig> &dbs, const std::string &legacy_db = std::string())The service for the configured databases (name, path, journal, access read or write, vectors).
void SetVectorLimits(unsigned threads, unsigned max_concurrent)Threads per vector search and searches at a time (one more waits up to 5 s, then "busy").
int Request(const std::string &name, bool write, uint8_t op, const std::vector<unsigned char> &body, std::vector<unsigned char> &reply, std::string &err)One request (ADD, CHANGE, DELETE, REQUEST, the vector ops); 0 or -1 with err.
void ServeChannel(gxdMuxSession &mux, uint32_t ch, const std::string &name, const std::string &mode, std::atomic<bool> &stop)Serves one open channel until it closes or stop is set.
void ProtectRoot(const std::string &root, const std::string &apply_journal)Databases and vectors under a replicated copy's root are read only and read under its apply lock.