Skip to content

Commit b92c82d

Browse files
committed
Update C++ core to 1.0.0
Change-Id: I268e0b4146ce1aa20c5ec1a1c29ef74b245b971a Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/211682 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
1 parent 1207880 commit b92c82d

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

deps/couchbase-cxx-client

src/exceptions.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ retry_reason_to_string(couchbase::retry_reason reason)
198198
}
199199

200200
PyObject*
201-
build_kv_error_map_info(couchbase::key_value_error_map_info error_info)
201+
build_kv_error_map_info(couchbase::core::key_value_error_map_info error_info)
202202
{
203203
PyObject* err_info = PyDict_New();
204204
PyObject* pyObj_tmp = PyLong_FromLong(static_cast<uint16_t>(error_info.code()));
@@ -244,7 +244,8 @@ build_kv_error_map_info(couchbase::key_value_error_map_info error_info)
244244
}
245245

246246
void
247-
build_kv_error_context(const couchbase::key_value_error_context& ctx, PyObject* pyObj_error_ctx)
247+
build_kv_error_context(const couchbase::core::key_value_error_context& ctx,
248+
PyObject* pyObj_error_ctx)
248249
{
249250
PyObject* pyObj_tmp = nullptr;
250251
pyObj_tmp = PyUnicode_FromString(ctx.id().c_str());

src/exceptions.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ make_error_code(PycbcError ec);
112112
// end - needed for Pycbc error code
113113

114114
PyObject*
115-
build_kv_error_map_info(couchbase::key_value_error_map_info error_info);
115+
build_kv_error_map_info(couchbase::core::key_value_error_map_info error_info);
116116

117117
void
118-
build_kv_error_context(const couchbase::key_value_error_context& ctx, PyObject* pyObj_ctx);
118+
build_kv_error_context(const couchbase::core::key_value_error_context& ctx, PyObject* pyObj_ctx);
119119

120120
/*
121121
@@ -288,7 +288,7 @@ build_exception_from_context(const T& ctx,
288288

289289
template<>
290290
inline PyObject*
291-
build_exception_from_context(const couchbase::key_value_error_context& ctx,
291+
build_exception_from_context(const couchbase::core::key_value_error_context& ctx,
292292
const char* file,
293293
int line,
294294
std::string error_msg,
@@ -335,7 +335,7 @@ build_exception_from_context(const couchbase::key_value_error_context& ctx,
335335

336336
template<>
337337
inline PyObject*
338-
build_exception_from_context(const couchbase::subdocument_error_context& ctx,
338+
build_exception_from_context(const couchbase::core::subdocument_error_context& ctx,
339339
const char* file,
340340
int line,
341341
std::string error_msg,

src/transactions/transactions.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ pycbc_txns::transaction_query_op([[maybe_unused]] PyObject* self, PyObject* args
987987
Py_XINCREF(pyObj_options);
988988
auto barrier = std::make_shared<std::promise<PyObject*>>();
989989
auto f = barrier->get_future();
990-
Py_BEGIN_ALLOW_THREADS ctx->ctx.query(
990+
Py_BEGIN_ALLOW_THREADS ctx->ctx->query(
991991
statement,
992992
*opt->opts,
993993
[pyObj_options, pyObj_callback, pyObj_errback, barrier](
@@ -1115,7 +1115,7 @@ pycbc_txns::transaction_op([[maybe_unused]] PyObject* self, PyObject* args, PyOb
11151115
Py_RETURN_NONE;
11161116
}
11171117
couchbase::core::document_id id{ bucket, scope, collection, key };
1118-
Py_BEGIN_ALLOW_THREADS ctx->ctx.get_optional(
1118+
Py_BEGIN_ALLOW_THREADS ctx->ctx->get_optional(
11191119
id,
11201120
[barrier, pyObj_callback, pyObj_errback](
11211121
std::exception_ptr err, std::optional<tx_core::transaction_get_result> res) {
@@ -1134,7 +1134,7 @@ pycbc_txns::transaction_op([[maybe_unused]] PyObject* self, PyObject* args, PyOb
11341134
fmt::format("no value given for an insert of key {}", id.key()).c_str());
11351135
Py_RETURN_NONE;
11361136
}
1137-
Py_BEGIN_ALLOW_THREADS ctx->ctx.insert(
1137+
Py_BEGIN_ALLOW_THREADS ctx->ctx->insert(
11381138
id,
11391139
value,
11401140
[barrier, pyObj_callback, pyObj_errback](
@@ -1155,7 +1155,7 @@ pycbc_txns::transaction_op([[maybe_unused]] PyObject* self, PyObject* args, PyOb
11551155
}
11561156
auto tx_get_result =
11571157
reinterpret_cast<pycbc_txns::transaction_get_result*>(pyObj_txn_get_result);
1158-
Py_BEGIN_ALLOW_THREADS ctx->ctx.replace(
1158+
Py_BEGIN_ALLOW_THREADS ctx->ctx->replace(
11591159
*tx_get_result->res,
11601160
value,
11611161
[pyObj_callback, pyObj_errback, barrier](
@@ -1172,7 +1172,7 @@ pycbc_txns::transaction_op([[maybe_unused]] PyObject* self, PyObject* args, PyOb
11721172
}
11731173
auto tx_get_result =
11741174
reinterpret_cast<pycbc_txns::transaction_get_result*>(pyObj_txn_get_result);
1175-
Py_BEGIN_ALLOW_THREADS ctx->ctx.remove(
1175+
Py_BEGIN_ALLOW_THREADS ctx->ctx->remove(
11761176
*tx_get_result->res, [pyObj_callback, pyObj_errback, barrier](std::exception_ptr err) {
11771177
handle_returning_void(pyObj_callback, pyObj_errback, barrier, err);
11781178
});
@@ -1265,7 +1265,7 @@ pycbc_txns::run_transactions([[maybe_unused]] PyObject* self, PyObject* args, Py
12651265
Py_INCREF(pyObj_inner_exc);
12661266
auto barrier = std::make_shared<std::promise<PyObject*>>();
12671267
auto f = barrier->get_future();
1268-
auto logic = [pyObj_logic, pyObj_inner_exc](tx_core::async_attempt_context& ctx) {
1268+
auto logic = [pyObj_logic, pyObj_inner_exc](std::shared_ptr<tx_core::async_attempt_context> ctx) {
12691269
auto state = PyGILState_Ensure();
12701270
auto py_ctx = new pycbc_txns::attempt_context(ctx);
12711271
PyObject* pyObj_ctx = PyCapsule_New(py_ctx, "ctx_", dealloc_attempt_context);

src/transactions/transactions.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ struct transactions {
118118
};
119119

120120
struct attempt_context {
121-
tx_core::async_attempt_context& ctx;
121+
std::shared_ptr<tx_core::async_attempt_context> ctx;
122122

123-
explicit attempt_context(tx_core::async_attempt_context& ctx)
124-
: ctx(ctx)
123+
explicit attempt_context(std::shared_ptr<tx_core::async_attempt_context> ctx)
124+
: ctx(std::move(ctx))
125125
{
126126
}
127127
};

0 commit comments

Comments
 (0)