DataReel 7.x Vector Database for 6.x Programs (dr7features)
Overview
Building
gxv7VectorIndex
gxv7VectorSet
gxv7ObjectClient
gxv7ObjRepl
Types
Overview
New in DataReel 6.4. DataReel 6.4 has no vector database code of its own: the classes in dr7features.h call the DataReel 7.x vector index (gxVectorIndex, .vix files: exact and HNSW search, float32/float16/int8 vectors, L2, cosine and inner product metrics, four tags per vector), the vector set (gxVectorSet, .vixset manifests that search many .vix files as one) and the database object server client (op 7 VECTOR_SEARCH, op 8 VECTOR_INFO), built from a DataReel 7.4 or later source tree. They take and return DataReel 6.x types. The .vix and .vixset files are the 7.x files: 7.x programs open what 6.x programs write and the other way round. Programs that do not use these classes are not affected: the 6.x library is the 6.3.1 library. As with every DataReel database file, files made by a Linux build and by a Windows build are laid out differently (the file and block headers hold C unsigned long values, 8 bytes on 64-bit Linux and 4 on Windows): use them on the system that made them.
Return values: gxv7_NO_ERROR (0) if no errors occur, otherwise an error code (gxv7VectorIndex::ErrorMessage() gives its text); gxv7ObjectClient and gxv7ObjRepl return 0 or -1 (Error() says why).
Building
CMake only: cmake -S datareel-6.4 -B build -DDATAREEL7_FEATURES_DIR=/path/to/datareel-7.4. The build makes the 6.x library, the 7.x library (its names are in the datareel namespace, so both link into one program), the plain interface dr7inner (dr7features/inner, 7.x headers only) and the dr7features library; link with the CMake target DataReel::dr7features. A C++17 compiler is needed, the same for both libraries. With DATAREEL7_TOOLS (default ON) the 7.x gxrepl, object_server, object_client (POSIX) and vix_rebuild are built into build/dr7inner/tools. Do not include DataReel 7.x headers in a 6.x source file: the two versions share header names and include guards.
Examples: examples_database/vector_index (records in a 6.x database, their vectors in a .vix keyed by the record address; it also reads the DataReel 7.4 phase C files) and examples_socket/vector_client (searching a 7.x object server). Object replication with the 7.x gxObjRepl (gxv7ObjRepl, 11/17/2026): examples_database/replication_6x and Replicating 6.x programs' records. Object replication needs DataReel 7.4 or later; the build stops with a message for an older tree.
gxv7VectorIndex
int Create(const char *fname, unsigned dim, gxv7ElementType type = gxv7FLOAT32, gxv7Metric metric = gxv7L2, unsigned M = 16, const char *spec = 0, unsigned ef_construction = 200)Make a new index file of vectors with dim elements (at most 4096). M is the HNSW graph width. spec is an optional text (up to 63 characters) naming what the vectors are; Open() can require it.
int Open(const char *fname, int read_only = 0, const char *spec = 0) / int Close() / int Flush() / int IsOpen() constOpen an index (spec, when given, must equal the file's: gxv7_SPEC_MISMATCH), close it, write its changes.
int Insert(long long id, const float *vec, const unsigned *tags = 0) / int Insert(long long id, const MemoryBuffer &vec, const unsigned *tags = 0)Add a vector of Dim() floats (a MemoryBuffer of Dim() * sizeof(float) bytes) with up to four tags. id is any number unique in the index, for example a 6.x block address. A duplicate id gives gxv7_DUPLICATE_ID, a NaN or infinity gxv7_NOT_FINITE, a read only index gxv7_READ_ONLY.
int Update(long long id, const float *vec, const unsigned *tags = 0) / int Delete(long long id) / int Contains(long long id) const / int Get(long long id, float *vec, unsigned *tags = 0) constChange, delete (the vector is no longer found) and read back a vector and its tags.
int Search(const float *query, unsigned k, gxv7Result *results, unsigned &count, unsigned ef = 64, const gxv7Filter *filter = 0) constThe k nearest vectors, closest first, approximate (HNSW; ef is the search width; exact for small indexes and narrow filters). results must hold k entries; count is set to the number found.
int Exact(const float *query, unsigned k, gxv7Result *results, unsigned &count, const gxv7Filter *filter = 0) constThe k nearest vectors, exact.
int Repair() / unsigned long Verify(gxString &report)Rebuild the graph from the live vectors; check the file against the copy in memory (the number of problems, one report line each).
unsigned Dim() const / gxv7ElementType ElementType() const / gxv7Metric Metric() const / unsigned long long Count() const / unsigned long long Deleted() constThe index's dimension, element type, metric, live and deleted vectors.
static const char *ErrorMessage(int err) / static const char *LibraryVersion()The text of an error code; the DataReel 7.x library the features were built with ("7.4").
gxv7VectorSet
int Create(const char *path, const char *name, unsigned dim, gxv7ElementType type = gxv7FLOAT32, gxv7Metric metric = gxv7L2, const char *spec = 0)Make a manifest (.vixset). Its .vix files have the same dimension, element type, metric and spec, and are listed by their path relative to the manifest.
int Open(const char *path, const char *spec = 0, unsigned max_open = 16) / void Close() / int AddFile(const char *rel_path) / int RemoveFile(const char *rel_path) / int Refresh()Open a set (at most max_open files open at once), change its list of files, read the manifest again.
int Search(const float *query, unsigned k, gxv7Result *results, unsigned &count, unsigned ef = 64, const gxv7Filter *filter = 0, int day_range = 0, unsigned day_lo = 0, unsigned day_hi = 0, unsigned threads = 1) constSearch every file. day_range = 1 searches only vectors whose tag 2 is between day_lo and day_hi; files outside the range are skipped. results[i].file names the file (FilePath()).
unsigned FileCount() const / gxString FilePath(unsigned file) const / unsigned Dim() const / gxString Error() constThe files of the set, the dimension, the last error.
gxv7ObjectClient
A client of the DataReel 7.x database object server for vector searches: the server's config gives a database vectors = <.vixset or .vix> (for example the 6.4 vector_server tool in <build>/dr7inner/tools). Mutual TLS: the client sends its certificate and checks the server's against the CA and the server name. Searches are read only. POSIX only: DataReel 7.4 builds its multiplex session (the object client) on POSIX systems only, so on Windows Connect() returns -1 and Error() says so.
int Connect(const char *host, int port, const char *server_name, const char *cert, const char *key, const char *ca, const char *db_name, int timeout_secs = 10) / void Close() / int IsConnected() constConnect and open a channel to database db_name (read mode).
int VectorInfo(gxv7VectorInfo &info)Op 8 VECTOR_INFO: the version, dimension, element type, metric, number of files, live and deleted vectors and the spec of the database's vectors.
int VectorSearch(const float *query, unsigned dim, unsigned k, gxv7Result *results, unsigned &count, unsigned ef = 64, const gxv7Filter *filter = 0, int day_range = 0, unsigned day_lo = 0, unsigned day_hi = 0, unsigned *skipped = 0, unsigned *missing = 0)Op 7 VECTOR_SEARCH: the k nearest vectors (k at most 1000), closest first. skipped and missing count the server's files skipped by their day range and listed but missing. The server refuses a query of another dimension or one that is not finite; the channel goes on answering.
gxString FileName(unsigned file) const / gxString Error() constThe path (relative to the server's manifest) of results[i].file; why the last call failed.
gxv7ObjRepl
11/17/2026: object replication with the DataReel 7.x gxObjRepl between two independent object databases (node folders). Only objects travel, as gxStream blocks over TLS with certificates on both sides, never file pages; each node keeps its own file addresses, free space and indexes. A 6.x program and a DataReel 7.4 program (or the 7.4 objrepl tool) replicate to each other, on Linux and Windows. Replication is asynchronous: Commit() is durable on the primary, and the copy has it once Pump() returns 0. Needs DataReel 7.4 or later.
int SetConfig(const char *key, const char *value) / int LoadConfig(const char *fname) / void ClearConfig()The configuration the next Open() uses, the objrepl.conf keys of the 7.4 objrepl tool: name, peer-name, copy (primary: HOST:PORT), listen (copy: [ADDR:]PORT), ca, cert, key, allow-cn (copy: the primary's certificate CN), links, index, max-lag, max-behind, min-cert-days, idle-timeout, trim. LoadConfig() reads one "key value" line each.
int Open(const char *root, Role role) / void Close() / int IsOpen() const / gxString Error() constOpen the node folder root as gxv7ObjRepl::PRIMARY or gxv7ObjRepl::COPY (made when missing); close it; why the last call failed.
int OpenDatabase(const char *db) / int Begin() / unsigned long long NewId() / int Put(const char *db, unsigned long long id, const void *bytes, unsigned n) / int Remove(const char *db, unsigned long long id) / int Purge(const char *db, unsigned long long id) / int Commit() / int Rollback()Primary: open a database before Begin(); a new 64-bit id (0 on an error); add or replace an object; remove one (a tombstone keeps its id and address); purge a tombstone; commit everything since Begin() (durable with its outbox entry) or roll it back. A copy refuses Begin() and Put().
int Pump() / int Drain(int seconds) / int Serve() / void Stop()Primary: send what the copy does not have (0 when the copy has every commit); pump until it does or seconds pass. Copy: serve the primary until Stop() (any thread, or a signal handler).
int Get(const char *db, unsigned long long id, MemoryBuffer &bytes) / int IsLive(const char *db, unsigned long long id) / int Ids(const char *db, unsigned long long *&ids, unsigned long &count, int tombstones = 0) / gxString Databases() / int InSnapshot()Reads, on either node: an object's bytes; whether an id is live; the live (or removed) ids, in a new array to delete[]; the databases, one name a line; whether a copy is in the middle of a full send (reads then fail).
int FindKey(const char *index, const void *key, unsigned n, unsigned long long *ids, unsigned max, unsigned &count) / int Nearest(const char *index, const float *query, unsigned k, unsigned long long *ids, float *distances, unsigned &count)Lookups in the node's own indexes (the index setting: B-tree keys of up to 32 bytes at an offset, vector indexes on floats at an offset, kept in the same transaction as the objects): the ids with an equal key (at most max copied; count is the number found); the k nearest objects, closest first.
unsigned long long Epoch() const / LastSeq() const / AppliedSeq() const / CopyApplied() constThe node's epoch; the primary's last commit; the copy's last applied commit; the copy, as the primary last heard.
static int Digest(const char *root, gxString &line, const char *links = "") / static int Status(const char *root, gxString &line) / static int Check(const char *root, gxString &line, const gxv7ObjRepl *cfg = 0)On a folder without an open node: every database's ids and content hashes (the same line as "objrepl digest"); the status line; OK / WARN / FAIL (0 / 1 / 2) against cfg's max-lag, max-behind and min-cert-days.
static int Takeover(const char *root, gxString &msg) / static int Rejoin(const char *root, gxString &msg) / static int ClearAlarm(const char *root, gxString &msg) / static int Engine64()A copy becomes the primary at the next epoch (the old primary is fenced off); a former primary becomes a copy (it gets the new primary's databases); clear the copy's alarm; 1 if the 7.x library uses the 64-bit database engine.
Types
enum gxv7ElementType { gxv7FLOAT32 = 1, gxv7FLOAT16 = 2, gxv7INT8 = 3 } / enum gxv7Metric { gxv7L2 = 1, gxv7COSINE = 2, gxv7IP = 3 }The same values as the 7.x gxvElementType and gxvMetric.
enum gxv7Errorgxv7_NO_ERROR, gxv7_NOT_OPEN, gxv7_DB_ERROR, gxv7_BAD_FILE, gxv7_BAD_VERSION, gxv7_BAD_ARG, gxv7_UNSUPPORTED, gxv7_SPEC_MISMATCH, gxv7_DUPLICATE_ID, gxv7_ID_NOT_FOUND, gxv7_NOT_FINITE, gxv7_READ_ONLY, gxv7_OUT_OF_RANGE, gxv7_INDEX_FULL (the 7.x gxvError values), gxv7_NO_MEMORY (100), gxv7_BAD_HANDLE (101).
struct gxv7Result { long long id; float distance; unsigned tags[4]; unsigned file; }One result; file is the vector set file (gxv7VectorSet::FilePath(), gxv7ObjectClient::FileName()).
struct gxv7Filter { void Tag(unsigned i, unsigned value); void Range(unsigned i, unsigned lo, unsigned hi); void Clear(); }Only vectors whose tags are in the given ranges.
struct gxv7VectorInfo { unsigned version, dim; gxv7ElementType type; gxv7Metric metric; unsigned files; unsigned long long nodes, deleted; gxString spec; }What VectorInfo() returns.
See the DataReel 6.4 release notes.