1 #ifndef CONN___NETCACHE_KEY__HPP
2 #define CONN___NETCACHE_KEY__HPP
66 fNCKey_SingleServer = 1 << 0,
67 fNCKey_NoServerCheck = 1 << 1,
81 void Assign(
const string& key_str,
85 static bool ParseBlobKey(
const char* key_str,
89 bool HasExtensions()
const {
return m_PrimaryKey.length() < m_Key.length();}
94 string StripKeyExtensions()
const;
97 static void AddExtensions(
string& blob_id,
const string& service_name,
98 TNCKeyFlags
flags,
unsigned ver = 1);
107 static Uint4 CalculateChecksum(
const string& host,
unsigned short port);
114 void GenerateBlobKey(
string*
key,
119 unsigned int rnd_num,
120 time_t creation_time = 0);
122 static string KeyToCompoundID(
123 const string& key_str,
127 static unsigned int GetBlobId(
const string& key_str);
131 {
return ParseBlobKey(key_str, key_len,
NULL, id_pool); }
135 {
return IsValidKey(
key.c_str(),
key.length(), id_pool); }
137 const string& GetKey()
const;
138 unsigned GetId()
const;
140 unsigned short GetPort()
const;
141 unsigned GetHostPortCRC32()
const;
142 unsigned GetVersion()
const;
143 time_t GetCreationTime()
const;
144 Uint4 GetRandomPart()
const;
145 const string& GetServiceName()
const;
190 inline unsigned short
Pool of recycled CCompoundID objects.
Declarations of CCompoundIDPool, CCompoundID, and CCompoundIDField.
static bool IsValidKey(const string &key, CCompoundIDPool::TInstance id_pool=NULL)
ENCKeyFlag
Blob and blob key features.
void ClearFlag(ENCKeyFlag flag)
void SetFlag(ENCKeyFlag flag)
unsigned TNCKeyFlags
Binary OR of ENCKeyFlag.
bool GetFlag(ENCKeyFlag flag) const
unsigned GetHostPortCRC32() const
static bool IsValidKey(const char *key_str, size_t key_len, CCompoundIDPool::TInstance id_pool=NULL)
bool HasExtensions() const
CNetCacheKey()
Create an empty object for later use with ParseBlobKey() or Assign().
unsigned short m_Port
TCP/IP port number.
unsigned short GetPort() const
Uint4 GetRandomPart() const
const string & GetKey() const
unsigned m_HostPortCRC32
CRC32 checksum of the host:port combination.
unsigned m_Version
Key version.
unsigned GetVersion() const
TNCKeyFlags GetFlags() const
const string & GetHost() const
time_t GetCreationTime() const
const string & GetServiceName() const
string StripKeyExtensions() const
If the blob key has been parsed successfully, this method returns a trimmed "base" version of the key...
unsigned int m_Id
BLOB id.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned short GetPort() const
Get the listening port number back.
#define NCBI_XCONNECT_EXPORT
Uint4 GetHost(TEndpointKey key)
const struct ncbi::grid::netcache::search::fields::KEY key
The NCBI C++/STL use hints.
Defines Limits for the types used in NCBI C/C++ toolkit.
Meaningful information encoded in the NetCache key.