mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
1dda903834
|
@ -514,7 +514,7 @@ void Index::batchInsert(
|
||||||
transaction::Methods* trx,
|
transaction::Methods* trx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&
|
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&
|
||||||
documents,
|
documents,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
for (auto const& it : documents) {
|
for (auto const& it : documents) {
|
||||||
int status = insert(trx, it.first, it.second, false);
|
int status = insert(trx, it.first, it.second, false);
|
||||||
if (status != TRI_ERROR_NO_ERROR) {
|
if (status != TRI_ERROR_NO_ERROR) {
|
||||||
|
|
|
@ -250,7 +250,7 @@ class Index {
|
||||||
virtual void batchInsert(
|
virtual void batchInsert(
|
||||||
transaction::Methods*,
|
transaction::Methods*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
||||||
arangodb::basics::LocalTaskQueue* queue = nullptr);
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue);
|
||||||
|
|
||||||
virtual int unload() = 0;
|
virtual int unload() = 0;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace {
|
||||||
class MMFilesIndexFillerTask : public basics::LocalTask {
|
class MMFilesIndexFillerTask : public basics::LocalTask {
|
||||||
public:
|
public:
|
||||||
MMFilesIndexFillerTask(
|
MMFilesIndexFillerTask(
|
||||||
basics::LocalTaskQueue* queue, transaction::Methods* trx, Index* idx,
|
std::shared_ptr<basics::LocalTaskQueue> queue, transaction::Methods* trx, Index* idx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents)
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents)
|
||||||
: LocalTask(queue), _trx(trx), _idx(idx), _documents(documents) {}
|
: LocalTask(queue), _trx(trx), _idx(idx), _documents(documents) {}
|
||||||
|
|
||||||
|
@ -1464,7 +1464,7 @@ bool MMFilesCollection::openIndex(VPackSlice const& description,
|
||||||
|
|
||||||
/// @brief initializes an index with a set of existing documents
|
/// @brief initializes an index with a set of existing documents
|
||||||
void MMFilesCollection::fillIndex(
|
void MMFilesCollection::fillIndex(
|
||||||
arangodb::basics::LocalTaskQueue* queue, transaction::Methods* trx,
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue, transaction::Methods* trx,
|
||||||
arangodb::Index* idx,
|
arangodb::Index* idx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
||||||
bool skipPersistent) {
|
bool skipPersistent) {
|
||||||
|
@ -1554,13 +1554,14 @@ int MMFilesCollection::fillIndexes(
|
||||||
TRI_ASSERT(SchedulerFeature::SCHEDULER != nullptr);
|
TRI_ASSERT(SchedulerFeature::SCHEDULER != nullptr);
|
||||||
auto ioService = SchedulerFeature::SCHEDULER->ioService();
|
auto ioService = SchedulerFeature::SCHEDULER->ioService();
|
||||||
TRI_ASSERT(ioService != nullptr);
|
TRI_ASSERT(ioService != nullptr);
|
||||||
arangodb::basics::LocalTaskQueue queue(ioService);
|
|
||||||
|
|
||||||
PerformanceLogScope logScope(
|
PerformanceLogScope logScope(
|
||||||
std::string("fill-indexes-document-collection { collection: ") +
|
std::string("fill-indexes-document-collection { collection: ") +
|
||||||
_logicalCollection->vocbase()->name() + "/" + _logicalCollection->name() +
|
_logicalCollection->vocbase()->name() + "/" + _logicalCollection->name() +
|
||||||
" }, indexes: " + std::to_string(n - 1));
|
" }, indexes: " + std::to_string(n - 1));
|
||||||
|
|
||||||
|
auto queue = std::make_shared<arangodb::basics::LocalTaskQueue>(ioService);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TRI_ASSERT(!ServerState::instance()->isCoordinator());
|
TRI_ASSERT(!ServerState::instance()->isCoordinator());
|
||||||
|
|
||||||
|
@ -1594,12 +1595,12 @@ int MMFilesCollection::fillIndexes(
|
||||||
if (idx->type() == Index::IndexType::TRI_IDX_TYPE_PRIMARY_INDEX) {
|
if (idx->type() == Index::IndexType::TRI_IDX_TYPE_PRIMARY_INDEX) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fillIndex(&queue, trx, idx.get(), documents, skipPersistent);
|
fillIndex(queue, trx, idx.get(), documents, skipPersistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
queue.dispatchAndWait();
|
queue->dispatchAndWait();
|
||||||
|
|
||||||
if (queue.status() != TRI_ERROR_NO_ERROR) {
|
if (queue->status() != TRI_ERROR_NO_ERROR) {
|
||||||
rollbackAll();
|
rollbackAll();
|
||||||
rolledBack = true;
|
rolledBack = true;
|
||||||
}
|
}
|
||||||
|
@ -1626,7 +1627,7 @@ int MMFilesCollection::fillIndexes(
|
||||||
if (documents.size() == blockSize) {
|
if (documents.size() == blockSize) {
|
||||||
// now actually fill the secondary indexes
|
// now actually fill the secondary indexes
|
||||||
insertInAllIndexes();
|
insertInAllIndexes();
|
||||||
if (queue.status() != TRI_ERROR_NO_ERROR) {
|
if (queue->status() != TRI_ERROR_NO_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
documents.clear();
|
documents.clear();
|
||||||
|
@ -1636,33 +1637,33 @@ int MMFilesCollection::fillIndexes(
|
||||||
}
|
}
|
||||||
|
|
||||||
// process the remainder of the documents
|
// process the remainder of the documents
|
||||||
if (queue.status() == TRI_ERROR_NO_ERROR && !documents.empty()) {
|
if (queue->status() == TRI_ERROR_NO_ERROR && !documents.empty()) {
|
||||||
insertInAllIndexes();
|
insertInAllIndexes();
|
||||||
}
|
}
|
||||||
} catch (arangodb::basics::Exception const& ex) {
|
} catch (arangodb::basics::Exception const& ex) {
|
||||||
queue.setStatus(ex.code());
|
queue->setStatus(ex.code());
|
||||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
||||||
<< "caught exception while filling indexes: " << ex.what();
|
<< "caught exception while filling indexes: " << ex.what();
|
||||||
} catch (std::bad_alloc const&) {
|
} catch (std::bad_alloc const&) {
|
||||||
queue.setStatus(TRI_ERROR_OUT_OF_MEMORY);
|
queue->setStatus(TRI_ERROR_OUT_OF_MEMORY);
|
||||||
} catch (std::exception const& ex) {
|
} catch (std::exception const& ex) {
|
||||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
||||||
<< "caught exception while filling indexes: " << ex.what();
|
<< "caught exception while filling indexes: " << ex.what();
|
||||||
queue.setStatus(TRI_ERROR_INTERNAL);
|
queue->setStatus(TRI_ERROR_INTERNAL);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
||||||
<< "caught unknown exception while filling indexes";
|
<< "caught unknown exception while filling indexes";
|
||||||
queue.setStatus(TRI_ERROR_INTERNAL);
|
queue->setStatus(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queue.status() != TRI_ERROR_NO_ERROR && !rolledBack) {
|
if (queue->status() != TRI_ERROR_NO_ERROR && !rolledBack) {
|
||||||
try {
|
try {
|
||||||
rollbackAll();
|
rollbackAll();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return queue.status();
|
return queue->status();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief opens an existing collection
|
/// @brief opens an existing collection
|
||||||
|
|
|
@ -398,7 +398,7 @@ class MMFilesCollection final : public PhysicalCollection {
|
||||||
bool openIndex(VPackSlice const& description, transaction::Methods* trx);
|
bool openIndex(VPackSlice const& description, transaction::Methods* trx);
|
||||||
|
|
||||||
/// @brief initializes an index with all existing documents
|
/// @brief initializes an index with all existing documents
|
||||||
void fillIndex(basics::LocalTaskQueue*, transaction::Methods*, Index*,
|
void fillIndex(std::shared_ptr<basics::LocalTaskQueue>, transaction::Methods*, Index*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const&,
|
||||||
bool);
|
bool);
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ int MMFilesEdgeIndex::remove(transaction::Methods* trx,
|
||||||
void MMFilesEdgeIndex::batchInsert(
|
void MMFilesEdgeIndex::batchInsert(
|
||||||
transaction::Methods* trx,
|
transaction::Methods* trx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
if (documents.empty()) {
|
if (documents.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ class MMFilesEdgeIndex final : public Index {
|
||||||
|
|
||||||
void batchInsert(transaction::Methods*,
|
void batchInsert(transaction::Methods*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const&,
|
||||||
arangodb::basics::LocalTaskQueue*) override;
|
std::shared_ptr<arangodb::basics::LocalTaskQueue>) override;
|
||||||
|
|
||||||
int unload() override;
|
int unload() override;
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,7 @@ int MMFilesHashIndex::remove(transaction::Methods* trx,
|
||||||
void MMFilesHashIndex::batchInsert(
|
void MMFilesHashIndex::batchInsert(
|
||||||
transaction::Methods* trx,
|
transaction::Methods* trx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
TRI_ASSERT(queue != nullptr);
|
TRI_ASSERT(queue != nullptr);
|
||||||
if (_unique) {
|
if (_unique) {
|
||||||
batchInsertUnique(trx, documents, queue);
|
batchInsertUnique(trx, documents, queue);
|
||||||
|
@ -760,7 +760,7 @@ int MMFilesHashIndex::insertUnique(transaction::Methods* trx,
|
||||||
void MMFilesHashIndex::batchInsertUnique(
|
void MMFilesHashIndex::batchInsertUnique(
|
||||||
transaction::Methods* trx,
|
transaction::Methods* trx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
TRI_ASSERT(queue != nullptr);
|
TRI_ASSERT(queue != nullptr);
|
||||||
std::shared_ptr<std::vector<MMFilesHashIndexElement*>> elements;
|
std::shared_ptr<std::vector<MMFilesHashIndexElement*>> elements;
|
||||||
elements.reset(new std::vector<MMFilesHashIndexElement*>());
|
elements.reset(new std::vector<MMFilesHashIndexElement*>());
|
||||||
|
@ -880,7 +880,7 @@ int MMFilesHashIndex::insertMulti(transaction::Methods* trx,
|
||||||
void MMFilesHashIndex::batchInsertMulti(
|
void MMFilesHashIndex::batchInsertMulti(
|
||||||
transaction::Methods* trx,
|
transaction::Methods* trx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
TRI_ASSERT(queue != nullptr);
|
TRI_ASSERT(queue != nullptr);
|
||||||
std::shared_ptr<std::vector<MMFilesHashIndexElement*>> elements;
|
std::shared_ptr<std::vector<MMFilesHashIndexElement*>> elements;
|
||||||
elements.reset(new std::vector<MMFilesHashIndexElement*>());
|
elements.reset(new std::vector<MMFilesHashIndexElement*>());
|
||||||
|
|
|
@ -173,7 +173,7 @@ class MMFilesHashIndex final : public MMFilesPathBasedIndex {
|
||||||
void batchInsert(
|
void batchInsert(
|
||||||
transaction::Methods*,
|
transaction::Methods*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
||||||
arangodb::basics::LocalTaskQueue* queue = nullptr) override;
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) override;
|
||||||
|
|
||||||
int unload() override;
|
int unload() override;
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class MMFilesHashIndex final : public MMFilesPathBasedIndex {
|
||||||
void batchInsertUnique(
|
void batchInsertUnique(
|
||||||
transaction::Methods*,
|
transaction::Methods*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
||||||
arangodb::basics::LocalTaskQueue* queue = nullptr);
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue);
|
||||||
|
|
||||||
int insertMulti(transaction::Methods*, TRI_voc_rid_t,
|
int insertMulti(transaction::Methods*, TRI_voc_rid_t,
|
||||||
arangodb::velocypack::Slice const&, bool isRollback);
|
arangodb::velocypack::Slice const&, bool isRollback);
|
||||||
|
@ -213,7 +213,7 @@ class MMFilesHashIndex final : public MMFilesPathBasedIndex {
|
||||||
void batchInsertMulti(
|
void batchInsertMulti(
|
||||||
transaction::Methods*,
|
transaction::Methods*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
||||||
arangodb::basics::LocalTaskQueue* queue = nullptr);
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue);
|
||||||
|
|
||||||
int removeUniqueElement(transaction::Methods*, MMFilesHashIndexElement*,
|
int removeUniqueElement(transaction::Methods*, MMFilesHashIndexElement*,
|
||||||
bool);
|
bool);
|
||||||
|
|
|
@ -251,7 +251,7 @@ int RocksDBEdgeIndex::remove(transaction::Methods* trx,
|
||||||
void RocksDBEdgeIndex::batchInsert(
|
void RocksDBEdgeIndex::batchInsert(
|
||||||
transaction::Methods* trx,
|
transaction::Methods* trx,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
// acquire rocksdb transaction
|
// acquire rocksdb transaction
|
||||||
RocksDBTransactionState* state = rocksutils::toRocksTransactionState(trx);
|
RocksDBTransactionState* state = rocksutils::toRocksTransactionState(trx);
|
||||||
rocksdb::Transaction* rtrx = state->rocksTransaction();
|
rocksdb::Transaction* rtrx = state->rocksTransaction();
|
||||||
|
|
|
@ -111,7 +111,7 @@ class RocksDBEdgeIndex final : public RocksDBIndex {
|
||||||
void batchInsert(
|
void batchInsert(
|
||||||
transaction::Methods*,
|
transaction::Methods*,
|
||||||
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
std::vector<std::pair<TRI_voc_rid_t, arangodb::velocypack::Slice>> const&,
|
||||||
arangodb::basics::LocalTaskQueue* queue = nullptr) override;
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) override;
|
||||||
|
|
||||||
int drop() override;
|
int drop() override;
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ class AssocMulti {
|
||||||
void batchInsert(std::function<void*()> const& contextCreator,
|
void batchInsert(std::function<void*()> const& contextCreator,
|
||||||
std::function<void(void*)> const& contextDestroyer,
|
std::function<void(void*)> const& contextDestroyer,
|
||||||
std::shared_ptr<std::vector<Element> const> data,
|
std::shared_ptr<std::vector<Element> const> data,
|
||||||
LocalTaskQueue* queue) {
|
std::shared_ptr<LocalTaskQueue> queue) {
|
||||||
if (data->empty()) {
|
if (data->empty()) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -94,7 +94,7 @@ class MultiInserterTask : public LocalTask {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MultiInserterTask(
|
MultiInserterTask(
|
||||||
LocalTaskQueue* queue, std::function<void(void*)> contextDestroyer,
|
std::shared_ptr<LocalTaskQueue> queue, std::function<void(void*)> contextDestroyer,
|
||||||
std::vector<Bucket>* buckets,
|
std::vector<Bucket>* buckets,
|
||||||
std::function<Element(void*, Element const&, uint64_t, Bucket&,
|
std::function<Element(void*, Element const&, uint64_t, Bucket&,
|
||||||
bool const, bool const)>
|
bool const, bool const)>
|
||||||
|
@ -168,7 +168,7 @@ class MultiPartitionerTask : public LocalTask {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MultiPartitionerTask(
|
MultiPartitionerTask(
|
||||||
LocalTaskQueue* queue,
|
std::shared_ptr<LocalTaskQueue> queue,
|
||||||
std::function<uint64_t(void*, Element const&, bool)> hashElement,
|
std::function<uint64_t(void*, Element const&, bool)> hashElement,
|
||||||
std::function<void(void*)> const& contextDestroyer,
|
std::function<void(void*)> const& contextDestroyer,
|
||||||
std::shared_ptr<std::vector<Element> const> data, size_t lower,
|
std::shared_ptr<std::vector<Element> const> data, size_t lower,
|
||||||
|
|
|
@ -553,7 +553,7 @@ class AssocUnique {
|
||||||
void batchInsert(std::function<void*()> const& contextCreator,
|
void batchInsert(std::function<void*()> const& contextCreator,
|
||||||
std::function<void(void*)> const& contextDestroyer,
|
std::function<void(void*)> const& contextDestroyer,
|
||||||
std::shared_ptr<std::vector<Element> const> data,
|
std::shared_ptr<std::vector<Element> const> data,
|
||||||
arangodb::basics::LocalTaskQueue* queue) {
|
std::shared_ptr<arangodb::basics::LocalTaskQueue> queue) {
|
||||||
TRI_ASSERT(queue != nullptr);
|
TRI_ASSERT(queue != nullptr);
|
||||||
if (data->empty()) {
|
if (data->empty()) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
|
|
|
@ -70,7 +70,7 @@ class UniqueInserterTask : public LocalTask {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UniqueInserterTask(
|
UniqueInserterTask(
|
||||||
LocalTaskQueue* queue, std::function<void(void*)> contextDestroyer,
|
std::shared_ptr<LocalTaskQueue> queue, std::function<void(void*)> contextDestroyer,
|
||||||
std::vector<Bucket>* buckets,
|
std::vector<Bucket>* buckets,
|
||||||
std::function<int(void*, Element const&, Bucket&, uint64_t)> doInsert,
|
std::function<int(void*, Element const&, Bucket&, uint64_t)> doInsert,
|
||||||
std::function<bool(void*, Bucket&, uint64_t)> checkResize, size_t i,
|
std::function<bool(void*, Bucket&, uint64_t)> checkResize, size_t i,
|
||||||
|
@ -140,7 +140,7 @@ class UniquePartitionerTask : public LocalTask {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UniquePartitionerTask(
|
UniquePartitionerTask(
|
||||||
LocalTaskQueue* queue,
|
std::shared_ptr<LocalTaskQueue> queue,
|
||||||
std::function<uint64_t(void*, Element const&)> hashElement,
|
std::function<uint64_t(void*, Element const&)> hashElement,
|
||||||
std::function<void(void*)> const& contextDestroyer,
|
std::function<void(void*)> const& contextDestroyer,
|
||||||
std::shared_ptr<std::vector<Element> const> data, size_t lower,
|
std::shared_ptr<std::vector<Element> const> data, size_t lower,
|
||||||
|
|
|
@ -34,7 +34,7 @@ using namespace arangodb::basics;
|
||||||
/// @brief create a task tied to the specified queue
|
/// @brief create a task tied to the specified queue
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LocalTask::LocalTask(LocalTaskQueue* queue) : _queue(queue) {}
|
LocalTask::LocalTask(std::shared_ptr<LocalTaskQueue> queue) : _queue(queue) {}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief dispatch this task to the underlying io_service
|
/// @brief dispatch this task to the underlying io_service
|
||||||
|
@ -58,7 +58,7 @@ void LocalTask::dispatch() {
|
||||||
/// @brief create a callback task tied to the specified queue
|
/// @brief create a callback task tied to the specified queue
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LocalCallbackTask::LocalCallbackTask(LocalTaskQueue* queue,
|
LocalCallbackTask::LocalCallbackTask(std::shared_ptr<LocalTaskQueue> queue,
|
||||||
std::function<void()> cb)
|
std::function<void()> cb)
|
||||||
: _queue(queue), _cb(cb) {}
|
: _queue(queue), _cb(cb) {}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LocalTask : public std::enable_shared_from_this<LocalTask> {
|
||||||
LocalTask(LocalTask const&) = delete;
|
LocalTask(LocalTask const&) = delete;
|
||||||
LocalTask& operator=(LocalTask const&) = delete;
|
LocalTask& operator=(LocalTask const&) = delete;
|
||||||
|
|
||||||
explicit LocalTask(LocalTaskQueue* queue);
|
explicit LocalTask(std::shared_ptr<LocalTaskQueue> queue);
|
||||||
virtual ~LocalTask() {}
|
virtual ~LocalTask() {}
|
||||||
|
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
|
@ -54,7 +54,7 @@ class LocalTask : public std::enable_shared_from_this<LocalTask> {
|
||||||
/// @brief the underlying queue
|
/// @brief the underlying queue
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LocalTaskQueue* _queue;
|
std::shared_ptr<LocalTaskQueue> _queue;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalCallbackTask
|
class LocalCallbackTask
|
||||||
|
@ -64,7 +64,7 @@ class LocalCallbackTask
|
||||||
LocalCallbackTask(LocalCallbackTask const&) = delete;
|
LocalCallbackTask(LocalCallbackTask const&) = delete;
|
||||||
LocalCallbackTask& operator=(LocalCallbackTask const&) = delete;
|
LocalCallbackTask& operator=(LocalCallbackTask const&) = delete;
|
||||||
|
|
||||||
LocalCallbackTask(LocalTaskQueue* queue, std::function<void()> cb);
|
LocalCallbackTask(std::shared_ptr<LocalTaskQueue> queue, std::function<void()> cb);
|
||||||
virtual ~LocalCallbackTask() {}
|
virtual ~LocalCallbackTask() {}
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
@ -75,7 +75,7 @@ class LocalCallbackTask
|
||||||
/// @brief the underlying queue
|
/// @brief the underlying queue
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LocalTaskQueue* _queue;
|
std::shared_ptr<LocalTaskQueue> _queue;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief the callback executed by run() (any exceptions will be caught and
|
/// @brief the callback executed by run() (any exceptions will be caught and
|
||||||
|
|
Loading…
Reference in New Issue