|
26 | 26 | #include "Basics/LocalTaskQueue.h"
|
27 | 27 | #include "Basics/Result.h"
|
28 | 28 | #include "Basics/StaticStrings.h"
|
| 29 | +#include "Basics/VelocyPackHelper.h" |
29 | 30 | #include "Indexes/IndexIterator.h"
|
30 | 31 | #include "Indexes/SimpleAttributeEqualityMatcher.h"
|
| 32 | +#ifdef USE_IRESEARCH |
31 | 33 | #include "IResearch/IResearchFeature.h"
|
32 | 34 | #include "IResearch/IResearchMMFilesLink.h"
|
33 |
| -#include "IResearch/VelocyPackHelper.h" |
| 35 | +#endif |
34 | 36 | #include "Transaction/Methods.h"
|
35 | 37 | #include "Utils/OperationOptions.h"
|
36 | 38 | #include "velocypack/Iterator.h"
|
|
41 | 43 | #include "Transaction/Helpers.h"
|
42 | 44 | #include "Aql/AstNode.h"
|
43 | 45 |
|
44 |
| -NS_LOCAL |
| 46 | +namespace { |
45 | 47 |
|
46 | 48 | /// @brief hard-coded vector of the index attributes
|
47 | 49 | /// note that the attribute names must be hard-coded here to avoid an init-order
|
@@ -142,9 +144,12 @@ class EdgeIndexMock final : public arangodb::Index {
|
142 | 144 | return nullptr;
|
143 | 145 | }
|
144 | 146 |
|
6D40
tr>
145 |
| - auto const type = arangodb::iresearch::getStringRef(typeSlice); |
| 147 | + auto const type = arangodb::basics::VelocyPackHelper::getStringRef( |
| 148 | + typeSlice, |
| 149 | + arangodb::velocypack::StringRef() |
| 150 | + ); |
146 | 151 |
|
147 |
| - if (type != "edge") { |
| 152 | + if (type.compare("edge") != 0) { |
148 | 153 | return nullptr;
|
149 | 154 | }
|
150 | 155 |
|
@@ -491,7 +496,30 @@ class AllIteratorMock final : public arangodb::IndexIterator {
|
491 | 496 | uint64_t _end;
|
492 | 497 | }; // AllIteratorMock
|
493 | 498 |
|
494 |
| -NS_END |
| 499 | +bool mergeSlice( |
| 500 | + arangodb::velocypack::Builder& builder, |
| 501 | + arangodb::velocypack::Slice const& slice |
9E88
tr>
| 502 | +) { |
| 503 | + if (builder.isOpenArray()) { |
| 504 | + if (slice.isArray()) { |
| 505 | + builder.add(arangodb::velocypack::ArrayIterator(slice)); |
| 506 | + } else { |
| 507 | + builder.add(slice); |
| 508 | + } |
| 509 | + |
| 510 | + return true; |
| 511 | + } |
| 512 | + |
| 513 | + if (builder.isOpenObject() && slice.isObject()) { |
| 514 | + builder.add(arangodb::velocypack::ObjectIterator(slice)); |
| 515 | + |
| 516 | + return true; |
| 517 | + } |
| 518 | + |
| 519 | + return false; |
| 520 | +} |
| 521 | + |
| 522 | +} |
495 | 523 |
|
496 | 524 | void ContextDataMock::pinData(arangodb::LogicalCollection* collection) {
|
497 | 525 | if (collection) {
|
@@ -540,14 +568,19 @@ std::shared_ptr<arangodb::Index> PhysicalCollectionMock::createIndex(arangodb::t
|
540 | 568 | }
|
541 | 569 | }
|
542 | 570 |
|
543 |
| - auto const type = arangodb::iresearch::getStringRef(info.get("type")); |
| 571 | + auto const type = arangodb::basics::VelocyPackHelper::getStringRef( |
| 572 | + info.get("type"), |
| 573 | + arangodb::velocypack::StringRef() |
| 574 | + ); |
544 | 575 |
|
545 | 576 | std::shared_ptr<arangodb::Index> index;
|
546 | 577 |
|
547 |
| - if (type == "edge") { |
| 578 | + if (0 == type.compare("edge")) { |
548 | 579 | index = EdgeIndexMock::make(++lastId, _logicalCollection, info);
|
549 |
| - } else if (arangodb::iresearch::IResearchFeature::type() == type) { |
| 580 | +#ifdef USE_IRESEARCH |
| 581 | + } else if (0 == type.compare(arangodb::iresearch::IResearchFeature::type())) { |
550 | 582 | index = arangodb::iresearch::IResearchMMFilesLink::make(++lastId, _logicalCollection, info);
|
| 583 | +#endif |
551 | 584 | }
|
552 | 585 |
|
553 | 586 | if (!index) {
|
@@ -603,15 +636,15 @@ std::unique_ptr<arangodb::IndexIterator> PhysicalCollectionMock::getAllIterator(
|
603 | 636 | before();
|
604 | 637 |
|
605 | 638 | if (reverse) {
|
606 |
| - return irs::memory::make_unique<ReverseAllIteratorMock>(documents.size(), this->_logicalCollection, trx); |
| 639 | + return std::make_unique<ReverseAllIteratorMock>(documents.size(), this->_logicalCollection, trx); |
607 | 640 | }
|
608 | 641 |
|
609 |
| - return irs::memory::make_unique<AllIteratorMock>(documents.size(), this->_logicalCollection, trx); |
| 642 | + return std::make_unique<AllIteratorMock>(documents.size(), this->_logicalCollection, trx); |
610 | 643 | }
|
611 | 644 |
|
612 | 645 | std::unique_ptr<arangodb::IndexIterator> PhysicalCollectionMock::getAnyIterator(arangodb::transaction::Methods* trx) const {
|
613 | 646 | before();
|
614 |
| - return irs::memory::make_unique<AllIteratorMock>(documents.size(), this->_logicalCollection, trx); |
| 647 | + return std::make_unique<AllIteratorMock>(documents.size(), this->_logicalCollection, trx); |
615 | 648 | }
|
616 | 649 |
|
617 | 650 | void PhysicalCollectionMock::getPropertiesVPack(arangodb::velocypack::Builder&) const {
|
@@ -879,7 +912,7 @@ arangodb::Result PhysicalCollectionMock::update(arangodb::transaction::Methods*
|
879 | 912 |
|
880 | 913 | builder.openObject();
|
881 | 914 |
|
882 |
| - if (!arangodb::iresearch::mergeSlice(builder, newSlice)) { |
| 915 | + if (!mergeSlice(builder, newSlice)) { |
883 | 916 | return arangodb::Result(TRI_ERROR_BAD_PARAMETER);
|
884 | 917 | }
|
885 | 918 |
|
@@ -1161,7 +1194,7 @@ TRI_vocbase_t* StorageEngineMock::openDatabase(arangodb::velocypack::Slice const
|
1161 | 1194 | return nullptr;
|
1162 | 1195 | }
|
1163 | 1196 |
|
1164 |
| - auto vocbase = irs::memory::make_unique<TRI_vocbase_t>( |
| 1197 | + auto vocbase = std::make_unique<TRI_vocbase_t>( |
1165 | 1198 | TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL,
|
1166 | 1199 | vocbases.size(),
|
1167 | 1200 | args.get("name").copyString()
|
|
0 commit comments