Mercurial > hg > audiodb
comparison audioDB.cpp @ 465:1030664df98c api-inversion
No more audioDB::index_allocate and audioDB::index_init_query
No more SERVER_LSH_INDEX_SINGLETON, either; instead each adb_t contains
a single cache of the last used in-core index. At the moment, this
cache is unused by the server (and the previous cache code has been
replaced by a comment), but I think that this way everyone can be
allowed to benefit without anyone having to explicitly manage indexes
themselves.
I'm not going to say how long I wandered in a maze of valgrind before
giving up and keeping the hacky workaround for loading the lsh tables
[see the FIXME comment in audiodb_index_init_query()]; let's just say
that it was long enough to find the extra bonus crashy close(lshfid) in
audioDB::index_index_db.
Also, delete the abstraction-inverting LSH stuff from query.cpp where we
are making our reporters; the fix for that, which is presumably when
creating small indexes for large datasets, is to implement
space-efficient reporters. (The accumulator code, which is my second
attempt, is more space-efficient than the reporters; inspiration may
wish to be drawn...)
author | mas01cr |
---|---|
date | Tue, 30 Dec 2008 23:56:57 +0000 |
parents | fcc6f7c4856b |
children | d3afc91d205d |
comparison
equal
deleted
inserted
replaced
463:35bb388d0eac | 465:1030664df98c |
---|---|
2 extern "C" { | 2 extern "C" { |
3 #include "audioDB_API.h" | 3 #include "audioDB_API.h" |
4 #include "audioDB-internals.h" | 4 #include "audioDB-internals.h" |
5 } | 5 } |
6 | 6 |
7 LSH* SERVER_LSH_INDEX_SINGLETON; | |
8 char* SERVER_ADB_ROOT; | 7 char* SERVER_ADB_ROOT; |
9 char* SERVER_ADB_FEATURE_ROOT; | 8 char* SERVER_ADB_FEATURE_ROOT; |
10 | 9 |
11 PointPair::PointPair(Uns32T a, Uns32T b, Uns32T c):trackID(a),qpos(b),spos(c){}; | 10 PointPair::PointPair(Uns32T a, Uns32T b, Uns32T c):trackID(a),qpos(b),spos(c){}; |
12 | 11 |
223 close(infid); | 222 close(infid); |
224 if(adb && !UseApiError) { | 223 if(adb && !UseApiError) { |
225 audiodb_close(adb); | 224 audiodb_close(adb); |
226 adb = NULL; | 225 adb = NULL; |
227 } | 226 } |
228 if(lsh!=SERVER_LSH_INDEX_SINGLETON) | 227 if(lsh) |
229 delete lsh; | 228 delete lsh; |
230 } | 229 } |
231 | 230 |
232 audioDB::~audioDB(){ | 231 audioDB::~audioDB(){ |
233 cleanup(); | 232 cleanup(); |
824 } | 823 } |
825 | 824 |
826 // This entry point is visited once per instance | 825 // This entry point is visited once per instance |
827 // so it is a good place to set any global state variables | 826 // so it is a good place to set any global state variables |
828 int main(const int argc, const char* argv[]){ | 827 int main(const int argc, const char* argv[]){ |
829 SERVER_LSH_INDEX_SINGLETON = 0; // Initialize global variables | |
830 SERVER_ADB_ROOT = 0; // Server-side database root prefix | 828 SERVER_ADB_ROOT = 0; // Server-side database root prefix |
831 SERVER_ADB_FEATURE_ROOT = 0; // Server-side features root prefix | 829 SERVER_ADB_FEATURE_ROOT = 0; // Server-side features root prefix |
832 audioDB(argc, argv); | 830 audioDB(argc, argv); |
833 } | 831 } |
834 | 832 |