8000 remove dependency on trx object (#11780) · thedemodev/arangodb@f3b1e09 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3b1e09

Browse files
authored
remove dependency on trx object (arangodb#11780)
1 parent 6266e2f commit f3b1e09

File tree

5 files changed

+13
-24
lines changed

5 8000 files changed

+13
-24
lines changed

arangod/Aql/AqlValue.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -988,15 +988,14 @@ size_t AqlValue::sizeofDocvec() const {
988988
}
989989

990990
/// @brief construct a V8 value as input for the expression execution in V8
991-
v8::Handle<v8::Value> AqlValue::toV8(v8::Isolate* isolate, transaction::Methods* trx) const {
991+
v8::Handle<v8::Value> AqlValue::toV8(v8::Isolate* isolate, velocypack::Options const* options) const {
992992
auto context = TRI_IGETC;
993993
AqlValueType t = type();
994994
switch (t) {
995995
case VPACK_INLINE:
996996
case VPACK_SLICE_POINTER:
997997
case VPACK_MANAGED_SLICE:
998998
case VPACK_MANAGED_BUFFER: {
999-
VPackOptions* options = trx->transactionContext()->getVPackOptions();
1000999
return TRI_VPackToV8(isolate, slice(t), options);
10011000
}
10021001
case DOCVEC: {
@@ -1008,7 +1007,7 @@ v8::Handle<v8::Value> AqlValue::toV8(v8::Isolate* isolate, transaction::Methods*
10081007
for (auto const& it : *_data.docvec) {
10091008
size_t const n = it->size();
10101009
for (size_t i = 0; i < n; ++i) {
1011-
result->Set(context, j++, it->getValueReference(i, 0).toV8(isolate, trx)).FromMaybe(false);
1010+
result->Set(context, j++, it->getValueReference(i, 0).toV8(isolate, options)).FromMaybe(false);
10121011

10131012
if (V8PlatformFeature::isOutOfMemory(isolate)) {
10141013
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
@@ -1094,11 +1093,6 @@ void AqlValue::toVelocyPack(VPackOptions const* options, arangodb::velocypack::B
10941093
}
10951094
}
10961095

1097-
//void AqlValue::toVelocyPack(transaction::Methods* trx, arangodb::velocypack::Builder& builder,
1098-
// bool resolveExternals) const {
1099-
// toVelocyPack(trx->transactionContextPtr()->getVPackOptions(), builder, resolveExternals);
1100-
//}
1101-
11021096
/// @brief materializes a value into the builder
11031097
AqlValue AqlValue::materialize(VPackOptions const* options, bool& hasCopied,
11041098
bool resolveExternals) const {
@@ -1127,11 +1121,6 @@ AqlValue AqlValue::materialize(VPackOptions const* options, bool& hasCopied,
11271121
return AqlValue();
11281122
}
11291123

1130-
AqlValue AqlValue::materialize(transaction::Methods* trx, bool& hasCopied,
1131-
bool resolveExternals) const {
1132-
return materialize(trx->transactionContextPtr()->getVPackOptions(), hasCopied, resolveExternals);
1133-
}
1134-
11351124
/// @brief clone a value
11361125
AqlValue AqlValue::clone() const {
11371126
AqlValueType t = type();

arangod/Aql/AqlValue.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,14 @@ struct AqlValue final {
322322
AqlItemBlock* docvecAt(size_t position) const;
323323

324324
/// @brief construct a V8 value as input for the expression execution in V8
325-
v8::Handle<v8::Value> toV8(v8::Isolate* isolate, transaction::Methods*) const;
325+
v8::Handle<v8::Value> toV8(v8::Isolate* isolate, arangodb::velocypack::Options const*) const;
326326

327327
/// @brief materializes a value into the builder
328328
void toVelocyPack(velocypack::Options const*, arangodb::velocypack::Builder&, bool resolveExternals) const;
329-
// [[deprecated("Pass VPackOptions instead of the transaction")]]
330-
// void toVelocyPack(transaction::Methods*, arangodb::velocypack::Builder&, bool resolveExternals) const;
331329

332330
/// @brief materialize a value into a new one. this expands docvecs and
333331
/// ranges
334332
AqlValue materialize(velocypack::Options const*, bool& hasCopied, bool resolveExternals) const;
335-
[[deprecated("Pass VPackOptions instead of the transaction")]]
336-
AqlValue materialize(transaction::Methods*, bool& hasCopied, bool resolveExternals) const;
337333

338334
/// @brief return the slice for the value
339335
/// this will throw if the value type is not VPACK_SLICE_POINTER,

arangod/Aql/Expression.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,10 @@ AqlValue Expression::executeSimpleExpressionFCallJS(AstNode const* node,
942942
{
943943
ISOLATE;
944944
TRI_ASSERT(isolate != nullptr);
945-
v8::HandleScope scope(isolate); \
945+
v8::HandleScope scope(isolate);
946946
auto context = TRI_IGETC;
947+
948+
VPackOptions const* options = trx->transactionContext()->getVPackOptions();
947949

948950
std::string jsName;
949951
size_t const n = member->numMembers();
@@ -962,7 +964,7 @@ AqlValue Expression::executeSimpleExpressionFCallJS(AstNode const* node,
962964
AqlValue a = executeSimpleExpression(arg, trx, localMustDestroy, false);
963965
AqlValueGuard guard(a, localMustDestroy);
964966

965-
params->Set(context, static_cast<uint32_t>(i), a.toV8(isolate, trx)).FromMaybe(false);
967+
params->Set(context, static_cast<uint32_t>(i), a.toV8(isolate, options)).FromMaybe(false);
966968
}
967969

968970
// function name
@@ -987,7 +989,7 @@ AqlValue Expression::executeSimpleExpressionFCallJS(AstNode const* node,
987989
AqlValue a = executeSimpleExpression(arg, trx, localMustDestroy, false);
988990
AqlValueGuard guard(a, localMustDestroy);
989991

990-
args[i] = a.toV8(isolate, trx);
992+
args[i] = a.toV8(isolate, options);
991993
}
992994
}
993995
}

arangod/Aql/Functions.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,7 @@ AqlValue callApplyBackend(ExpressionContext* expressionContext, transaction::Met
11271127
v8::HandleScope scope(isolate);
11281128
auto context = TRI_IGETC;
11291129

1130+
VPackOptions const* options = trx->transactionContext()->getVPackOptions();
11301131
std::string jsName;
11311132
int const n = static_cast<int>(invokeParams.size());
11321133
int const callArgs = (func == nullptr ? 3 : n);
@@ -1143,7 +1144,7 @@ AqlValue callApplyBackend(ExpressionContext* expressionContext, transaction::Met
11431144

11441145
for (int i = 0; i < n; ++i) {
11451146
params
1146-
->Set(context, static_cast<uint32_t>(i), invokeParams[i].toV8(isolate, trx))
1147+
->Set(context, static_cast<uint32_t>(i), invokeParams[i].toV8(isolate, options))
11471148
.FromMaybe(true);
11481149
}
11491150
args[1] = params;
@@ -1152,7 +1153,7 @@ AqlValue callApplyBackend(ExpressionContext* expressionContext, transaction::Met
11521153
// a call to a built-in V8 function
11531154
jsName = "AQL_" + func->name;
11541155
for (int i = 0; i < n; ++i) {
1155-
args[i] = invokeParams[i].toV8(isolate, trx);
1156+
args[i] = invokeParams[i].toV8(isolate, options);
11561157
}
11571158
}
11581159

arangod/Aql/Query.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ QueryResultV8 Query::executeV8(v8::Isolate* isolate) {
639639
AqlValue const& val = value->getValueReference(i, resultRegister);
640640

641641
if (!val.isEmpty()) {
642-
resArray->Set(context, j++, val.toV8(isolate, _trx.get())).FromMaybe(false);
642+
VPackOptions const* options = _trx->transactionContext()->getVPackOptions();
643+
resArray->Set(context, j++, val.toV8(isolate, options)).FromMaybe(false);
643644

644645
if (useQueryCache) {
645646
val.toVelocyPack(&vpackOptions(), *builder, true);

0 commit comments

Comments
 (0)
0