本文整理汇总了C++中Owned::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::clear方法的具体用法?C++ Owned::clear怎么用?C++ Owned::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WuResubmit
bool WuResubmit(const char *wuid)
{
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
Owned<IWorkUnit> wu = factory->updateWorkUnit(wuid);
if (!wu)
{
ERRLOG("WuResubmit(%s): could not find workunit",wuid);
return false;
}
if (wu->getState()!=WUStateFailed)
{
ERRLOG("WuResubmit(%s): could not resubmit as workunit state is '%s'", wuid, wu->queryStateDesc());
return false;
}
SCMStringBuffer token;
wu->getSecurityToken(token);
SCMStringBuffer user;
SCMStringBuffer password;
extractToken(token.str(), wuid, user, password);
wu->resetWorkflow();
wu->setState(WUStateSubmitted);
wu->commit();
wu.clear();
submitWorkUnit(wuid,user.str(),password.str());
PROGLOG("WuResubmit(%s): resubmitted",wuid);
return true;
}
示例2: write
virtual void write()
{
StringBuffer rowTag;
OwnedRoxieString xmlpath(helper->getXmlIteratorPath());
if (!xmlpath)
{
rowTag.append(DEFAULTXMLROWTAG);
}
else
{
const char *path = xmlpath;
if (*path == '/') path++;
if (strchr(path, '/')) UNIMPLEMENTED;
rowTag.append(path);
}
StringBuffer out;
if (!dlfn.isExternal() || firstNode()) // if external, 1 header,footer
{
OwnedRoxieString suppliedHeader(helper->getHeader());
if (kind==TAKjsonwrite)
buildJsonHeader(out, suppliedHeader, rowTag);
else if (suppliedHeader)
out.set(suppliedHeader);
else
out.set(DEFAULTXMLHEADER).newline();
outraw->write(out.length(), out.str());
if (calcFileCrc)
fileCRC.tally(out.length(), out.str());
}
Owned<IXmlWriterExt> writer = createIXmlWriterExt(helper->getXmlFlags(), 0, NULL, (kind==TAKjsonwrite) ? WTJSON : WTStandard);
writer->outputBeginArray(rowTag); //need this to format rows, even if not outputting it below
while(!abortSoon)
{
OwnedConstThorRow row = input->ungroupedNextRow();
if (!row)
break;
writer->clear().outputBeginNested(rowTag, false);
helper->toXML((const byte *)row.get(), *writer);
writer->outputEndNested(rowTag);
outraw->write(writer->length(), writer->str());
if (calcFileCrc)
fileCRC.tally(writer->length(), writer->str());
processed++;
}
if (!dlfn.isExternal() || lastNode()) // if external, 1 header,footer
{
OwnedRoxieString suppliedFooter(helper->getFooter());
if (kind==TAKjsonwrite)
buildJsonFooter(out.clear().newline(), suppliedFooter, rowTag);
else if (suppliedFooter)
out.set(suppliedFooter);
else
out.set(DEFAULTXMLFOOTER).newline();
outraw->write(out.length(), out.str());
if (calcFileCrc)
fileCRC.tally(out.length(), out.str());
}
}
示例3: printf
static void test1()
{
printf("Test SDS read/write\n");
Owned<IPropertyTree> ref = createPTree("DAREGRESS");
fn(1,2,3,0,ref);
StringBuffer refstr;
toXML(ref,refstr,0,XML_SortTags|XML_Format);
printf("Created reference size %d\n",refstr.length());
Owned<IRemoteConnection> conn = querySDS().connect("/DAREGRESS",myProcessSession(), RTM_CREATE, 1000000);
Rconn = conn;
IPropertyTree *root = conn->queryRoot();
fn(1,2,3,0,root);
conn.clear();
printf("Created test branch 1\n");
conn.setown(querySDS().connect("/DAREGRESS",myProcessSession(), RTM_DELETE_ON_DISCONNECT, 1000000));
root = conn->queryRoot();
StringBuffer s;
toXML(root,s,0,XML_SortTags|XML_Format);
if (strcmp(s.str(),refstr.str())!=0) {
ERROR("Branch 1 does not match");
}
else
printf("Branch 1 matches\n");
conn.clear();
conn.setown(querySDS().connect("/DAREGRESS",myProcessSession(), 0, 1000000));
if (conn)
ERROR("RTM_DELETE_ON_DISCONNECT failed");
Rconn = querySDS().connect("/DAREGRESS",myProcessSession(), RTM_CREATE, 1000000);
StringBuffer pn;
fn2(1,2,3,0,pn);
::Release(Rconn);
printf("Created test branch 2\n");
Rconn = NULL;
conn.setown(querySDS().connect("/DAREGRESS",myProcessSession(), RTM_DELETE_ON_DISCONNECT, 1000000));
root = conn->queryRoot();
toXML(root,s.clear(),0,XML_SortTags|XML_Format);
if (strcmp(s.str(),refstr.str())!=0) {
ERROR("Branch 2 does not match");
}
else
printf("Branch 2 matches\n");
conn.clear();
conn.setown(querySDS().connect("/DAREGRESS",myProcessSession(), 0, 1000000));
if (conn)
ERROR("RTM_DELETE_ON_DISCONNECT failed");
}
示例4: stop
void stop()
{
if (global)
putNext(NULL);
stopInput(input);
input.clear();
dataLinkStop();
}
示例5: stop
virtual void stop() override
{
if (!isLocal)
{
barrier->wait(false);
sorter->stopMerge();
}
{
CriticalBlock b(joinHelperCrit);
joinhelper.clear();
}
if (strm)
{
strm->stop();
strm.clear();
}
PARENT::stop();
}
示例6: stop
void stop()
{
if (!stopped)
{
abortSoon = true;
stopped = true;
doStop();
}
input.clear();
}
示例7: stop
virtual void stop()
{
if (input)
{
stopInput(input);
input = NULL;
}
if(!isLocal)
{
barrier->wait(false);
sorter->stopMerge();
}
{
CriticalBlock b(joinHelperCrit);
joinhelper.clear();
}
strm->stop();
strm.clear();
dataLinkStop();
}
示例8: write
offset_t write(IRowStream *input)
{
StringBuffer tempname;
GetTempName(tempname,"srtmrg",false);
dataFile.setown(createIFile(tempname.str()));
Owned<IExtRowWriter> output = createRowWriter(dataFile, rowIf);
bool overflowed = false;
ActPrintLog(&activity, "Local Overflow Merge start");
unsigned ret=0;
loop
{
const void *_row = input->nextRow();
if (!_row)
break;
ret++;
OwnedConstThorRow row = _row;
offset_t start = output->getPosition();
output->putRow(row.getLink());
idx++;
if (idx==interval)
{
idx = 0;
if (!sampleRows.append(row.getClear()))
{
// JCSMORE used to check if 'isFull()' here, but only to warn
// I think this is bad news, if has run out of room here...
// should at least warn in workunit I suspect
overflowsize = output->getPosition();
if (!overflowed)
{
WARNLOG("Sample buffer full");
overflowed = true;
}
}
}
writeidxofs(start);
}
output->flush();
offset_t end = output->getPosition();
output.clear();
writeidxofs(end);
if (idxFileIO)
{
idxFileStream->flush();
idxFileStream.clear();
idxFileIO.clear();
}
if (overflowed)
WARNLOG("Overflowed by %"I64F"d", overflowsize);
ActPrintLog(&activity, "Local Overflow Merge done: overflow file '%s', size = %"I64F"d", dataFile->queryFilename(), dataFile->size());
return end;
}
示例9: poll
bool poll()
{
if (stopped||!running()) {
PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Stopping");
if (server) {
server->stop();
server.clear();
}
return false;
}
return true;
}
示例10: testMultiCluster
void testMultiCluster()
{
Owned<IGroup> grp1 = createIGroup("192.168.51.1-5");
Owned<IGroup> grp2 = createIGroup("192.168.16.1-5");
Owned<IGroup> grp3 = createIGroup("192.168.53.1-5");
queryNamedGroupStore().add("testgrp1",grp1);
queryNamedGroupStore().add("testgrp2",grp2);
queryNamedGroupStore().add("testgrp3",grp3);
Owned<IFileDescriptor> fdesc = createFileDescriptor();
fdesc->setDefaultDir("/c$/thordata/test");
fdesc->setPartMask("testfile1._$P$_of_$N$");
fdesc->setNumParts(5);
ClusterPartDiskMapSpec mapping;
fdesc->addCluster(grp1,mapping);
fdesc->addCluster(grp2,mapping);
fdesc->addCluster(grp3,mapping);
queryDistributedFileDirectory().removeEntry("test::testfile1",UNKNOWN_USER);
Owned<IDistributedFile> file = queryDistributedFileDirectory().createNew(fdesc);
queryDistributedFileDirectory().removeEntry("test::testfile1",UNKNOWN_USER);
file->attach("test::testfile1",UNKNOWN_USER);
StringBuffer name;
unsigned i;
for (i=0;i<file->numClusters();i++)
PROGLOG("cluster[%d] = %s",i,file->getClusterName(i,name.clear()).str());
file.clear();
file.setown(queryDistributedFileDirectory().lookup("test::testfile1",UNKNOWN_USER));
for (i=0;i<file->numClusters();i++)
PROGLOG("cluster[%d] = %s",i,file->getClusterName(i,name.clear()).str());
file.clear();
file.setown(queryDistributedFileDirectory().lookup("test::[email protected]",UNKNOWN_USER));
for (i=0;i<file->numClusters();i++)
PROGLOG("cluster[%d] = %s",i,file->getClusterName(i,name.clear()).str());
file.clear();
queryDistributedFileDirectory().removePhysical("test::[email protected]",UNKNOWN_USER);
file.setown(queryDistributedFileDirectory().lookup("test::testfile1",UNKNOWN_USER));
for (i=0;i<file->numClusters();i++)
PROGLOG("cluster[%d] = %s",i,file->getClusterName(i,name.clear()).str());
}
示例11: stop
void stop()
{
try {
if (server)
server->stop();
}
catch (IException *e) {
EXCLOG(e,"dfuplus(dafilesrvstop)");
e->Release();
}
server.clear();
}
示例12: start
virtual void start() override
{
ActivityTimer s(totalCycles, timeActivities);
ActPrintLog(rolloverEnabled ? "GROUP: is global" : "GROUP: is local");
PARENT::start();
eogNext = prevEog = eof = false;
if (rolloverEnabled)
{
useRollover = !lastNode();
#ifdef _TESTING
ActPrintLog("Node number = %d, Total Nodes = %d", queryJobChannel().queryMyRank(), container.queryJob().querySlaves());
#endif
}
stream.set(inputStream);
startLastGroup = getDataLinkGlobalCount();
next.setown(getNext());
if (rolloverEnabled && !firstNode()) // 1st node can have nothing to send
{
Owned<IThorRowCollector> collector = createThorRowCollector(*this, this, NULL, stableSort_none, rc_mixed, SPILL_PRIORITY_SPILLABLE_STREAM);
Owned<IRowWriter> writer = collector->getWriter();
if (next)
{
ActPrintLog("GROUP: Sending first group to previous node(%d)", queryJobChannel().queryMyRank()-1);
for (;;)
{
writer->putRow(next.getLink());
if (abortSoon)
break; //always send group even when aborting
OwnedConstThorRow next2 = getNext();
if (!next2)
{
eof = true;
break;
}
else if (!helper->isSameGroup(next2, next))
{
next.setown(next2.getClear());
break;
}
next.setown(next2.getClear());
}
}
writer.clear();
ActPrintLog("GROUP: %" RCPF "d records to send", collector->numRows());
Owned<IRowStream> strm = collector->getStream();
rowServer.setown(createRowServer(this, strm, queryJobChannel().queryJobComm(), mpTag));
}
}
示例13: _wuid
static IConstWorkUnit * getWorkunit(ICodeContext * ctx, const char * wuid)
{
StringBuffer _wuid(wuid);
if (!_wuid.length())
return NULL;
wuid = _wuid.toUpperCase().str();
Owned<IWorkUnitFactory> wuFactory = getWorkunitFactory(ctx);
Owned<IConstWorkUnit> wu = wuFactory->openWorkUnit(wuid);
if (wu)
{
if (!checkScopeAuthorized(ctx->queryUserDescriptor(), wu->queryWuScope()))
wu.clear();
}
return wu.getClear();
}
示例14: stop
void stop()
{
if (output) {
output->stop();
output.clear();
}
ActPrintLog("SORT waiting barrier.2");
barrier->wait(false);
ActPrintLog("SORT barrier.2 raised");
if (input)
stopInput(input);
sorter->stopMerge();
ActPrintLog("SORT waiting for merge");
dataLinkStop();
}
示例15: main
int main(int argc, const char *argv[])
{
InitModuleObjects();
EnableSEHtoExceptionMapping();
NoQuickEditSection xxx;
Owned<IFile> file = createIFile("dfuserver.xml");
if (file->exists())
globals.setown(createPTreeFromXMLFile("dfuserver.xml", ipt_caseInsensitive));
else
globals.setown(readOldIni());
for (unsigned i=1;i<(unsigned)argc;i++) {
const char *arg = argv[i];
StringBuffer prop("@");
StringBuffer val;
while (*arg && *arg != '=')
prop.append(*arg++);
if (*arg) {
arg++;
while (isspace(*arg))
arg++;
val.append(arg);
prop.clip();
val.clip();
if (prop.length()>1)
globals->setProp(prop.str(), val.str());
}
}
StringBuffer daliServer;
StringBuffer queue;
if (!globals->getProp("@DALISERVERS", daliServer)||!globals->getProp("@QUEUE", queue)) {
usage();
globals.clear();
releaseAtoms();
return 1;
}
Owned<IFile> sentinelFile;
bool stop = globals->getPropInt("@STOP",0)!=0;
if (!stop) {
sentinelFile.setown(createSentinelTarget());
removeSentinelFile(sentinelFile);
StringBuffer logname;
StringBuffer logdir;
if (!getConfigurationDirectory(globals->queryPropTree("Directories"),"log","dfuserver",globals->queryProp("@name"),logdir))
globals->getProp("@LOG_DIR", logdir);
if (logdir.length() && recursiveCreateDirectory(logdir.str()))
logname.append(logdir);
else
appendCurrentDirectory(logname, true);
if (logname.length() && logname.charAt(logname.length()-1) != PATHSEPCHAR)
logname.append(PATHSEPCHAR);
logname.append("dfuserver");
StringBuffer aliasLogName(logname);
aliasLogName.append(".log");
fileMsgHandler = getRollingFileLogMsgHandler(logname.str(), ".log", MSGFIELD_STANDARD, false, true, NULL, aliasLogName.str());
queryLogMsgManager()->addMonitorOwn(fileMsgHandler, getCategoryLogMsgFilter(MSGAUD_all, MSGCLS_all, 1000));
}
StringBuffer ftslogdir;
if (getConfigurationDirectory(globals->queryPropTree("Directories"),"log","ftslave",globals->queryProp("@name"),ftslogdir)) // NB instance deliberately dfuserver's
setFtSlaveLogDir(ftslogdir.str());
setRemoteSpawnSSH(
globals->queryProp("SSH/@SSHidentityfile"),
globals->queryProp("SSH/@SSHusername"),
globals->queryProp("SSH/@SSHpassword"),
globals->getPropInt("SSH/@SSHtimeout",0),
globals->getPropInt("SSH/@SSHretries",3),
"run_");
bool enableSNMP = globals->getPropInt("@enableSNMP")!=0;
CSDSServerStatus *serverstatus=NULL;
Owned<IReplicateServer> replserver;
try {
Owned<IGroup> serverGroup = createIGroup(daliServer.str(),DALI_SERVER_PORT);
initClientProcess(serverGroup, DCR_DfuServer, 0, NULL, NULL, stop?(1000*30):MP_WAIT_FOREVER);
setPasswordsFromSDS();
if(!stop)
{
if (globals->getPropBool("@enableSysLog",true))
UseSysLogForOperatorMessages();
serverstatus = new CSDSServerStatus("DFUserver");
setDaliServixSocketCaching(true); // speeds up lixux operations
startLogMsgParentReceiver(); // for auditing
connectLogMsgManagerToDali();
engine.setown(createDFUengine());
addAbortHandler(exitDFUserver);
}
const char *q = queue.str();
loop {
StringBuffer subq;
const char *comma = strchr(q,',');
if (comma)
subq.append(comma-q,q);
else
//.........这里部分代码省略.........