• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MojAllocCheck函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MojAllocCheck函数的典型用法代码示例。如果您正苦于以下问题:C++ MojAllocCheck函数的具体用法?C++ MojAllocCheck怎么用?C++ MojAllocCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MojAllocCheck函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: engine

MojErr MojDbQuotaTest::testErrors()
{
#ifdef MOJ_USE_BDB
	MojRefCountedPtr<MojDbStorageEngine> engine(new MojDbBerkeleyEngine());
#elif MOJ_USE_LDB
	MojRefCountedPtr<MojDbStorageEngine> engine(new MojDbLevelEngine());
#else
    MojRefCountedPtr<MojDbStorageEngine> engine;
#endif
	MojAllocCheck(engine.get());
	MojRefCountedPtr<MojDbTestStorageEngine> testEngine(new MojDbTestStorageEngine(engine.get()));
	MojAllocCheck(testEngine.get());
	MojErr err = testEngine->open(MojDbTestDir);
	MojTestErrCheck(err);

	MojDb db;
	err = db.open(MojDbTestDir, testEngine.get());
	MojTestErrCheck(err);

	// test that failed put does not affect quota
	MojInt64 quotaUsage1 = 0;
	err = getQuotaUsage(db, _T("com.foo.*"), quotaUsage1);
	MojTestErrCheck(err);
	err = testEngine->setNextError(_T("txn.commit"), MojErrDbDeadlock);
	MojTestErrCheck(err);
	err = put(db, MojTestKind3Objects[1]);
	MojTestErrExpected(err, MojErrDbDeadlock);
	MojInt64 quotaUsage2 = 0;
	err = getQuotaUsage(db, _T("com.foo.*"), quotaUsage2);
	MojTestErrCheck(err);
	MojTestAssert(quotaUsage2 == quotaUsage1);
	// test that failed putQuota has no effect
	err = testEngine->setNextError(_T("txn.commit"), MojErrDbDeadlock);
	MojTestErrCheck(err);
	MojObject obj;
	err = obj.fromJson(_T("{\"owner\":\"com.foo.boo\",\"size\":1000}"));
	MojErrCheck(err);
	err = db.putQuotas(&obj, &obj + 1);
	MojTestErrExpected(err, MojErrDbDeadlock);
	MojInt64 quotaUsage3 = 0;
	err = getQuotaUsage(db, _T("com.foo.*"), quotaUsage3);
	MojTestErrCheck(err);
	MojTestAssert(quotaUsage3 == quotaUsage1);
	// test that failed putKind has no effect
	err = testEngine->setNextError(_T("txn.commit"), MojErrDbDeadlock);
	MojTestErrCheck(err);
	err = obj.fromJson(MojTestKind3Str2);
	MojTestErrCheck(err);
	err = db.putKind(obj);
	MojTestErrExpected(err, MojErrDbDeadlock);
	MojInt64 quotaUsage4 = 0;
	err = getQuotaUsage(db, _T("com.foo.*"), quotaUsage4);
	MojTestErrCheck(err);
	MojTestAssert(quotaUsage4 == quotaUsage1);

	err = db.close();
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:rogerjstringer,项目名称:db8,代码行数:60,代码来源:MojDbQuotaTest.cpp


示例2: MojAssert

MojErr MojDbBerkeleyEngine::open(const MojChar* path)
{
	MojAssert(path);
	MojAssert(m_env.get());
	MojAssert(!m_isOpen);
	MojLogTrace(s_log);

	MojErr err;

	err = m_path.assign(path);
	MojErrCheck(err);

	// open seqence db
	bool created = false;
	m_seqDb.reset(new MojDbBerkeleyDatabase);
	MojAllocCheck(m_seqDb.get());
	err = m_seqDb->open(defs::MojEnvSeqDbName, this, created, NULL);
	MojErrCheck(err);
	// open index db
	m_indexDb.reset(new MojDbBerkeleyDatabase);
	MojAllocCheck(m_indexDb.get());
	err = m_indexDb->open(defs::MojEnvIndexDbName, this, created, NULL);
	MojErrCheck(err);
	m_isOpen = true;

	return MojErrNone;
}
开发者ID:feniksa,项目名称:indb8,代码行数:27,代码来源:MojDbBerkeleyEngine.cpp


示例3: MojAssert

MojErr MojObjectFilter::init(const StringSet& selectProps)
{
	MojAssert(m_root.get() == NULL);

	//create the root node
	m_root.reset(new Node(MojString()));
	MojAllocCheck(m_root.get());

	for (StringSet::ConstIterator i = selectProps.begin(); i != selectProps.end(); i++) {
		MojVector<MojString> parts;
		MojErr err = i->split(_T('.'), parts);
		MojErrCheck(err);

		Node* curNode = m_root.get();
		for (MojVector<MojString>::ConstIterator pi = parts.begin(); pi != parts.end(); ++pi) {
			Node* child = curNode->find(*pi);
			if (child) {
				if (child->m_children.empty()) {
					break;
				} else {
					curNode = child;
				}
			} else {
				MojAutoPtr<Node> node(new Node(*pi));
				MojAllocCheck(node.get());
				Node* nextNode = node.get();
				MojErr err = curNode->addChild(node);
				MojErrCheck(err);
				curNode = nextNode;
			}
		}
	}
	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:34,代码来源:MojObjectFilter.cpp


示例4: source

MojErr MojSignalTest::test2()
{
	// one handler fire
	MojRefCountedPtr<TestSource> source(new TestSource);
	MojAllocCheck(source.get());
	MojRefCountedPtr<TestHandler> handler1(new TestHandler);
	MojAllocCheck(handler1.get());
	source->add2Slot(handler1->m_slot2);
	MojTestAssert(handler1->refCount() == 2);
	source->fire2(200, "hello");
	MojTestAssert(handler1->m_handle2Count == 1);
	MojTestAssert(handler1->m_lastInt == 200);
	MojTestAssert(!MojStrCmp(handler1->m_lastStr, "hello"));
	MojTestAssert(handler1->refCount() == 1);
	source->fire2(200, "hello");
	MojTestAssert(handler1->m_handle2Count == 1);
	// two handlers
	MojRefCountedPtr<TestHandler> handler2(new TestHandler);
	MojAllocCheck(handler2.get());
	source->add2Slot(handler1->m_slot2);
	source->add2Slot(handler2->m_slot2);
	source->fire2(201, "hello2");
	MojTestAssert(handler1->m_lastInt == 201);
	MojTestAssert(handler2->m_lastInt == 201);
	MojTestAssert(!MojStrCmp(handler1->m_lastStr, "hello2"));
	MojTestAssert(!MojStrCmp(handler2->m_lastStr, "hello2"));
	// cancel
	source->add2Slot(handler1->m_slot2);
	source->add2Slot(handler2->m_slot2);
	MojTestAssert(source->m_numCancels == 0);
	handler1->m_slot2.cancel();
	source->fire2(202, "hello3");
	MojTestAssert(source->m_numCancels == 1);
	MojTestAssert(handler1->m_lastInt == 201);
	MojTestAssert(handler2->m_lastInt == 202);
	MojTestAssert(!MojStrCmp(handler1->m_lastStr, "hello2"));
	MojTestAssert(!MojStrCmp(handler2->m_lastStr, "hello3"));
	// cancel from callback
	source->add2Slot(handler2->m_slot2);
	source->add2Slot(handler1->m_slot2Cancel);
	source->fire2(203, "hello4");
	MojTestAssert(source->m_numCancels == 1);
	MojTestAssert(handler1->m_lastInt == 203);
	MojTestAssert(handler2->m_lastInt == 203);
	MojTestAssert(!MojStrCmp(handler1->m_lastStr, "hello4"));
	MojTestAssert(!MojStrCmp(handler2->m_lastStr, "hello4"));
	source->add2Slot(handler2->m_slot2);
	source->fire2(204, "hello5");
	MojTestAssert(handler1->m_lastInt == 203);
	MojTestAssert(handler2->m_lastInt == 204);
	MojTestAssert(!MojStrCmp(handler1->m_lastStr, "hello4"));
	MojTestAssert(!MojStrCmp(handler2->m_lastStr, "hello5"));

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:55,代码来源:MojSignalTest.cpp


示例5: LOG_TRACE

MojErr MojDbMultiExtractor::fromObject(const MojObject& obj, const MojChar* locale)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);

	MojErr err = MojDbExtractor::fromObject(obj, locale);
	MojErrCheck(err);

	// load the default config
	MojDbPropExtractor defaultExtractor;
	err = defaultExtractor.fromObject(obj, locale);
	MojErrCheck(err);

	MojObject include;
	err = obj.getRequired(IncludeKey, include);
	MojErrCheck(err);

	for (MojObject::ConstArrayIterator i = include.arrayBegin();
		 i != include.arrayEnd(); ++i) {
		MojString includeName;
		err = i->stringValue(includeName);
		MojErrCheck(err);
		MojRefCountedPtr<MojDbPropExtractor> propExtractor(new MojDbPropExtractor);
		MojAllocCheck(propExtractor.get());
		err = propExtractor->fromObjectImpl(*i, defaultExtractor, locale);
		MojErrCheck(err);
		err = m_extractors.push(propExtractor);
		MojErrCheck(err);
	}
	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:30,代码来源:MojDbExtractor.cpp


示例6: MojTestErrCheck

MojErr MojDbTextTokenizerTest::check(const MojChar* text, const MojChar* tokens)
{
	// tokenize string
	MojString textStr;
	MojErr err = textStr.assign(text);
	MojTestErrCheck(err);
	MojSet<MojDbKey> set;
	MojRefCountedPtr<MojDbTextTokenizer> tokenizer(new MojDbTextTokenizer);
	MojAllocCheck(tokenizer.get());
	err = tokenizer->init(_T("en_US"));
	MojTestErrCheck(err);
	err = tokenizer->tokenize(textStr, NULL, set);
	MojTestErrCheck(err);
	// check that tokens match
	MojObject obj;
	err = obj.fromJson(tokens);
	MojTestErrCheck(err);
	MojSize objSize = obj.size();
	MojSize setSize = set.size();
	MojTestAssert(objSize == setSize);
	for (MojObject::ConstArrayIterator i = obj.arrayBegin(); i != obj.arrayEnd(); ++i) {
		MojDbKey key;
		err = key.assign(*i);
		MojTestErrCheck(err);
		MojTestAssert(set.contains(key));
	}
	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:28,代码来源:MojDbTextTokenizerTest.cpp


示例7: MojTestErrCheck

MojErr MojDbIndexTest::assertCanAnswer(const MojChar* propsJson, const MojChar* queryJson,
		bool result, bool indexIncludeDeleted)
{
	MojObject propsObj;
	MojErr err = propsObj.fromJson(propsJson);
	MojTestErrCheck(err);
	MojObject queryObj;
	err = queryObj.fromJson(queryJson);
	MojTestErrCheck(err);

	MojDbIndex index(NULL, NULL);
	MojObject prop;
	MojSize i = 0;
	for (;;) {
		if(propsObj.at(i++, prop)) {
			err = index.addProp(prop);
			MojTestErrCheck(err);
		} else {
			break;
		}
	}
	index.incDel(indexIncludeDeleted);
	MojRefCountedPtr<MojDbStorageIndex> storageIndex(new TestIndex(false));
	MojAllocCheck(storageIndex.get());
	MojDbReq req;
	err = index.open(storageIndex.get(), (MojInt64) 0, req);
	MojTestErrCheck(err);

	MojDbQuery query;
	err = query.fromObject(queryObj);
	MojTestErrCheck(err);
	MojTestAssert(index.canAnswer(query) == result);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:35,代码来源:MojDbIndexTest.cpp


示例8: MojErrCheck

MojErr MojDbIndexTest::assertContainsText(TestIndex& ti, MojObject id, const MojChar* str)
{
	MojString strObj;
	MojErr err = strObj.assign(str);
	MojErrCheck(err);
	MojRefCountedPtr<MojDbTextCollator> collator(new MojDbTextCollator);
	MojAllocCheck(collator.get());
	err = collator->init(_T("en_US"), MojDbCollationPrimary);
	MojTestErrCheck(err);
	MojDbKey key;
	err = collator->sortKey(strObj, key);
	MojTestErrCheck(err);

	MojObjectWriter writer;
	err = id.visit(writer);
	MojTestErrCheck(err);
	const MojByte* idData = NULL;
	MojSize idSize = 0;
	err = writer.buf().data(idData, idSize);
	MojTestErrCheck(err);
	err = key.byteVec().append(idData, idData + idSize);
	MojTestErrCheck(err);
	err = assertContains(ti, id, key);
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:27,代码来源:MojDbIndexTest.cpp


示例9: index

MojErr MojDbIndexTest::tokenizeTest()
{
	MojDbIndex index(NULL, NULL);
	MojRefCountedPtr<TestIndex> storageIndex(new TestIndex(false));
	MojAllocCheck(storageIndex.get());
	TestIndex& ti = *storageIndex;

	MojErr err = indexFromObject(index,
			_T("{\"name\":\"test\",\"props\":[")
				_T("{\"name\":\"foo\",\"tokenize\":\"all\",\"collate\":\"primary\"}")
			_T("]}"));
	MojErrCheck(err);
	MojDbReq req;
	err = index.open(storageIndex.get(), (MojInt64) 0, req);
	MojTestErrCheck(err);

	err = put(index, 1, _T("{\"foo\":\"four score and seven years ago\"}"), NULL);
	MojTestErrCheck(err);
	err = assertContainsText(ti, 1, _T("four"));
	MojTestErrCheck(err);
	err = assertContainsText(ti, 1, _T("score"));
	MojTestErrCheck(err);
	MojTestAssert(ti.m_putCount == 6 && ti.m_delCount == 0 && ti.m_set.size() == 6);
	err = put(index, 1, _T("{\"foo\":\"our fathers put\"}"), _T("{\"foo\":\"four score and seven years ago\"}"));
	MojTestErrCheck(err);
	err = assertContainsText(ti, 1, _T("fathers"));
	MojTestErrCheck(err);
	MojTestAssert(ti.m_putCount == 9 && ti.m_delCount == 6 && ti.m_set.size() == 3);

	err = index.close();
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:34,代码来源:MojDbIndexTest.cpp


示例10: serviceThread

MojErr serviceThread(void*)
{
	MojErr err = MojErrNone;
	bool stop = false;

#ifdef USE_SOCKET_SERVICE
	MojEpollReactor reactor;
	MojSocketService msgService(reactor);
	err = reactor.init();
	MojErrCheck(err);
#else
	MojGmainReactor reactor;
	err = reactor.init();
	MojErrCheck(err);
	MojLunaService msgService;
#endif

	MojRefCountedPtr<MojLunaTestService> service(new MojLunaTestService(stop, msgService));
	MojAllocCheck(service.get());
	err = service->open(ServiceName);
	MojErrCheck(err);
	err = msgService.attach(reactor.impl());
	MojErrCheck(err);

	while (!stop) {
		err = msgService.dispatch();
		MojErrCatchAll(err);
	}
	err = msgService.close();
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:33,代码来源:MojLunaServiceTest.cpp


示例11: testMultiEcho

	MojErr testMultiEcho()
	{
		const MojChar* echoStr = _T("{\"hello\":\"world\"}");
		MojObject expectedResponse;
		MojErr err = formatEchoResponse(echoStr, expectedResponse);
		MojTestErrCheck(err);

		MojRefCountedPtr<MojServiceRequest> req;
		err = m_service.createRequest(req);
		MojTestErrCheck(err);

		m_pendingResponseCount+= multiResponseCount;
		MojRefCountedPtr<EchoMultiResponseHdlr> hdlr(new EchoMultiResponseHdlr(expectedResponse, m_pendingResponseCount, multiResponseCount));
		MojAllocCheck(hdlr.get());

		MojObject payload;
		err = payload.fromJson(echoStr);
		MojTestErrCheck(err);
		err = req->send(hdlr->m_slot, ServiceName, _T("multiecho"), payload, MojServiceRequest::Unlimited);
		MojTestErrCheck(err);

		err = receiveResponses();
		MojTestErrCheck(err);

		return MojErrNone;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:26,代码来源:MojLunaServiceTest.cpp


示例12: MojAssert

MojErr MojService::CategoryHandler::addMethod(const MojChar* methodName, Callback callback, bool pub, const MojChar* schemaJson)
{
	MojAssert(methodName && callback);

	MojString str;
	MojErr err = str.assign(methodName);
	MojErrCheck(err);
	MojRefCountedPtr<MojSchema> schema;
	if (schemaJson) {
		MojObject schemaObj;
		err = schemaObj.fromJson(schemaJson);
		MojErrCheck(err);

		// add implicit $activity property
		MojObject properties;
		schemaObj.get(MojSchema::PropertiesKey, properties);
		MojObject activityProp;
		err = activityProp.putBool(MojSchema::OptionalKey, true);
		MojErrCheck(err);
		err = properties.put(_T("$activity"), activityProp);
		MojErrCheck(err);
		err = schemaObj.put(MojSchema::PropertiesKey, properties);
		MojErrCheck(err);

		schema.reset(new MojSchema);
		MojAllocCheck(schema.get());
		err = schema->fromObject(schemaObj);
		MojErrCheck(err);
	}
	MojAssert(!m_callbackMap.contains(str));
	err = m_callbackMap.put(str, CallbackInfo(callback, schema.get(), pub));
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:35,代码来源:MojService.cpp


示例13: MojLogTrace

MojErr MojDbKind::configureRevSets(const MojObject& obj)
{
	MojLogTrace(s_log);

	m_revSets.clear();
	MojSet<MojString> setNames;
	MojObject array;
	if (obj.get(RevisionSetsKey, array)) {
		MojObject::ConstArrayIterator end = array.arrayEnd();
		for (MojObject::ConstArrayIterator i = array.arrayBegin(); i != end; ++i) {
			MojRefCountedPtr<MojDbRevisionSet> set(new MojDbRevisionSet());
			MojAllocCheck(set.get());

			MojErr err = set->fromObject(*i);
			MojErrCheck(err);
			if (setNames.contains(set->name())) {
				MojErrThrowMsg(MojErrDbInvalidRevisionSet, _T("db: cannot repeat revSet name: '%s'"), set->name().data());
			}
			err = setNames.put(set->name());
			MojErrCheck(err);
			err = m_revSets.push(set);
			MojErrCheck(err);
		}
	}
	return MojErrNone;
}
开发者ID:webOS101,项目名称:db8,代码行数:26,代码来源:MojDbKind.cpp


示例14: MojDbLevelEngine

MojErr MojDbLevelFactory::create(MojRefCountedPtr<MojDbStorageEngine>& engineOut)
{
	engineOut.reset(new MojDbLevelEngine());
	MojAllocCheck(engineOut.get());

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:7,代码来源:MojDbLevelFactory.cpp


示例15: MojErrCheck

MojErr MojDbSearchCursor::loadObjects(const ObjectSet& ids)
{
    MojInt32 warns = 0;
    for (ObjectSet::ConstIterator i = ids.begin(); i != ids.end(); ++i) {
        // get item by id
        MojObject obj;
        MojDbStorageItem* item = NULL;
        bool found = false;
        MojErr err = m_storageQuery->getById(*i, item, found);
        if (err == MojErrInternalIndexOnFind) {
            warns++;
            continue;
        }

        MojErrCheck(err);
        if (found) {
            // get object from item
            err = item->toObject(obj, *m_kindEngine);
            MojErrCheck(err);
            // filter results
            if (m_queryFilter.get() && !m_queryFilter->test(obj))
                continue;
            // create object item
            MojRefCountedPtr<MojDbObjectItem> item(new MojDbObjectItem(obj));
            MojAllocCheck(item.get());
            // add to vec
            err = m_items.push(item);
            MojErrCheck(err);
        }
    }
    if (warns > 0)
        MojLogWarning(MojDb::s_log, _T("Search warnings: %d \n"), warns);
    return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:34,代码来源:MojDbSearchCursor.cpp


示例16: MojAssert

MojErr MojDbServiceHandler::handleWatch(MojServiceMessage* msg, MojObject& payload, MojDbReq& req)
{
	MojAssert(msg);
	MojLogTrace(s_log);

	MojObject queryObj;
	MojErr err = payload.getRequired(MojDbServiceDefs::QueryKey, queryObj);
	MojErrCheck(err);
	
	MojRefCountedPtr<Watcher> watcher(new Watcher(msg));
	MojAllocCheck(watcher.get());

	MojDbQuery query;
	err = query.fromObject(queryObj);
	MojErrCheck(err);
	bool fired = false;
	MojDbCursor cursor;
	err = m_db.watch(query, cursor, watcher->m_watchSlot, fired, req);
	MojErrCheck(err);

	MojLogInfo(s_log, _T("handleWatch: %s, err: (%d); sender= %s;\n fired=%d; \n"),
				msg->method(), (int)err, msg->senderName(), (int)fired);

	if (!fired) {
		err = msg->replySuccess();
		MojErrCheck(err);
	}

	err = cursor.close();
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:33,代码来源:MojDbServiceHandler.cpp


示例17: MojLogTrace

MojErr MojDb::watch(const MojDbQuery& query, MojDbCursor& cursor, WatchSignal::SlotRef watchHandler, bool& firedOut, MojDbReqRef req)
{
	MojLogTrace(s_log);

	firedOut = false;

	MojErr err = beginReq(req);
	MojErrCheck(err);

	MojRefCountedPtr<MojDbWatcher> watcher(new MojDbWatcher(watchHandler));
	MojAllocCheck(watcher.get());

	MojDbQuery limitedQuery = query;
	limitedQuery.limit(1);
	err = findImpl(limitedQuery, cursor, watcher.get(), req, OpRead);
	MojErrCheck(err);

	MojDbStorageItem* item = NULL;
	bool found = false;
	cursor.verifymode(false);
	err = cursor.get(item, found);
	MojErrCheck(err);

	if (found) {
       const MojDbKey& key = cursor.storageQuery()->endKey();
       err = watcher->fire(key);
       MojErrCheck(err);
       firedOut = true;
	}

	err = req->end(false);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:35,代码来源:MojDb.cpp


示例18: LOG_TRACE

MojErr MojDbIndex::find(MojDbCursor& cursor, MojDbWatcher* watcher, MojDbReq& req)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
	MojAssert(isOpen());

	MojAutoPtr<MojDbQueryPlan> plan(new MojDbQueryPlan(*m_kindEngine));
	MojAllocCheck(plan.get());
	MojErr err = plan->init(cursor.query(), *this);
	MojErrCheck(err);
	if (watcher) {
		// we have to add the watch before beginning the txn or we may miss events
		MojAssert(cursor.txn() == NULL);
		err = addWatch(*plan, cursor, watcher, req);
		MojErrCheck(err);
	}
	if (!cursor.txn()) {
		MojDbStorageTxn* txn = req.txn();
		bool cursorOwnsTxn = !(req.batch() || txn);
		if (txn) {
			cursor.txn(txn, cursorOwnsTxn);
		} else {
			MojRefCountedPtr<MojDbStorageTxn> localTxn;
			err = m_collection->beginTxn(localTxn);
			MojErrCheck(err);
			cursor.txn(localTxn.get(), cursorOwnsTxn);
			req.txn(localTxn.get());
		}
	}
	cursor.m_dbIndex = this;	// for debugging
	err = m_collection->find(plan, cursor.txn(), cursor.m_storageQuery);
	MojErrCheck(err);
	cursor.m_watcher = watcher;
	
	return MojErrNone;
}
开发者ID:sailesharya,项目名称:db8,代码行数:35,代码来源:MojDbIndex.cpp


示例19: MojLogNotice

MojErr IMAccountValidatorApp::open()
{
	MojLogNotice(s_log, _T("%s starting..."), name().data());

	MojErr err = Base::open();
	MojErrCheck(err);

	// open service
	err = m_service.open(ServiceName);
	MojErrCheck(err);
	err = m_service.attach(m_reactor.impl());
	MojErrCheck(err);

	// create and attach service handler
	m_handler.reset(new IMAccountValidatorHandler(&m_service));
	MojAllocCheck(m_handler.get());

	err = m_handler->init(this);
	MojErrCheck(err);

	err = m_service.addCategory(MojLunaService::DefaultCategory, m_handler.get());
	MojErrCheck(err);

	MojLogNotice(s_log, _T("%s started."), name().data());

	return MojErrNone;
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:27,代码来源:IMAccountValidatorApp.cpp


示例20: LOG_TRACE

MojErr MojDbQuotaEngine::commitQuota(const MojString& owner, MojInt64 size)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
	MojAssertWriteLocked(m_db->schemaLock());

	// get or create quota object
	QuotaMap::Iterator iter;
	MojErr err = m_quotas.find(owner, iter);
	MojErrCheck(err);
	if (iter == m_quotas.end()) {
		MojRefCountedPtr<Quota> quota(new Quota(size));
		MojAllocCheck(quota.get());
		err = m_quotas.put(owner, quota);
		MojErrCheck(err);
	} else {
		iter.value()->size(size);
	}

	if (m_isOpen) {
		err = refresh();
		MojErrCheck(err);
	}

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:25,代码来源:MojDbQuotaEngine.cpp



注:本文中的MojAllocCheck函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MojAssert函数代码示例发布时间:2022-05-30
下一篇:
C++ ModuleLog函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap