(!ParseJobKey(key_str, id_pool)) {
57 "Invalid job key format: '"<<
70 const char* ch = key_str.c_str();
77 if((
id= (
unsigned) atoi(ch)) == 0)
85 const char* token_begin = ++ch;
86 while(*ch !=
'\0'&& *ch++ !=
'_')
90 if((port = (
unsigned short) atoi(ch)) == 0)
94host.assign(token_begin, ch - token_begin - 1);
100 if(*ch < '0' || *ch >
'9')
104 intunderscores_to_skip = 0;
105 while(*++ch ==
'_')
106++underscores_to_skip;
111 while(*++ch !=
'\0')
112 if((*ch < '0' || *ch >
'9') && (*ch < 'a' || *ch >
'z') &&
113(*ch < 'A' || *ch >
'Z') && *ch !=
'-') {
116 else if(--underscores_to_skip < 0)
119 if(underscores_to_skip > 0)
121queue.assign(token_begin, ch - token_begin);
124}
else if(id_pool !=
NULL) {
131 id= (unsigned) field.
GetID();
162 id= (unsigned) atoi(ch);
169 #define MAX_INT_TO_STR_LEN(type) (sizeof(type) * 3 / 2) 172 const string& host,
unsignedport,
const string& queue_name)
174limits::Check<limits::SQueueName>(queue_name);
181 m_Port= (
unsignedshort) port;
182m_QueueName = queue_name;
186 autoqueue_prefix_len = 1 +
count(queue_name.begin(), queue_name.end(),
'_');
188m_V1HostPortQueue.reserve(1 + host.size() + 1 + port_str.size() +
189queue_prefix_len + queue_name.size());
191m_V1HostPortQueue.push_back(
'_');
192m_V1HostPortQueue.append(host);
193m_V1HostPortQueue.push_back(
'_');
194m_V1HostPortQueue.append(port_str);
195m_V1HostPortQueue.append(queue_prefix_len,
'_');
196m_V1HostPortQueue.append(queue_name);
203m_V1HostPortQueue.size());
206 key->append(m_V1HostPortQueue);
223 if(!m_QueueName.empty())
Exception class for use by CCompoundIDPool, CCompoundID, and CCompoundIDField.
Compound ID field â an element of the compound ID that has a type and a value.
Uint2 GetPort() const
Return the network port number that this field contains.
Uint4 GetIPv4Address() const
Return the 32-bit IP address that this field contains.
string GetHost() const
Return the host name or address that this field contains.
string GetDatabaseName() const
Return the database name that this field contains.
Uint8 GetID() const
Return the ID value that this field contains.
Pool of recycled CCompoundID objects.
CCompoundID NewID(ECompoundIDClass new_id_class)
Create and return a new CCompoundID objects.
CCompoundID FromString(const string &cid)
Unpack the base64-encoded ID and return a CCompoundID object for field extraction.
Base64-encoded ID string that contains extractable typed fields.
void AppendDatabaseName(const string &db_name)
Append an eCIT_DatabaseName field at the end of this compound ID.
CCompoundIDField GetFirst(ECompoundIDFieldType field_type)
Return the first field of the specified type or NULL if this compound ID contains no fields of such t...
string ToString()
Pack the ID and return its string representation.
void AppendID(Uint8 id)
Append an eCIT_ID field at the end of this compound ID.
void AppendIPv4SockAddr(Uint4 ipv4_address, Uint2 port_number)
Append an eCIT_IPv4SockAddr field at the end of this compound ID.
void AppendPort(Uint2 port_number)
Append an eCIT_Port field at the end of this compound ID.
void AppendHost(const string &host)
Append an eCIT_Host field at the end of this compound ID.
NetSchedule internal exception.
The NCBI C++ standard methods for dealing with std::string.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
bool ParseJobKey(const string &key_str, CCompoundIDPool::TInstance id_pool=NULL)
CNetScheduleKeyGenerator(const string &host, unsigned port, const string &queue_name)
string Generate(unsigned id) const
string GenerateCompoundID(unsigned id, CCompoundIDPool id_pool) const
CNetScheduleKey()
Construct an empty object for use with ParseJobKey().
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static CNCBI_IPAddr gethostbyname(const string &host, ESwitch log=eOff)
Return 0 or empty address on error.
static bool isip(const string &host, bool fullquad=false)
For IPv4 only.
static string ntoa(const CNCBI_IPAddr &addr)
BSD-like API.
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
unsigned short m_Port
TCP port to listen on.
const string version
version string
const struct ncbi::grid::netcache::search::fields::KEY key
#define NS_KEY_V1_PREFIX_LEN
#define MAX_INT_TO_STR_LEN(type)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4