isapego commented on a change in pull request #8118: URL: https://github.com/apache/ignite/pull/8118#discussion_r478804731
########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transactions.h ########## @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_H +#define TRANSACTIONS_H + +#include <string> + +#include <ignite/common/concurrent.h> +#include <ignite/impl/thin/transactions/transactions_proxy.h> + +using namespace ignite::impl::thin::transactions; +using namespace ignite::common::concurrent; + +namespace ignite +{ + namespace thin + { + namespace transactions + { + /** + * Transaction client. + * + * Implements main transactionsl API. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransaction { + + public: + ClientTransaction(TransactionProxy impl) : + proxy(impl) + {} + + /** + * Destructor. + */ + ~ClientTransaction() {} + + /** + * Commits this transaction. + */ + void Commit() + { + proxy.commit(); + } + + /** + * Rolls back this transaction. + */ + void Rollback() + { + proxy.rollback(); + } + + /** + * Ends the transaction. Transaction will be rolled back if it has not been committed. + */ + void Close() + { + proxy.close(); + } + + /** + * Assignment operator. + * + * @param other Another instance. + * @return *this. + */ + ClientTransaction& operator=(const ClientTransaction& other) Review comment: If there is assignment operator, there should also be copy constructor. ########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transaction_consts.h ########## @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTION_CONSTS_H +#define TRANSACTION_CONSTS_H + +namespace ignite +{ + namespace thin + { + namespace transactions + { + #define TX_ALREADY_CLOSED "The transaction is already closed." + #define TX_ALREADY_STARTED "A transaction has already been started by the current thread." + #define TX_DIFFERENT_THREAD "You can commit transaction only from the thread it was started." Review comment: Do we really need these macros in public header? ########## File path: modules/platforms/cpp/thin-client/src/impl/message.h ########## @@ -569,6 +619,110 @@ namespace ignite const Writable& val3; }; + /** + * Tx start request. + */ + template<int32_t OpCode> + class TxStartRequest : public Request<OpCode> + { + public: + /** + * Constructor. + */ + TxStartRequest(ignite::thin::transactions::TransactionConcurrency::Type conc, + ignite::thin::transactions::TransactionIsolation::Type isolationLvl, + int64_t tmOut, int32_t sz, ignite::common::concurrent::SharedPointer<const char> lbl) : + concurrency(conc), + isolation(isolationLvl), + timeout(tmOut), + size(sz), + label(lbl) + { + // No-op. + } + + /** + * Destructor. + */ + virtual ~TxStartRequest() + { + // No-op. + } + + /** + * Write request using provided writer. + * @param writer Writer. + * @param ver Version. + */ + virtual void Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const { + writer.WriteInt8(concurrency); + writer.WriteInt8(isolation); + writer.WriteInt64(timeout); + label.IsValid() ? writer.WriteString(label.Get()) : writer.WriteNull(); + } + + private: + /** Cncurrency. */ + ignite::thin::transactions::TransactionConcurrency::Type concurrency; + + /** Isolation. */ + ignite::thin::transactions::TransactionIsolation::Type isolation; + + /** Timeout. */ + const int64_t timeout; + + /** Size. */ + const int32_t size; + + /** Tx label. */ + ignite::common::concurrent::SharedPointer<const char> label; + }; + + /** + * Tx end request. + */ + template<int32_t OpCode> + class TxEndRequest : public Request<OpCode> Review comment: The same as for `TxStartRequest` ########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transactions.h ########## @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_H +#define TRANSACTIONS_H + +#include <string> + +#include <ignite/common/concurrent.h> +#include <ignite/impl/thin/transactions/transactions_proxy.h> + +using namespace ignite::impl::thin::transactions; +using namespace ignite::common::concurrent; + +namespace ignite +{ + namespace thin + { + namespace transactions + { + /** + * Transaction client. + * + * Implements main transactionsl API. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransaction { + + public: + ClientTransaction(TransactionProxy impl) : + proxy(impl) + {} + + /** + * Destructor. + */ + ~ClientTransaction() {} + + /** + * Commits this transaction. + */ + void Commit() + { + proxy.commit(); + } + + /** + * Rolls back this transaction. + */ + void Rollback() + { + proxy.rollback(); + } + + /** + * Ends the transaction. Transaction will be rolled back if it has not been committed. + */ + void Close() + { + proxy.close(); + } + + /** + * Assignment operator. + * + * @param other Another instance. + * @return *this. + */ + ClientTransaction& operator=(const ClientTransaction& other) + { + proxy = other.proxy; + + return *this; + } + private: + /** Implementation. */ + TransactionProxy proxy; + + /** + * Default constructor. + */ + ClientTransaction() {} + }; + + /** + * Transactions client. + * + * This is an entry point for Thin C++ Ignite transactions. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransactions { + public: + /** + * Constructor. + * + * @param impl Implementation. + */ + ClientTransactions(SharedPointer<void> impl) : + proxy(impl), + label(SharedPointer<const char>()) + { + } + + /** + * Destructor. + */ + ~ClientTransactions() + { + } + + /** + * Start new transaction with completely clarify parameters. + * + * @param concurrency Transaction concurrency. + * @param isolation Transaction isolation. + * @param timeout Transaction timeout. + * @param txSize Number of entries participating in transaction (may be approximate). + * + * @return ClientTransaction implementation. + */ + ClientTransaction TxStart( + TransactionConcurrency::Type concurrency = TransactionConcurrency::PESSIMISTIC, + TransactionIsolation::Type isolation = TransactionIsolation::READ_COMMITTED, + int64_t timeout = 0, + int32_t txSize = 0) + { + return ClientTransaction(proxy.txStart(concurrency, isolation, timeout, txSize, label)); + } + + /** + * Returns instance of {@code ClientTransactions} to mark each new transaction with a specified label. + * + * @param label Transaction label. + * @return ClientTransactions implementation. + */ + ClientTransactions withLabel(const std::string& lbl) + { + ClientTransactions copy = ClientTransactions(proxy, lbl.c_str()); + + return copy; + } + private: + /** Implementation. */ + TransactionsProxy proxy; + + /** Transaction specific label. */ + SharedPointer<const char> label; + + /** + * Default constructor. + */ + ClientTransactions(); + + /** + * Constructor. + * + * @param impl Implementation. + */ + ClientTransactions(TransactionsProxy& impl, const std::string& lbl) : + proxy(impl) + { + char* l = new char[lbl.size() + 1]; Review comment: `SharedPointer` uses `delete` as a deleter by default, not `delete[]`. Use something different for a container here, for example `SharedPointer<common::FixedSizeArray<char>>`. ########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transactions.h ########## @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_H +#define TRANSACTIONS_H + +#include <string> + +#include <ignite/common/concurrent.h> +#include <ignite/impl/thin/transactions/transactions_proxy.h> + +using namespace ignite::impl::thin::transactions; +using namespace ignite::common::concurrent; + +namespace ignite +{ + namespace thin + { + namespace transactions + { + /** + * Transaction client. + * + * Implements main transactionsl API. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransaction { + + public: + ClientTransaction(TransactionProxy impl) : + proxy(impl) + {} + + /** + * Destructor. + */ + ~ClientTransaction() {} + + /** + * Commits this transaction. + */ + void Commit() + { + proxy.commit(); + } + + /** + * Rolls back this transaction. + */ + void Rollback() + { + proxy.rollback(); + } + + /** + * Ends the transaction. Transaction will be rolled back if it has not been committed. + */ + void Close() + { + proxy.close(); + } + + /** + * Assignment operator. + * + * @param other Another instance. + * @return *this. + */ + ClientTransaction& operator=(const ClientTransaction& other) + { + proxy = other.proxy; + + return *this; + } + private: + /** Implementation. */ + TransactionProxy proxy; + + /** + * Default constructor. + */ + ClientTransaction() {} + }; + + /** + * Transactions client. + * + * This is an entry point for Thin C++ Ignite transactions. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransactions { Review comment: Class should be moved to its own header. ########## File path: modules/platforms/cpp/thin-client/src/impl/message.h ########## @@ -569,6 +619,110 @@ namespace ignite const Writable& val3; }; + /** + * Tx start request. + */ + template<int32_t OpCode> Review comment: Why does this type needs to be parameterized if the parameter is always the same? ########## File path: modules/platforms/cpp/thin-client/src/impl/transactions/transactions_proxy.cpp ########## @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ignite/impl/thin/transactions/transactions_proxy.h" +#include "impl/transactions/transactions_impl.h" + +using namespace ignite::impl::thin; +using namespace transactions; + +namespace +{ + using namespace ignite::common::concurrent; + + TransactionsImpl& GetTxsImpl(SharedPointer<void>& ptr) + { + return *reinterpret_cast<TransactionsImpl*>(ptr.Get()); + } + + TransactionImpl& GetTxImpl(SharedPointer<void>& ptr) + { + return *reinterpret_cast<TransactionImpl*>(ptr.Get()); + } +} + +namespace ignite +{ + namespace impl + { + namespace thin + { + namespace transactions + { + TransactionProxy TransactionsProxy::txStart( + TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, + int64_t timeout, + int32_t txSize, + const char *lbl) + { + return TransactionProxy(GetTxsImpl(impl).TxStart(concurrency, isolation, timeout, txSize, lbl)); + } + + void TransactionProxy::commit() + { + GetTxImpl(impl).Commit(); + } + + void TransactionProxy::rollback() + { + GetTxImpl(impl).Rollback(); + } + + void TransactionProxy::close() + { + try + { + GetTxImpl(impl).Close(); + } + catch (...) Review comment: I'm not sure about this solution to be honest. This can lead to really hard-to-debug bugs. ########## File path: modules/platforms/cpp/thin-client/src/impl/transactions/transactions_proxy.cpp ########## @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ignite/impl/thin/transactions/transactions_proxy.h" +#include "impl/transactions/transactions_impl.h" + +using namespace ignite::impl::thin; +using namespace transactions; + +namespace +{ + using namespace ignite::common::concurrent; + + TransactionsImpl& GetTxsImpl(SharedPointer<void>& ptr) + { + return *reinterpret_cast<TransactionsImpl*>(ptr.Get()); + } + + TransactionImpl& GetTxImpl(SharedPointer<void>& ptr) + { + return *reinterpret_cast<TransactionImpl*>(ptr.Get()); + } +} + +namespace ignite +{ + namespace impl + { + namespace thin + { + namespace transactions + { + TransactionProxy TransactionsProxy::txStart( + TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, + int64_t timeout, + int32_t txSize, + SharedPointer<const char> lbl) + { + return TransactionProxy(GetTxsImpl(impl).TxStart(concurrency, isolation, timeout, txSize, lbl)); + } + + void TransactionProxy::commit() + { + GetTxImpl(impl).Commit(); + } + + void TransactionProxy::rollback() + { + GetTxImpl(impl).Rollback(); + } + + void TransactionProxy::close() + { + try + { + GetTxImpl(impl).Close(); + } + catch (...) + { + } Review comment: Maybe we should add `assert(false);` here at least? ########## File path: modules/platforms/cpp/thin-client/src/impl/transactions/transactions_impl.cpp ########## @@ -0,0 +1,212 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "impl/message.h" +#include "impl/transactions/transactions_impl.h" +#include "impl/response_status.h" + +using namespace ignite::common::concurrent; +using namespace ignite::impl::thin; + +namespace ignite +{ + namespace impl + { + namespace thin + { + namespace transactions + { + TransactionImpl::TL_TXID TransactionImpl::threadTx; + + TransactionsImpl::TransactionsImpl(const SP_DataRouter& router) : + router(router) + { + } + + template<typename ReqT, typename RspT> + void TransactionsImpl::SyncMessage(const ReqT& req, RspT& rsp) Review comment: Can you re-name this method to something like `SendTxMessage`? SyncMessage should only be in network parts. ########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transactions.h ########## @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_H +#define TRANSACTIONS_H + +#include <string> + +#include <ignite/common/concurrent.h> +#include <ignite/impl/thin/transactions/transactions_proxy.h> + +using namespace ignite::impl::thin::transactions; +using namespace ignite::common::concurrent; Review comment: There should never be `using` in public headers. ########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transactions.h ########## @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_H +#define TRANSACTIONS_H Review comment: Header guard is not consistent. The right name would be `_IGNITE_THIN_TRANSACTIONS_CLIENT_TRANSACTION`. Same for other new headers. ########## File path: modules/platforms/cpp/thin-client/src/impl/transactions/transactions_impl.h ########## @@ -0,0 +1,268 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_IMPL_H +#define TRANSACTIONS_IMPL_H + +#include "impl/data_router.h" +#include "ignite/thin/transactions/transaction_consts.h" + +using namespace ignite::thin::transactions; +using namespace ignite::common::concurrent; + +namespace ignite +{ + namespace impl + { + namespace thin + { + namespace transactions + { + /* Forward declaration. */ + class TransactionsImpl; + + /* Forward declaration. */ + class TransactionImpl; + + typedef SharedPointer<TransactionsImpl> SP_TransactionsImpl; + typedef SharedPointer<TransactionImpl> SP_TransactionImpl; + + /** + * Ignite transactions implementation. + * + * This is an entry point for Thin C++ Ignite transactions. + */ + class TransactionImpl + { + typedef ThreadLocalInstance<SP_TransactionImpl> TL_TXID; Review comment: The naming is bad, looks like a constant or macro. Also, typedef itself is not really needed - the type only used in 2 places. ########## File path: modules/platforms/cpp/thin-client/include/ignite/thin/transactions/transactions.h ########## @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRANSACTIONS_H +#define TRANSACTIONS_H + +#include <string> + +#include <ignite/common/concurrent.h> +#include <ignite/impl/thin/transactions/transactions_proxy.h> + +using namespace ignite::impl::thin::transactions; +using namespace ignite::common::concurrent; + +namespace ignite +{ + namespace thin + { + namespace transactions + { + /** + * Transaction client. + * + * Implements main transactionsl API. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransaction { + + public: + ClientTransaction(TransactionProxy impl) : + proxy(impl) + {} + + /** + * Destructor. + */ + ~ClientTransaction() {} + + /** + * Commits this transaction. + */ + void Commit() + { + proxy.commit(); + } + + /** + * Rolls back this transaction. + */ + void Rollback() + { + proxy.rollback(); + } + + /** + * Ends the transaction. Transaction will be rolled back if it has not been committed. + */ + void Close() + { + proxy.close(); + } + + /** + * Assignment operator. + * + * @param other Another instance. + * @return *this. + */ + ClientTransaction& operator=(const ClientTransaction& other) + { + proxy = other.proxy; + + return *this; + } + private: + /** Implementation. */ + TransactionProxy proxy; + + /** + * Default constructor. + */ + ClientTransaction() {} + }; + + /** + * Transactions client. + * + * This is an entry point for Thin C++ Ignite transactions. + * + * This class implemented as a reference to an implementation so copying of this class instance will only + * create another reference to the same underlying object. Underlying object released automatically once all + * the instances are destructed. + */ + class ClientTransactions { + public: + /** + * Constructor. + * + * @param impl Implementation. + */ + ClientTransactions(SharedPointer<void> impl) : + proxy(impl), + label(SharedPointer<const char>()) + { + } + + /** + * Destructor. + */ + ~ClientTransactions() + { + } + + /** + * Start new transaction with completely clarify parameters. + * + * @param concurrency Transaction concurrency. + * @param isolation Transaction isolation. + * @param timeout Transaction timeout. + * @param txSize Number of entries participating in transaction (may be approximate). + * + * @return ClientTransaction implementation. + */ + ClientTransaction TxStart( + TransactionConcurrency::Type concurrency = TransactionConcurrency::PESSIMISTIC, + TransactionIsolation::Type isolation = TransactionIsolation::READ_COMMITTED, + int64_t timeout = 0, + int32_t txSize = 0) + { + return ClientTransaction(proxy.txStart(concurrency, isolation, timeout, txSize, label)); + } + + /** + * Returns instance of {@code ClientTransactions} to mark each new transaction with a specified label. + * + * @param label Transaction label. + * @return ClientTransactions implementation. + */ + ClientTransactions withLabel(const std::string& lbl) + { + ClientTransactions copy = ClientTransactions(proxy, lbl.c_str()); Review comment: Why do you pass `lbl.c_str()` here, if `ClientTransactions()` takes `const std::string&`? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
