Eris 1.3.19
MetaQuery.h
00001 #include <skstream/skstream.h>
00002 
00003 #ifndef ERIS_META_QUERY_H
00004 #define ERIS_META_QUERY_H
00005 
00006 #include <Eris/BaseConnection.h>
00007 #include <Eris/Poll.h>
00008 
00009 #include <wfmath/timestamp.h>
00010 
00011 namespace Eris {
00012 
00013 class Meta;     
00014 
00023 class MetaQuery : public BaseConnection
00024 {
00025 public: 
00026         MetaQuery(Meta *svr, const std::string &host, unsigned int index);
00027         virtual ~MetaQuery();
00028         
00030         long getQueryNo() const
00031         { return _queryNo; }
00032 
00034         const std::string& getHost() const
00035         { return _host; }
00036         
00037     unsigned int getServerIndex() const
00038     { return m_serverIndex; }
00039         
00041         long getElapsed();
00042 
00043         bool isReady(PollData &data) const
00044         {return data.isReady(_stream);}
00045                 
00046     bool isComplete() const
00047     { return m_complete; }
00048         
00049         friend class Meta;
00050 protected:
00051     void setComplete();
00052     
00054         virtual void onConnect();
00055         virtual void handleFailure(const std::string &msg);
00056     virtual void handleTimeout(const std::string& msg);
00057     
00058     void onQueryTimeout();
00059 
00060         const std::string _host;        
00061         Meta* _meta;                    
00062     
00063         long _queryNo;          
00064     WFMath::TimeStamp _stamp;   
00065     unsigned int m_serverIndex;
00066     bool m_complete;
00067 };
00068 
00069 
00070 } // of namespace 
00071 
00072 #endif