# HG changeset patch # User mas01cr # Date 1230116250 0 # Node ID 823bca1e10f509f976447af0730a68d533bb3485 # Parent 0ef02923221301f19bd17f9faa641345a72989e1 Sketch out a "query state" structure. As yet it's completely unused, but the intention is that accumulated state will be collected into one of these structures for each query, and then passed around, to help reduce the need for silly arglists. It's possible that this structure will also grow a pointer to the adb itself, and be the thing passed to the LSH callback; we'll see how that develops. diff -r 0ef029232213 -r 823bca1e10f5 audioDB-internals.h --- a/audioDB-internals.h Wed Dec 24 10:57:27 2008 +0000 +++ b/audioDB-internals.h Wed Dec 24 10:57:30 2008 +0000 @@ -1,3 +1,12 @@ +#include "accumulator.h" + +/* this struct is for writing polymorphic routines as puns. When + * inserting, we might have a "datum" (with actual numerical data) or + * a "reference" (with strings denoting pathnames containing numerical + * data), but most of the operations are the same. This struct, used + * only internally, allows us to write the main body of the insert + * code only once. + */ typedef struct adb_datum_internal { uint32_t nvectors; uint32_t dim; @@ -7,6 +16,21 @@ void *power; } adb_datum_internal_t; +/* this struct is for maintaining per-query state. We don't want to + * store this stuff in the adb struct itself, because (a) it doesn't + * belong there and (b) in principle people might do two queries in + * parallel using the same adb handle. (b) is in practice a little + * bit academic because at the moment we're seeking all over the disk + * using adb->fd, but changing to use pread() might win us + * threadsafety eventually. + */ +typedef struct adb_qstate_internal { + Accumulator *accumulator; + adb_qpointers_internal_t *qpointers; + adb_qpointers_internal_t *dbpointers; + std::set *allowed_keys; +} adb_qstate_internal_t; + struct adb { char *path; int fd;