comparison soap.cpp @ 308:896679d8cc39

Added server-side loading of persistent index (LSH hashtables) via --load_index -d dbName -R radius -l sequenceLength. Queries using these parameters will lookup the memory-resident hashtable instead of loading one from disk.
author mas01mc
date Thu, 07 Aug 2008 01:53:38 +0000
parents d1b8b2dec37e
children 435ffdaecae9
comparison
equal deleted inserted replaced
307:d1b8b2dec37e 308:896679d8cc39
26 soap_destroy(&soap); 26 soap_destroy(&soap);
27 soap_end(&soap); 27 soap_end(&soap);
28 soap_done(&soap); 28 soap_done(&soap);
29 } 29 }
30 30
31 // WS_QUERY (CLIENT SIDE)
31 void audioDB::ws_query(const char*dbName, const char *featureFileName, const char* hostport){ 32 void audioDB::ws_query(const char*dbName, const char *featureFileName, const char* hostport){
32 struct soap soap; 33 struct soap soap;
33 adb__queryResponse adbQueryResponse; 34 adb__queryResponse adbQueryResponse;
34 35
35 soap_init(&soap); 36 soap_init(&soap);
47 soap_destroy(&soap); 48 soap_destroy(&soap);
48 soap_end(&soap); 49 soap_end(&soap);
49 soap_done(&soap); 50 soap_done(&soap);
50 } 51 }
51 52
53 // WS_QUERY_BY_KEY (CLIENT SIDE)
52 void audioDB::ws_query_by_key(const char*dbName, const char *trackKey, const char* hostport){ 54 void audioDB::ws_query_by_key(const char*dbName, const char *trackKey, const char* hostport){
53 struct soap soap; 55 struct soap soap;
54 adb__queryResponse adbQueryResponse; 56 adb__queryResponse adbQueryResponse;
55 adb__sequenceQueryParms asqp; 57 adb__sequenceQueryParms asqp;
56 58
93 } catch(char *err) { 95 } catch(char *err) {
94 soap_receiver_fault(soap, err, ""); 96 soap_receiver_fault(soap, err, "");
95 return SOAP_FAULT; 97 return SOAP_FAULT;
96 } 98 }
97 } 99 }
98 100
99 // Literal translation of command line to web service 101 // Literal translation of command line to web service
100
101 int adb__query(struct soap* soap, xsd__string dbName, xsd__string qKey, xsd__string keyList, xsd__string timesFileName, xsd__int qType, xsd__int qPos, xsd__int pointNN, xsd__int trackNN, xsd__int seqLen, adb__queryResponse &adbQueryResponse){ 102 int adb__query(struct soap* soap, xsd__string dbName, xsd__string qKey, xsd__string keyList, xsd__string timesFileName, xsd__int qType, xsd__int qPos, xsd__int pointNN, xsd__int trackNN, xsd__int seqLen, adb__queryResponse &adbQueryResponse){
102 char queryType[256]; 103 char queryType[256];
103 for(int k=0; k<256; k++) 104 for(int k=0; k<256; k++)
104 queryType[k]='\0'; 105 queryType[k]='\0';
105 if(qType == O2_POINT_QUERY) 106 if(qType == O2_POINT_QUERY)
244 if (m < 0) 245 if (m < 0)
245 soap_print_fault(&soap, stderr); 246 soap_print_fault(&soap, stderr);
246 else 247 else
247 { 248 {
248 fprintf(stderr, "Socket connection successful: master socket = %d\n", m); 249 fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
250 // Make a global Web Services LSH Index (SINGLETON)
251 if(WS_load_index && dbName && index_exists(dbName, radius, sequenceLength)){
252 char* indexName = index_get_name(dbName, radius, sequenceLength);
253 fprintf(stderr, "Loading LSH hashtables: %s...\n", indexName);
254 lsh = new LSH(indexName, true);
255 assert(lsh);
256 SERVER_LSH_INDEX_SINGLETON = lsh;
257 fprintf(stderr, "LSH INDEX READY\n");
258 fflush(stderr);
259 delete[] indexName;
260 }
261
249 for (int i = 1; ; i++) 262 for (int i = 1; ; i++)
250 { 263 {
251 s = soap_accept(&soap); 264 s = soap_accept(&soap);
252 if (s < 0) 265 if (s < 0)
253 { 266 {