mirror of https://gitee.com/bigwinds/arangodb
avoid double-copying of shared ptrs
This commit is contained in:
parent
7b924d8f33
commit
a91c54f6b3
|
@ -39,7 +39,7 @@ class AqlTransaction final : public transaction::Methods {
|
|||
/// @brief create the transaction and add all collections from the query
|
||||
/// context
|
||||
AqlTransaction(
|
||||
std::shared_ptr<transaction::Context> transactionContext,
|
||||
std::shared_ptr<transaction::Context> const& transactionContext,
|
||||
std::map<std::string, aql::Collection*> const* collections,
|
||||
bool isMainTransaction)
|
||||
: transaction::Methods(transactionContext),
|
||||
|
|
|
@ -538,7 +538,7 @@ bool transaction::Methods::findIndexHandleForAndNode(
|
|||
}
|
||||
|
||||
transaction::Methods::Methods(
|
||||
std::shared_ptr<transaction::Context> transactionContext)
|
||||
std::shared_ptr<transaction::Context> const& transactionContext)
|
||||
: _state(nullptr),
|
||||
_transactionContext(transactionContext),
|
||||
_transactionContextPtr(transactionContext.get()) {
|
||||
|
|
|
@ -103,8 +103,7 @@ class Methods {
|
|||
bool operator!=(IndexHandle const& other) const {
|
||||
return other._index.get() != _index.get();
|
||||
}
|
||||
explicit IndexHandle(std::shared_ptr<arangodb::Index> idx) : _index(idx) {
|
||||
}
|
||||
explicit IndexHandle(std::shared_ptr<arangodb::Index> const& idx) : _index(idx) {}
|
||||
std::vector<std::vector<std::string>> fieldNames() const;
|
||||
|
||||
public:
|
||||
|
@ -125,7 +124,7 @@ class Methods {
|
|||
protected:
|
||||
|
||||
/// @brief create the transaction
|
||||
explicit Methods(std::shared_ptr<transaction::Context> transactionContext);
|
||||
explicit Methods(std::shared_ptr<transaction::Context> const& transactionContext);
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ struct OperationResult {
|
|||
code(other.errorNumber()),
|
||||
wasSynchronous(false) {}
|
||||
|
||||
OperationResult(std::shared_ptr<VPackBuffer<uint8_t>> buffer,
|
||||
std::shared_ptr<VPackCustomTypeHandler> handler,
|
||||
OperationResult(std::shared_ptr<VPackBuffer<uint8_t>> const& buffer,
|
||||
std::shared_ptr<VPackCustomTypeHandler> const& handler,
|
||||
std::string const& message, int code, bool wasSynchronous)
|
||||
: buffer(buffer),
|
||||
customTypeHandler(handler),
|
||||
|
@ -96,8 +96,8 @@ struct OperationResult {
|
|||
code(code),
|
||||
wasSynchronous(wasSynchronous) {}
|
||||
|
||||
OperationResult(std::shared_ptr<VPackBuffer<uint8_t>> buffer,
|
||||
std::shared_ptr<VPackCustomTypeHandler> handler,
|
||||
OperationResult(std::shared_ptr<VPackBuffer<uint8_t>> const& buffer,
|
||||
std::shared_ptr<VPackCustomTypeHandler> const& handler,
|
||||
std::string const& message, int code, bool wasSynchronous,
|
||||
std::unordered_map<int, size_t> const& countErrorCodes)
|
||||
: buffer(buffer),
|
||||
|
|
|
@ -34,7 +34,7 @@ using namespace arangodb;
|
|||
|
||||
/// @brief create the transaction, using a collection id
|
||||
SingleCollectionTransaction::SingleCollectionTransaction(
|
||||
std::shared_ptr<transaction::Context> transactionContext, TRI_voc_cid_t cid,
|
||||
std::shared_ptr<transaction::Context> const& transactionContext, TRI_voc_cid_t cid,
|
||||
AccessMode::Type accessType)
|
||||
: transaction::Methods(transactionContext),
|
||||
_cid(cid),
|
||||
|
@ -49,7 +49,7 @@ SingleCollectionTransaction::SingleCollectionTransaction(
|
|||
|
||||
/// @brief create the transaction, using a collection name
|
||||
SingleCollectionTransaction::SingleCollectionTransaction(
|
||||
std::shared_ptr<transaction::Context> transactionContext,
|
||||
std::shared_ptr<transaction::Context> const& transactionContext,
|
||||
std::string const& name, AccessMode::Type accessType)
|
||||
: transaction::Methods(transactionContext),
|
||||
_cid(0),
|
||||
|
|
|
@ -41,14 +41,14 @@ class SingleCollectionTransaction final : public transaction::Methods {
|
|||
/// @brief create the transaction, using a collection id
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SingleCollectionTransaction(std::shared_ptr<transaction::Context>,
|
||||
SingleCollectionTransaction(std::shared_ptr<transaction::Context> const&,
|
||||
TRI_voc_cid_t, AccessMode::Type);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create the transaction, using a collection name
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SingleCollectionTransaction(std::shared_ptr<transaction::Context>,
|
||||
SingleCollectionTransaction(std::shared_ptr<transaction::Context> const&,
|
||||
std::string const&, AccessMode::Type);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -34,7 +34,7 @@ using namespace arangodb::basics;
|
|||
/// @brief create a task tied to the specified queue
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LocalTask::LocalTask(std::shared_ptr<LocalTaskQueue> queue) : _queue(queue) {}
|
||||
LocalTask::LocalTask(std::shared_ptr<LocalTaskQueue> const& queue) : _queue(queue) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LocalCallbackTask::LocalCallbackTask(std::shared_ptr<LocalTaskQueue> queue,
|
||||
LocalCallbackTask::LocalCallbackTask(std::shared_ptr<LocalTaskQueue> const& queue,
|
||||
std::function<void()> cb)
|
||||
: _queue(queue), _cb(cb) {}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class LocalTask : public std::enable_shared_from_this<LocalTask> {
|
|||
LocalTask(LocalTask const&) = delete;
|
||||
LocalTask& operator=(LocalTask const&) = delete;
|
||||
|
||||
explicit LocalTask(std::shared_ptr<LocalTaskQueue> queue);
|
||||
explicit LocalTask(std::shared_ptr<LocalTaskQueue> const& queue);
|
||||
virtual ~LocalTask() {}
|
||||
|
||||
virtual void run() = 0;
|
||||
|
@ -64,7 +64,7 @@ class LocalCallbackTask
|
|||
LocalCallbackTask(LocalCallbackTask const&) = delete;
|
||||
LocalCallbackTask& operator=(LocalCallbackTask const&) = delete;
|
||||
|
||||
LocalCallbackTask(std::shared_ptr<LocalTaskQueue> queue, std::function<void()> cb);
|
||||
LocalCallbackTask(std::shared_ptr<LocalTaskQueue> const& queue, std::function<void()> cb);
|
||||
virtual ~LocalCallbackTask() {}
|
||||
|
||||
virtual void run();
|
||||
|
|
Loading…
Reference in New Issue