@@ -3157,29 +3157,29 @@ cb_Backend_document_lookup_in(VALUE self, VALUE bucket, VALUE scope, VALUE colle
31573157 cb_extract_timeout (req, options);
31583158 cb_extract_option_bool (req.access_deleted , options, " access_deleted" );
31593159 auto entries_size = static_cast <std::size_t >(RARRAY_LEN (specs));
3160- req. specs . entries . reserve (entries_size) ;
3160+ couchbase::lookup_in_specs cxx_specs ;
31613161 for (size_t i = 0 ; i < entries_size; ++i) {
31623162 VALUE entry = rb_ary_entry (specs, static_cast <long >(i));
31633163 cb_check_type (entry, T_HASH);
31643164 VALUE operation = rb_hash_aref (entry, rb_id2sym (rb_intern (" opcode" )));
31653165 cb_check_type (operation, T_SYMBOL);
3166- couchbase::core::protocol::subdoc_opcode opcode{};
3166+ bool xattr = RTEST (rb_hash_aref (entry, rb_id2sym (rb_intern (" xattr" ))));
3167+ VALUE path = rb_hash_aref (entry, rb_id2sym (rb_intern (" path" )));
3168+ cb_check_type (path, T_STRING);
31673169 if (ID operation_id = rb_sym2id (operation); operation_id == rb_intern (" get_doc" )) {
3168- opcode = couchbase::core::protocol::subdoc_opcode::get_doc ;
3170+ cxx_specs. push_back ( couchbase::lookup_in_specs::get ( " " ). xattr (xattr)) ;
31693171 } else if (operation_id == rb_intern (" get" )) {
3170- opcode = couchbase::core::protocol::subdoc_opcode:: get;
3172+ cxx_specs. push_back ( couchbase::lookup_in_specs:: get ( cb_string_new (path)). xattr (xattr)) ;
31713173 } else if (operation_id == rb_intern (" exists" )) {
3172- opcode = couchbase::core::protocol::subdoc_opcode:: exists;
3174+ cxx_specs. push_back ( couchbase::lookup_in_specs:: exists ( cb_string_new (path)). xattr (xattr)) ;
31733175 } else if (operation_id == rb_intern (" count" )) {
3174- opcode = couchbase::core::protocol::subdoc_opcode::get_count ;
3176+ cxx_specs. push_back ( couchbase::lookup_in_specs::count ( cb_string_new (path)). xattr (xattr)) ;
31753177 } else {
31763178 throw ruby_exception (eInvalidArgument, rb_sprintf (" unsupported operation for subdocument lookup: %+" PRIsVALUE, operation));
31773179 }
3178- bool xattr = RTEST (rb_hash_aref (entry, rb_id2sym (rb_intern (" xattr" ))));
3179- VALUE path = rb_hash_aref (entry, rb_id2sym (rb_intern (" path" )));
31803180 cb_check_type (path, T_STRING);
3181- req.specs .add_spec (opcode, xattr, cb_string_new (path));
31823181 }
3182+ req.specs = cxx_specs.specs ();
31833183
31843184 auto barrier = std::make_shared<std::promise<couchbase::core::operations::lookup_in_response>>();
31853185 auto f = barrier->get_future ();
@@ -3202,11 +3202,11 @@ cb_Backend_document_lookup_in(VALUE self, VALUE bucket, VALUE scope, VALUE colle
32023202 rb_hash_aset (entry, rb_id2sym (rb_intern (" exists" )), resp.fields [i].exists ? Qtrue : Qfalse);
32033203 rb_hash_aset (entry, rb_id2sym (rb_intern (" path" )), cb_str_new (resp.fields [i].path ));
32043204 rb_hash_aset (entry, rb_id2sym (rb_intern (" value" )), cb_str_new (resp.fields [i].value ));
3205- cb_map_subdoc_status (resp.fields [i].status , i, resp.fields [i].path , entry);
3206- if (resp.fields [i].opcode == couchbase::core::protocol::subdoc_opcode::get && resp.fields [i].path .empty ()) {
3205+ cb_map_subdoc_status (resp.fields_meta [i].status , i, resp.fields [i].path , entry);
3206+ if (resp.fields_meta [i].opcode == couchbase::core::protocol::subdoc_opcode::get && resp.fields [i].path .empty ()) {
32073207 rb_hash_aset (entry, rb_id2sym (rb_intern (" type" )), rb_id2sym (rb_intern (" get_doc" )));
32083208 } else {
3209- rb_hash_aset (entry, rb_id2sym (rb_intern (" type" )), cb_map_subdoc_opcode (resp.fields [i].opcode ));
3209+ rb_hash_aset (entry, rb_id2sym (rb_intern (" type" )), cb_map_subdoc_opcode (resp.fields_meta [i].opcode ));
32103210 }
32113211 rb_ary_store (fields, static_cast <long >(i), entry);
32123212 }
@@ -3348,8 +3348,8 @@ cb_Backend_document_mutate_in(VALUE self, VALUE bucket, VALUE scope, VALUE colle
33483348 }
33493349
33503350 VALUE res = cb_extract_mutation_result (resp);
3351- if (resp.first_error_index ) {
3352- rb_hash_aset (res, rb_id2sym (rb_intern (" first_error_index" )), ULL2NUM (resp.first_error_index .value ()));
3351+ if (resp.ctx . first_error_index () ) {
3352+ rb_hash_aset (res, rb_id2sym (rb_intern (" first_error_index" )), ULL2NUM (resp.ctx . first_error_index () .value ()));
33533353 }
33543354 if (resp.deleted ) {
33553355 rb_hash_aset (res, rb_id2sym (rb_intern (" deleted" )), Qtrue);
0 commit comments