本文整理汇总了C++中Endpoint::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::Set方法的具体用法?C++ Endpoint::Set怎么用?C++ Endpoint::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::Set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
bool ReplicatedConfig::Init()
{
Endpoint endpoint;
nodeID = Config::GetIntValue("paxos.nodeID", 0);
numNodes = Config::GetListNum("paxos.endpoints");
if (numNodes == 0)
{
endpoint.Set("0.0.0.0:10000");
endpoints[0] = endpoint;
nodeID = 0;
}
else
{
if (nodeID < 0 || nodeID >= numNodes)
STOP_FAIL("Configuration error, "
"check your paxos.nodeID and paxos.endpoints entry" ,0);
for (unsigned i = 0; i < numNodes; i++)
{
endpoint.Set(Config::GetListValue("paxos.endpoints", i, NULL), true);
endpoints[i] = endpoint;
}
}
if (strcmp("replicated", Config::GetValue("mode", "")) == 0)
InitRestartCounter();
return true;
}
示例2: InitContextTransport
void InitContextTransport()
{
const char* str;
Endpoint endpoint;
// set my endpoint
str = configFile.GetValue("endpoint", "");
if (str == NULL)
STOP_FAIL(1, "Missing \"endpoint\" in config file!");
if (!endpoint.Set(str, true))
STOP_FAIL(1, "Bad endpoint format in config file!");
CONTEXT_TRANSPORT->Init(endpoint);
}
示例3: Init
int Client::Init(int nodec, const char* nodev[])
{
GLOBAL_MUTEX_GUARD_DECLARE();
// sanity check on parameters
if (nodec <= 0 || nodev == NULL)
return SDBP_API_ERROR;
// TODO: find out the optimal size of MAX_SERVER_NUM
if (!IOProcessor::Init(MAX_IO_CONNECTION))
return SDBP_API_ERROR;
IOProcessor::BlockSignals(IOPROCESSOR_BLOCK_INTERACTIVE);
// set default timeouts
masterTimeout.SetDelay(3 * PAXOSLEASE_MAX_LEASE_TIME);
globalTimeout.SetDelay(SDBP_DEFAULT_TIMEOUT);
connectivityStatus = SDBP_NOCONNECTION;
timeoutStatus = SDBP_SUCCESS;
result = new Result;
controllerConnections = new ControllerConnection*[nodec];
for (int i = 0; i < nodec; i++)
{
Endpoint endpoint;
endpoint.Set(nodev[i], true);
controllerConnections[i] = new ControllerConnection(this, (uint64_t) i, endpoint);
}
numControllers = nodec;
master = -1;
masterTime = 0;
commandID = 0;
masterCommandID = 0;
consistencyLevel = SDBP_CONSISTENCY_STRICT;
highestSeenPaxosID = 0;
isBatched = false;
return SDBP_SUCCESS;
}
示例4: Init
int Client::Init(int nodec, const char* nodev[])
{
// validate args
if (nodec <= 0 || nodev == NULL)
return KEYSPACE_API_ERROR;
if (!IOProcessor::Init(nodec + 64, false))
return KEYSPACE_API_ERROR;
masterTimeout.SetDelay(3 * MAX_LEASE_TIME);
globalTimeout.SetDelay(KEYSPACE_DEFAULT_TIMEOUT);
connectivityStatus = KEYSPACE_NOCONNECTION;
timeoutStatus = KEYSPACE_SUCCESS;
result = new Result;
conns = new ClientConn*[nodec];
for (int i = 0; i < nodec; i++)
{
Endpoint endpoint;
endpoint.Set(nodev[i], true);
conns[i] = new ClientConn(*this, i, endpoint);
}
numConns = nodec;
master = -1;
masterTime = 0;
cmdID = 1;
masterCmdID = 1;
masterQuery = false;
distributeDirty = false;
currentConn = 0;
return KEYSPACE_SUCCESS;
}