ddc
Public Member Functions | Public Attributes | List of all members
CDDCLeafServer Class Reference

#include <LeafServer.h>

Inheritance diagram for CDDCLeafServer:
Inheritance graph
[legend]
Collaboration diagram for CDDCLeafServer:
Collaboration graph
[legend]

Public Member Functions

 CDDCLeafServer ()
 
virtual ~CDDCLeafServer ()
 
virtual void Shutdown ()
 
virtual CDDCServerWorkerClone (void) const
 
virtual void WorkerCloneInit (const CDDCServer *Parent, size_t WorkerId)
 
virtual void WorkerCloneFree (void)
 
virtual bool Close (int &rConnectedSocket, bool linger=false, int timeout=5)
 
virtual void handle__get_first_hits (string &Result, const char *Query, int TimeOut, size_t ResultLimit, const string &ReqPath, const NavHint &Hint)
 
virtual void handle__get_hit_strings (string &Result, const char *ResultType, size_t StartHitNo, size_t ResultLimit)
 
virtual void handle__run_query (string &Result, const char *CorpusName, const char *Query, const char *ResultType, size_t StartHitNo, size_t ResultLimit, int TimeOut, const string &ReqPath, const NavHint &Hint)
 
virtual void handle__expand_terms (string &Result, const string &pipeline, const string &terms, int timeout, const string &corpus)
 
virtual void handle__status (string &Result, int timeout=10, bool verbose=false)
 
virtual void handle__info (string &Result, int timeout=10, bool verbose=false)
 
virtual void handle__reload (string &Result, int depth=0)
 
virtual void handle__clear_cache (string &Result, int depth=0)
 
virtual void handle__nodes (string &Result, int depth=-1)
 
void LoadHolder (CConcHolder **ppHolder=NULL)
 
void GetHitCounts (CRunQueryData &runq, DDCFormatTypeEnum ResultTypeE)
 
void GetHitContexts (CRunQueryData &runq, DDCFormatTypeEnum ResultTypeE)
 
- Public Member Functions inherited from CDDCServer
 CDDCServer ()
 
virtual ~CDDCServer ()
 
virtual void Shutdown (bool quiet=false)
 
virtual void SetOptions (const CDDCServerOptions &Options)
 
virtual void StartClientThreads ()
 
bool UseClientThreads (void) const
 
virtual void RunThread ()
 
virtual void HandleClientConnection (int &rConnectedSocket)
 
virtual string ProcessSocketString (const string &SocketInput, int &rConnectedSocket)
 
virtual void handle__get_first_hits (string &Result, const char *Query, int TimeOut, size_t ResultLimit)
 
virtual void handle__run_query (string &Result, const char *CorpusName, const char *Query, const char *ResultType, size_t StartHitNo, size_t ResultLimit, int TimeOut)
 
virtual void handle__get_paradigm (string &Result, const char *Word, int iLemmatizeOnly, int iLang)
 
virtual void handle__close_socket (string &Result, int &rConnectedSocket)
 
virtual void handle__version (string &Result)
 
virtual void handle__vstatus (string &Result, int timeout=10)
 
virtual void handle__vinfo (string &Result, int timeout=10)
 
void method_not_implemented (const char *methodName)
 
virtual size_t residentMemorySize (void) const
 
virtual size_t totalMemorySize (void) const
 
void findPathHint (const string &ReqStr, size_t StartPos, size_t &PathPos, size_t &HintPos)
 
- Public Member Functions inherited from CHost
 CHost ()
 
virtual ~CHost ()
 
bool ReadFromString (string S)
 
virtual void CreateListener ()
 
void CopyAddressParametersFrom (const CHost &X)
 
bool CloseListenSocket (int timeout=0)
 
int CreateAndConnectSocket (string &strError) const
 
string GetAddressStr () const
 
const string & GetLocalPathOfIndex () const
 
const CSocketAddrSocketAddr () const
 
const string & HostAddr () const
 
const int Port () const
 
bool InitEmbedded (const CHost &)
 
void InitShortName ()
 
bool IsListening () const
 
bool GetRequest (int &rConnectedSocket, int TimeOut, string &Request)
 
void SendResponse (int &rConnectedSocket, const string &Result)
 
void HandleSocketError (int &rConnectedSocket, const string &ErrorStr="ERROR", const string &Where="CHost::HandleSocketError()")
 
void HandleClientRequest (int &rConnectedSocket, int TimeOut)
 
virtual void ClientError (int code=-1, const string &msg="")
 
virtual void ClientError (int code, const string &msg, int &clientSocket)
 

Public Attributes

CConcHolderm_pHolder
 
- Public Attributes inherited from CDDCServer
DDCVersionT m_VersionCompat
 
time_t m_tStarted
 
CDDCServerStats m_ServerStats
 
CDDCServerStats m_SessionStats
 
bool m_bLogRequests
 
set< string > m_noLogCommands
 
string m_FQHostName
 
size_t m_nWorkers
 
size_t m_ThreadQueueSize
 
double m_SlowQueryTimeout
 
size_t m_WorkerId
 
class CDDCServerThreadPoolm_ThreadPool
 
- Public Attributes inherited from CHost
string m_CorpusName
 full node label, including optional "server:" prefix More...
 
string m_ShortName
 short node label, without optional "server:" prefix More...
 

Additional Inherited Members

- Static Public Attributes inherited from CDDCServer
static const char * AdditionalHitDelimiter = "\x01"
 
static const size_t MaxSubhostsSize = 256
 
- Protected Member Functions inherited from CHost
int CreateSocket (bool bBind, string &strError) const
 
bool CheckValidAddr () const
 
void StopListening ()
 
- Protected Attributes inherited from CHost
CSocketAddr m_SockAddr
 socket address (tcp or UNIX); formerly m_HostAddr, m_Port, m_SocketPath More...
 
bool m_bExpectMore
 moo: whether to expect more requests from current client More...
 
bool m_bRespond
 moo: whether current request has a real (possibly empty) response More...
 
bool m_bLogFinish
 moo: whether to log connection completion More...
 
string m_LocalPath
 path to local project-file (ddc_local_corpora.cfg) or label of parent branch node (ddc_server.cfg) More...
 
uint32_t m_maxReceiveBytes
 maximum receivable packet length (default=0: no limit) More...
 
mode_t m_UnixSocketPerms
 permissions mask for unix socket (defualt=0: OS-default = 0777&~umask()) More...
 

Detailed Description

DDC leaf server node, formerly CDDCCorpusListenHost

Constructor & Destructor Documentation

◆ CDDCLeafServer()

CDDCLeafServer::CDDCLeafServer ( )
inline

default constructor

Referenced by WorkerClone().

Here is the caller graph for this function:

◆ ~CDDCLeafServer()

virtual CDDCLeafServer::~CDDCLeafServer ( )
inlinevirtual

default destructor

References Shutdown().

Here is the call graph for this function:

Member Function Documentation

◆ Shutdown()

void CDDCLeafServer::Shutdown ( )
virtual

close any open socket(s) this server administers, called on termination signal

References CHost::CloseListenSocket(), ddcLogInfo, Format(), and CHost::m_CorpusName.

Referenced by ~CDDCLeafServer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WorkerClone()

virtual CDDCServer* CDDCLeafServer::WorkerClone ( void  ) const
inlinevirtual

create a minimal copy of this object (and any subordinate data) for use by a worker thread

Reimplemented from CDDCServer.

References CDDCLeafServer(), Close(), GetHitContexts(), GetHitCounts(), handle__clear_cache(), handle__expand_terms(), handle__get_first_hits(), handle__get_hit_strings(), handle__info(), handle__nodes(), handle__reload(), handle__run_query(), handle__status(), LoadHolder(), SOCKET, WorkerCloneFree(), and WorkerCloneInit().

Here is the call graph for this function:

◆ WorkerCloneInit()

void CDDCLeafServer::WorkerCloneInit ( const CDDCServer Parent,
size_t  WorkerId 
)
virtual

initialize a newly created worker-clone (and any subordinate data)

Reimplemented from CDDCServer.

References m_pHolder, CConcSession::WorkerClone(), and CDDCServer::WorkerCloneInit().

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WorkerCloneFree()

void CDDCLeafServer::WorkerCloneFree ( void  )
virtual

perform local cleanup of a worker clone prior to deletion

Reimplemented from CDDCServer.

References m_pHolder, CDDCServer::WorkerCloneFree(), and CConcSession::WorkerCloneFree().

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Close()

bool CDDCLeafServer::Close ( int &  rConnectedSocket,
bool  linger = false,
int  timeout = 5 
)
virtual

close connected socket, implies cleanup of m_pHolder intermediate results

Reimplemented from CHost.

References CConcSession::ClearQuery(), CConcSession::ClearQueryResults(), CHost::Close(), m_pHolder, and CConcSession::m_ShortOccurCaches.

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle__get_first_hits()

void CDDCLeafServer::handle__get_first_hits ( string &  Result,
const char *  Query,
int  TimeOut,
size_t  ResultLimit,
const string &  ReqPath,
const NavHint Hint 
)
virtual

◆ handle__get_hit_strings()

void CDDCLeafServer::handle__get_hit_strings ( string &  Result,
const char *  ResultType,
size_t  StartHitNo,
size_t  ResultLimit 
)
virtual

request handler: get_hit_strings: required (leaf)

Reimplemented from CDDCServer.

References errNone, Format(), CConcSession::GenerateHitStrings(), GetDDCErrorString(), CConcSession::GetOffsetHint(), CConcSession::GetResultFormatStr(), CHost::m_bExpectMore, CConcSession::m_ErrorStr, m_pHolder, CConcSession::m_QueryResultStr, CConcSession::m_ResultLimit, CDDCServer::m_VersionCompat, and CConcSession::SetResultFormat().

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle__run_query()

void CDDCLeafServer::handle__run_query ( string &  Result,
const char *  CorpusName,
const char *  Query,
const char *  ResultType,
size_t  StartHitNo,
size_t  ResultLimit,
int  TimeOut,
const string &  ReqPath,
const NavHint Hint 
)
virtual

◆ handle__expand_terms()

void CDDCLeafServer::handle__expand_terms ( string &  Result,
const string &  pipeline,
const string &  terms,
int  timeout,
const string &  corpus 
)
virtual

request handler: expand_terms: required (leaf|branch)

Reimplemented from CDDCServer.

References errNone, TxChain::expand(), Format(), TxDispatcher::getChain(), CConcSession::GetTxDispatcher(), CHost::m_bExpectMore, m_pHolder, CConcSession::SetTimeOut(), and stringSplit().

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle__status()

void CDDCLeafServer::handle__status ( string &  Result,
int  timeout = 10,
bool  verbose = false 
)
virtual

◆ handle__info()

void CDDCLeafServer::handle__info ( string &  Result,
int  timeout = 10,
bool  verbose = false 
)
virtual

request handler: info: required (leaf|branch)

Reimplemented from CDDCServer.

References CBiblIndex::BiblExpanderMapToJson(), FileBasename(), Format(), CBiblIndex::FreeBiblAliasMapToJson(), CBiblIndex::FreeBiblMapToJson(), CHitBorders::GetBreaks(), CHitBorders::GetCorpusEndTokenNo(), CConcordance::GetCorpusFilesCount(), CConcordance::GetMaskedFilesCount(), CStringIndexator::GetSearchPeriod(), CStringIndexator::GetSearchPeriodsCount(), CSourceFileHolder::GetSourceFilesCount(), GetStringByLanguage(), CConcSession::GetTxDispatcher(), CConcordance::HasContextOperator(), CConcordance::IndexPunctuation(), jsonStr(), LoadFileToString(), CConcordance::m_bAllowCountByTokenAttributes, CConcordance::m_bAllowUnsafeQueries, CConcordance::m_bCaseSensitive, CHost::m_bExpectMore, CConcordance::m_BiblIndex, CConcordance::m_bIndexChunks, CConcordance::m_bIndexMorphPatterns, CStringIndexator::m_bMemoryMap, CHitBorders::CBreakCollection::m_BreakOffsets, CTermExpander::m_Class, CHost::m_CorpusName, CIndexSetForQueryingStage::m_Index, CStringIndexator::m_IndexMap, CStringIndexator::m_Indices, CConcordance::m_IndicesToShow, CConcordance::m_InterpDelimiter, CTermExpander::m_Label, CConcordance::m_Language, CHitBorders::CBreakCollection::m_LongName, CStringIndexSet::m_Name, CConcordance::m_OpDefaultIndexNames, CTermExpander::m_Param, CStringIndexator::m_Path, CConcSession::m_pConcordance, m_pHolder, CConcordance::m_ServerInfo, CHitBorders::CBreakCollection::m_ShortName, CStringIndexSet::m_ShortName, CConcordance::m_Timestamp, CConcordance::m_TokenDelimiter, TxDispatcher::m_tx, CConcordance::m_Utf8, MakeFName(), PACKAGE_VERSION, RelativeFileName(), ddcVecFile< T >::size(), timestampUTC(), and CConcordance::UseDwdsThesaurus().

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle__reload()

void CDDCLeafServer::handle__reload ( string &  Result,
int  depth = 0 
)
virtual

request handler: info: required (leaf|branch)

Reimplemented from CDDCServer.

References errOther, Format(), CHost::GetLocalPathOfIndex(), jsonStr(), LoadHolder(), CHost::m_bExpectMore, CHost::m_CorpusName, CConcSession::m_pConcordance, and m_pHolder.

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle__clear_cache()

void CDDCLeafServer::handle__clear_cache ( string &  Result,
int  depth = 0 
)
virtual

request handler: clear_cache: required (leaf|branch)

Reimplemented from CDDCServer.

References ddcLRUCache< Key, Val >::clear(), CConcSession::ClearQueryCache(), ddcCurlCache, Format(), jsonStr(), ddcLRUCache< Key, Val >::lock(), CHost::m_bExpectMore, CHost::m_CorpusName, m_pHolder, and ddcLRUCache< Key, Val >::unlock().

Referenced by WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle__nodes()

void CDDCLeafServer::handle__nodes ( string &  Result,
int  depth = -1 
)
virtual

request handler: nodes: required (leaf|branch; since v2.2.8)

Reimplemented from CDDCServer.

References CHost::m_bExpectMore.

Referenced by WorkerClone().

Here is the caller graph for this function:

◆ LoadHolder()

void CDDCLeafServer::LoadHolder ( CConcHolder **  ppHolder = NULL)

(re-)load the underlying index (reload broken!)

References CDDCServer::AdditionalHitDelimiter, ddcLogDebug, ddcLogError, ddcLogInfo, Format(), CHost::GetLocalPathOfIndex(), CHost::m_CorpusName, CConcSession::m_pConcordance, m_pHolder, CSocketAddr::m_Port, and CHost::m_SockAddr.

Referenced by handle__reload(), LoadLocalCorpora(), and WorkerClone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHitCounts()

void CDDCLeafServer::GetHitCounts ( CRunQueryData runq,
DDCFormatTypeEnum  ResultTypeE 
)

generate count-query response for run_query handler

References DDC_ResultHTML, DDC_ResultJson, CRunQueryData::HitsKey, m_pHolder, CConcSession::m_QueryResultStr, and CRunQueryData::ResponseBody.

Referenced by handle__run_query(), and WorkerClone().

Here is the caller graph for this function:

◆ GetHitContexts()

void CDDCLeafServer::GetHitContexts ( CRunQueryData runq,
DDCFormatTypeEnum  ResultTypeE 
)

generate context-query response for run_query handler

References DDC_ResultJson, CRunQueryData::HitsKey, m_pHolder, CConcSession::m_QueryResultStr, and CRunQueryData::ResponseBody.

Referenced by handle__run_query(), and WorkerClone().

Here is the caller graph for this function:

Member Data Documentation

◆ m_pHolder

CConcHolder* CDDCLeafServer::m_pHolder

The documentation for this class was generated from the following files: