open-source-search-engine/Msg22.h

99 lines
2.4 KiB
C
Raw Normal View History

2013-08-03 00:12:24 +04:00
// Matt Wells, copyright Jul 2001
// . get a TitleRec from url/coll or docId
#ifndef _MSG22_H_
#define _MSG22_H_
#include "Url.h"
#include "Multicast.h"
// m_url[0]!=0 if this is a url-based request and NOT docid-based
class Msg22Request {
public:
2014-10-30 22:36:39 +03:00
int64_t m_docId;
2014-11-11 01:45:11 +03:00
int32_t m_niceness;
int32_t m_maxCacheAge;
2013-08-03 00:12:24 +04:00
collnum_t m_collnum;
char m_justCheckTfndb :1;
char m_getAvailDocIdOnly:1;
2013-08-03 00:12:24 +04:00
char m_doLoadBalancing :1;
char m_addToCache :1;
char m_inUse :1;
char m_url[MAX_URL_LEN+1];
2014-11-11 01:45:11 +03:00
int32_t getSize () {
2013-08-03 00:12:24 +04:00
return (m_url - (char *)&m_docId) + 1+gbstrlen(m_url); };
2014-11-11 01:45:11 +03:00
int32_t getMinSize() {
2013-08-03 00:12:24 +04:00
return (m_url - (char *)&m_docId) + 1; };
2014-05-14 19:16:47 +04:00
Msg22Request() { m_inUse = 0; }
2013-08-03 00:12:24 +04:00
};
class Msg22 {
public:
Msg22();
~Msg22();
static bool registerHandler ( ) ;
bool getAvailDocIdOnly ( class Msg22Request *r ,
2014-10-30 22:36:39 +03:00
int64_t preferredDocId ,
char *coll ,
void *state ,
void (* callback)(void *state) ,
2014-11-11 01:45:11 +03:00
int32_t niceness ) ;
2013-08-03 00:12:24 +04:00
// . make sure you keep url/coll on your stack cuz we just point to it
// . see the other getTitleRec() description below for more details
// . use a maxCacheAge of 0 to avoid the cache
bool getTitleRec ( class Msg22Request *r ,
char *url ,
2014-10-30 22:36:39 +03:00
int64_t docId ,
2013-08-03 00:12:24 +04:00
char *coll ,
char **titleRecPtrPtr ,
2014-11-11 01:45:11 +03:00
int32_t *titleRecSizePtr ,
2013-08-03 00:12:24 +04:00
bool justCheckTfndb ,
bool getAvailDocIdOnly ,
2013-08-03 00:12:24 +04:00
void *state ,
void (* callback) (void *state ),
2014-11-11 01:45:11 +03:00
int32_t niceness ,
2013-08-03 00:12:24 +04:00
bool addToCache ,
2014-11-11 01:45:11 +03:00
int32_t maxCacheAge ,
int32_t timeout ,
2013-08-03 00:12:24 +04:00
bool doLoadBalancing = false );
2014-10-30 22:36:39 +03:00
int64_t getAvailDocId ( ) { return m_availDocId; };
2013-08-03 00:12:24 +04:00
// public so C wrappers can call
void gotReply ( ) ;
// this is a hack so Msg38 can store his this ptr here
//void *m_parent; // used by Msg38
2014-11-11 01:45:11 +03:00
//int32_t m_slot; // for resending on same Msg22 slot in array
2013-08-03 00:12:24 +04:00
//void *m_dataPtr;// for holding recepient record ptr of TopNode ptr
char **m_titleRecPtrPtr;
2014-11-11 01:45:11 +03:00
int32_t *m_titleRecSizePtr;
2013-08-03 00:12:24 +04:00
void (* m_callback ) (void *state);
void *m_state ;
//void *m_state2 ;
//void *m_state3 ;
bool m_found;
2014-10-30 22:36:39 +03:00
int64_t m_availDocId;
2013-08-03 00:12:24 +04:00
// the error getting the title rec is stored here
2014-11-11 01:45:11 +03:00
int32_t m_errno;
2013-08-03 00:12:24 +04:00
bool m_outstanding ;
// for sending the Msg22
Multicast m_mcast;
class Msg22Request *m_r;
};
#endif