couchbase 3.0.0.beta.1-universal-darwin-19 → 3.0.0-universal-darwin-19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +227 -0
  3. data/.rubocop_todo.yml +47 -0
  4. data/CONTRIBUTING.md +110 -0
  5. data/Gemfile +4 -0
  6. data/README.md +3 -3
  7. data/Rakefile +1 -1
  8. data/couchbase.gemspec +40 -39
  9. data/examples/analytics.rb +123 -108
  10. data/examples/auth.rb +33 -0
  11. data/examples/crud.rb +16 -2
  12. data/examples/managing_analytics_indexes.rb +18 -4
  13. data/examples/managing_buckets.rb +17 -3
  14. data/examples/managing_collections.rb +22 -9
  15. data/examples/managing_query_indexes.rb +38 -18
  16. data/examples/managing_search_indexes.rb +21 -6
  17. data/examples/managing_view_indexes.rb +18 -4
  18. data/examples/query.rb +17 -3
  19. data/examples/query_with_consistency.rb +30 -20
  20. data/examples/search.rb +116 -101
  21. data/examples/search_with_consistency.rb +43 -30
  22. data/examples/subdocument.rb +42 -30
  23. data/examples/view.rb +19 -10
  24. data/ext/CMakeLists.txt +40 -2
  25. data/ext/build_version.hxx.in +1 -1
  26. data/ext/couchbase/bucket.hxx +190 -38
  27. data/ext/couchbase/cluster.hxx +22 -4
  28. data/ext/couchbase/configuration.hxx +14 -14
  29. data/ext/couchbase/couchbase.cxx +108 -12
  30. data/ext/couchbase/error_map.hxx +202 -2
  31. data/ext/couchbase/errors.hxx +8 -2
  32. data/ext/couchbase/io/dns_client.hxx +6 -6
  33. data/ext/couchbase/io/http_command.hxx +2 -2
  34. data/ext/couchbase/io/http_session.hxx +7 -11
  35. data/ext/couchbase/io/http_session_manager.hxx +3 -3
  36. data/ext/couchbase/io/mcbp_command.hxx +101 -44
  37. data/ext/couchbase/io/mcbp_session.hxx +144 -49
  38. data/ext/couchbase/io/retry_action.hxx +30 -0
  39. data/ext/couchbase/io/retry_context.hxx +39 -0
  40. data/ext/couchbase/io/retry_orchestrator.hxx +96 -0
  41. data/ext/couchbase/io/retry_reason.hxx +235 -0
  42. data/ext/couchbase/io/retry_strategy.hxx +156 -0
  43. data/ext/couchbase/operations/document_decrement.hxx +2 -0
  44. data/ext/couchbase/operations/document_exists.hxx +2 -0
  45. data/ext/couchbase/operations/document_get.hxx +2 -0
  46. data/ext/couchbase/operations/document_get_and_lock.hxx +2 -0
  47. data/ext/couchbase/operations/document_get_and_touch.hxx +2 -0
  48. data/ext/couchbase/operations/document_get_projected.hxx +2 -0
  49. data/ext/couchbase/operations/document_increment.hxx +2 -0
  50. data/ext/couchbase/operations/document_insert.hxx +2 -0
  51. data/ext/couchbase/operations/document_lookup_in.hxx +2 -0
  52. data/ext/couchbase/operations/document_mutate_in.hxx +3 -0
  53. data/ext/couchbase/operations/document_query.hxx +10 -0
  54. data/ext/couchbase/operations/document_remove.hxx +2 -0
  55. data/ext/couchbase/operations/document_replace.hxx +2 -0
  56. data/ext/couchbase/operations/document_search.hxx +8 -3
  57. data/ext/couchbase/operations/document_touch.hxx +2 -0
  58. data/ext/couchbase/operations/document_unlock.hxx +2 -0
  59. data/ext/couchbase/operations/document_upsert.hxx +2 -0
  60. data/ext/couchbase/operations/query_index_create.hxx +14 -4
  61. data/ext/couchbase/operations/query_index_drop.hxx +12 -2
  62. data/ext/couchbase/operations/query_index_get_all.hxx +11 -2
  63. data/ext/couchbase/origin.hxx +47 -17
  64. data/ext/couchbase/platform/backtrace.c +189 -0
  65. data/ext/couchbase/platform/backtrace.h +54 -0
  66. data/ext/couchbase/platform/terminate_handler.cc +122 -0
  67. data/ext/couchbase/platform/terminate_handler.h +36 -0
  68. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +6 -1
  69. data/ext/couchbase/protocol/status.hxx +14 -4
  70. data/ext/couchbase/version.hxx +2 -2
  71. data/ext/extconf.rb +39 -36
  72. data/ext/test/main.cxx +64 -16
  73. data/lib/couchbase.rb +0 -1
  74. data/lib/couchbase/analytics_options.rb +2 -4
  75. data/lib/couchbase/authenticator.rb +14 -0
  76. data/lib/couchbase/binary_collection.rb +9 -9
  77. data/lib/couchbase/binary_collection_options.rb +8 -6
  78. data/lib/couchbase/bucket.rb +18 -18
  79. data/lib/couchbase/cluster.rb +121 -90
  80. data/lib/couchbase/collection.rb +36 -38
  81. data/lib/couchbase/collection_options.rb +31 -17
  82. data/lib/couchbase/common_options.rb +1 -1
  83. data/lib/couchbase/datastructures/couchbase_list.rb +16 -16
  84. data/lib/couchbase/datastructures/couchbase_map.rb +18 -18
  85. data/lib/couchbase/datastructures/couchbase_queue.rb +13 -13
  86. data/lib/couchbase/datastructures/couchbase_set.rb +8 -7
  87. data/lib/couchbase/errors.rb +10 -3
  88. data/lib/couchbase/json_transcoder.rb +2 -2
  89. data/lib/couchbase/libcouchbase.bundle +0 -0
  90. data/lib/couchbase/management/analytics_index_manager.rb +37 -37
  91. data/lib/couchbase/management/bucket_manager.rb +25 -25
  92. data/lib/couchbase/management/collection_manager.rb +3 -3
  93. data/lib/couchbase/management/query_index_manager.rb +59 -14
  94. data/lib/couchbase/management/search_index_manager.rb +15 -12
  95. data/lib/couchbase/management/user_manager.rb +1 -1
  96. data/lib/couchbase/management/view_index_manager.rb +11 -5
  97. data/lib/couchbase/mutation_state.rb +12 -0
  98. data/lib/couchbase/query_options.rb +23 -9
  99. data/lib/couchbase/scope.rb +61 -1
  100. data/lib/couchbase/search_options.rb +40 -27
  101. data/lib/couchbase/subdoc.rb +31 -28
  102. data/lib/couchbase/version.rb +2 -2
  103. data/lib/couchbase/view_options.rb +0 -1
  104. metadata +20 -7
@@ -0,0 +1,189 @@
1
+ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2015 Couchbase, Inc
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #include <inttypes.h>
19
+ #include <platform/backtrace.h>
20
+ #include <strings.h>
21
+
22
+ #if defined(WIN32) && defined(HAVE_BACKTRACE_SUPPORT)
23
+ #define WIN32_LEAN_AND_MEAN
24
+ #include <windows.h>
25
+ #include <Dbghelp.h>
26
+ #endif
27
+
28
+ #if defined(HAVE_BACKTRACE) && defined(HAVE_DLADDR)
29
+ #define HAVE_BACKTRACE_SUPPORT 1
30
+ #include <execinfo.h> // for backtrace()
31
+ #include <dlfcn.h> // for dladdr()
32
+ #include <stddef.h> // for ptrdiff_t
33
+ #endif
34
+
35
+ // Maximum number of frames that will be printed.
36
+ #define MAX_FRAMES 50
37
+
38
+ #if defined(HAVE_BACKTRACE_SUPPORT)
39
+ /**
40
+ * Populates buf with a description of the given address in the program.
41
+ **/
42
+ static void
43
+ describe_address(char* msg, size_t len, void* addr)
44
+ {
45
+ #if defined(WIN32)
46
+
47
+ // Get module information
48
+ IMAGEHLP_MODULE64 module_info;
49
+ module_info.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
50
+ SymGetModuleInfo64(GetCurrentProcess(), (DWORD64)addr, &module_info);
51
+
52
+ // Get symbol information.
53
+ DWORD64 displacement = 0;
54
+ char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
55
+ PSYMBOL_INFO sym_info = (PSYMBOL_INFO)buffer;
56
+ sym_info->SizeOfStruct = sizeof(SYMBOL_INFO);
57
+ sym_info->MaxNameLen = MAX_SYM_NAME;
58
+
59
+ if (SymFromAddr(GetCurrentProcess(), (DWORD64)addr, &displacement, sym_info)) {
60
+ snprintf(msg, len, "%s(%s+%lld) [0x%p]", module_info.ImageName ? module_info.ImageName : "", sym_info->Name, displacement, addr);
61
+ } else {
62
+ // No symbol found.
63
+ snprintf(msg, len, "[0x%p]", addr);
64
+ }
65
+ #else // !WIN32
66
+ Dl_info info;
67
+ int status = dladdr(addr, &info);
68
+
69
+ if (status != 0) {
70
+ ptrdiff_t image_offset = (char*)addr - (char*)info.dli_fbase;
71
+ if (info.dli_fname != NULL && info.dli_fname[0] != '\0') {
72
+ // Found a nearest symbol - print it.
73
+ if (info.dli_saddr == 0) {
74
+ // No function offset calculation possible.
75
+ snprintf(msg,
76
+ len,
77
+ "%s(%s) [%p+0x%" PRIx64 "]",
78
+ info.dli_fname,
79
+ info.dli_sname ? info.dli_sname : "",
80
+ info.dli_fbase,
81
+ (uint64_t)image_offset);
82
+ } else {
83
+ char sign;
84
+ ptrdiff_t offset;
85
+ if (addr >= info.dli_saddr) {
86
+ sign = '+';
87
+ offset = (char*)addr - (char*)info.dli_saddr;
88
+ } else {
89
+ sign = '-';
90
+ offset = (char*)info.dli_saddr - (char*)addr;
91
+ }
92
+ snprintf(msg,
93
+ len,
94
+ "%s(%s%c%#tx) [%p+0x%" PRIx64 "]",
95
+ info.dli_fname,
96
+ info.dli_sname ? info.dli_sname : "",
97
+ sign,
98
+ offset,
99
+ info.dli_fbase,
100
+ (uint64_t)image_offset);
101
+ }
102
+ } else {
103
+ // No function found; just print library name and offset.
104
+ snprintf(msg, len, "%s [%p+0x%" PRIx64 "]", info.dli_fname, info.dli_fbase, (uint64_t)image_offset);
105
+ }
106
+ } else {
107
+ // dladdr failed.
108
+ snprintf(msg, len, "[%p]", addr);
109
+ }
110
+ #endif // WIN32
111
+ }
112
+
113
+ void
114
+ print_backtrace(write_cb_t write_cb, void* context)
115
+ {
116
+ void* frames[MAX_FRAMES];
117
+ #if defined(WIN32)
118
+ int active_frames = CaptureStackBackTrace(0, MAX_FRAMES, frames, NULL);
119
+ SymInitialize(GetCurrentProcess(), NULL, TRUE);
120
+ #else
121
+ int active_frames = backtrace(frames, MAX_FRAMES);
122
+ #endif
123
+
124
+ // Note we start from 1 to skip our own frame.
125
+ for (int ii = 1; ii < active_frames; ii++) {
126
+ // Fixed-sized buffer; possible that description will be cropped.
127
+ char msg[300];
128
+ describe_address(msg, sizeof(msg), frames[ii]);
129
+ write_cb(context, msg);
130
+ }
131
+ if (active_frames == MAX_FRAMES) {
132
+ write_cb(context, "<frame limit reached, possible truncation>");
133
+ }
134
+ }
135
+
136
+ #else // if defined(HAVE_BACKTRACE_SUPPORT)
137
+
138
+ void
139
+ print_backtrace(write_cb_t write_cb, void* context)
140
+ {
141
+ write_cb(context, "<backtrace not supported on this platform>");
142
+ }
143
+
144
+ #endif // defined(HAVE_BACKTRACE_SUPPORT)
145
+
146
+ static void
147
+ print_to_file_cb(void* ctx, const char* frame)
148
+ {
149
+ fprintf(ctx, "\t%s\n", frame);
150
+ }
151
+
152
+ void
153
+ print_backtrace_to_file(FILE* stream)
154
+ {
155
+ print_backtrace(print_to_file_cb, stream);
156
+ }
157
+
158
+ struct context {
159
+ const char* indent;
160
+ char* buffer;
161
+ size_t size;
162
+ size_t offset;
163
+ bool error;
164
+ };
165
+
166
+ static void
167
+ memory_cb(void* ctx, const char* frame)
168
+ {
169
+ struct context* c = ctx;
170
+
171
+ if (!c->error) {
172
+
173
+ int length = snprintf(c->buffer + c->offset, c->size - c->offset, "%s%s\n", c->indent, frame);
174
+
175
+ if ((length < 0) || (length >= (c->size - c->offset))) {
176
+ c->error = true;
177
+ } else {
178
+ c->offset += length;
179
+ }
180
+ }
181
+ }
182
+
183
+ bool
184
+ print_backtrace_to_buffer(const char* indent, char* buffer, size_t size)
185
+ {
186
+ struct context c = { .indent = indent, .buffer = buffer, .size = size, .offset = 0, .error = false };
187
+ print_backtrace(memory_cb, &c);
188
+ return !c.error;
189
+ }
@@ -0,0 +1,54 @@
1
+ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2015 Couchbase, Inc
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #include <stdio.h>
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #else
23
+ #include <stdbool.h>
24
+ #endif
25
+
26
+ typedef void (*write_cb_t)(void* ctx, const char* frame);
27
+
28
+ /**
29
+ * Prints a backtrace from the current thread. For each frame, the
30
+ * `write_cb` function is called with `context` and a string describing
31
+ * the frame.
32
+ */
33
+ void
34
+ print_backtrace(write_cb_t write_cb, void* context);
35
+
36
+ /**
37
+ * Convenience function - prints a backtrace to the specified FILE.
38
+ */
39
+ void
40
+ print_backtrace_to_file(FILE* stream);
41
+
42
+ /**
43
+ * print a backtrace to a buffer
44
+ *
45
+ * @param indent the indent used for each entry in the callstack
46
+ * @param buffer the buffer to populate with the backtrace
47
+ * @param size the size of the input buffer
48
+ */
49
+ bool
50
+ print_backtrace_to_buffer(const char* indent, char* buffer, size_t size);
51
+
52
+ #ifdef __cplusplus
53
+ } // extern "C"
54
+ #endif
@@ -0,0 +1,122 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2016 Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #include <platform/terminate_handler.h>
19
+
20
+ #include <cstdlib>
21
+ #include <exception>
22
+
23
+ #include <spdlog/spdlog.h>
24
+ #include <platform/backtrace.h>
25
+
26
+ #include <version.hxx>
27
+
28
+ namespace couchbase::platform
29
+ {
30
+ static bool should_include_backtrace = true;
31
+ static std::terminate_handler default_terminate_handler = nullptr;
32
+
33
+ // Logs details on the handled exception. Attempts to log to
34
+ // `terminate_logger` if non-null; otherwise prints to stderr.
35
+ static void
36
+ log_handled_exception()
37
+ {
38
+ #ifdef WIN32
39
+ // Windows doesn't like us re-throwing the exception in the handler (and
40
+ // seems to result in immediate process termination). As such skip logging
41
+ // the exception here.
42
+ return;
43
+ #endif
44
+ // Attempt to get the exception's what() message.
45
+ try {
46
+ static int tried_throw = 0;
47
+ // try once to re-throw currently active exception (so we can print
48
+ // its what() message).
49
+ if (tried_throw++ == 0) {
50
+ throw;
51
+ }
52
+ } catch (const std::exception& e) {
53
+ spdlog::critical("Caught unhandled std::exception-derived exception. what(): {}", e.what());
54
+ } catch (...) {
55
+ spdlog::critical("Caught unknown/unhandled exception.");
56
+ }
57
+ }
58
+
59
+ // Log the symbolified backtrace to this point.
60
+ static void
61
+ log_backtrace()
62
+ {
63
+ static const char format_str[] = "Call stack:\n%s";
64
+
65
+ char buffer[4096];
66
+ if (print_backtrace_to_buffer(" ", buffer, sizeof(buffer))) {
67
+ spdlog::critical("Call stack:\n{}", buffer);
68
+ } else {
69
+ // Exceeded buffer space - print directly to stderr FD (requires no
70
+ // buffering, but has the disadvantage that we don't get it in the log).
71
+ fprintf(stderr, format_str, "");
72
+ print_backtrace_to_file(stderr);
73
+ fflush(stderr);
74
+ spdlog::critical("Call stack exceeds 4k");
75
+ }
76
+ }
77
+
78
+ // Replacement terminate_handler which prints the exception's what() and a
79
+ // backtrace of the current stack before chaining to the default handler.
80
+ static void
81
+ backtrace_terminate_handler()
82
+ {
83
+ spdlog::critical("*** Fatal error encountered during exception handling (rev=\"" BACKEND_GIT_REVISION "\", compiler=\"" BACKEND_CXX_COMPILER
84
+ "\", system=\"" BACKEND_SYSTEM "\", date=\"" BACKEND_BUILD_TIMESTAMP "\")***");
85
+ log_handled_exception();
86
+
87
+ if (should_include_backtrace) {
88
+ log_backtrace();
89
+ }
90
+
91
+ // Chain to the default handler if available (as it may be able to print
92
+ // other useful information on why we were told to terminate).
93
+ if (default_terminate_handler != nullptr) {
94
+ default_terminate_handler();
95
+ }
96
+
97
+ #if !defined(HAVE_BREAKPAD)
98
+ // Shut down the logger (and flush everything). If breakpad is installed
99
+ // then we'll let it do it.
100
+ spdlog::shutdown();
101
+ #endif
102
+
103
+ std::abort();
104
+ }
105
+
106
+ void
107
+ install_backtrace_terminate_handler()
108
+ {
109
+ if (default_terminate_handler != nullptr) {
110
+ // restore the previously saved one before (re)installing ours.
111
+ std::set_terminate(default_terminate_handler);
112
+ }
113
+ default_terminate_handler = std::set_terminate(backtrace_terminate_handler);
114
+ }
115
+
116
+ void
117
+ set_terminate_handler_print_backtrace(bool print)
118
+ {
119
+ should_include_backtrace = print;
120
+ }
121
+
122
+ } // namespace couchbase::platform
@@ -0,0 +1,36 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2016 Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #pragma once
19
+
20
+ namespace couchbase::platform
21
+ {
22
+ /**
23
+ * Interposes our own C++ terminate handler to print backtrace upon failures.
24
+ * Chains to the default handler (if exists) after printing the backtrace,
25
+ * then calls std::abort().
26
+ */
27
+ void
28
+ install_backtrace_terminate_handler();
29
+
30
+ /**
31
+ * Control if our C++ terminate handler should include a backtrace or not.
32
+ */
33
+ void
34
+ set_terminate_handler_print_backtrace(bool print);
35
+
36
+ } // namespace couchbase::platform
@@ -47,6 +47,11 @@ struct deduplicate_keys : Consumer {
47
47
  };
48
48
  } // namespace
49
49
 
50
+ template<typename Iterator>
51
+ configuration parse_config(Iterator begin, Iterator end) {
52
+ return tao::json::from_string<deduplicate_keys>(std::string(begin, end)).as<configuration>();
53
+ }
54
+
50
55
  class get_cluster_config_response_body
51
56
  {
52
57
  public:
@@ -72,7 +77,7 @@ class get_cluster_config_response_body
72
77
  Expects(header[1] == static_cast<uint8_t>(opcode));
73
78
  if (status == protocol::status::success) {
74
79
  std::vector<uint8_t>::difference_type offset = framing_extras_size + key_size + extras_size;
75
- config_ = tao::json::from_string<deduplicate_keys>(std::string(body.begin() + offset, body.end())).as<configuration>();
80
+ config_ = parse_config(body.begin() + offset, body.end());
76
81
  return true;
77
82
  }
78
83
  return false;
@@ -45,7 +45,7 @@ enum class status : uint16_t {
45
45
  not_supported = 0x83,
46
46
  internal = 0x84,
47
47
  busy = 0x85,
48
- temp_failure = 0x86,
48
+ temporary_failure = 0x86,
49
49
  xattr_invalid = 0x87,
50
50
  unknown_collection = 0x88,
51
51
  no_collections_manifest = 0x89,
@@ -108,7 +108,7 @@ is_valid_status(uint16_t code)
108
108
  case status::not_supported:
109
109
  case status::internal:
110
110
  case status::busy:
111
- case status::temp_failure:
111
+ case status::temporary_failure:
112
112
  case status::xattr_invalid:
113
113
  case status::unknown_collection:
114
114
  case status::no_collections_manifest:
@@ -146,6 +146,16 @@ is_valid_status(uint16_t code)
146
146
  }
147
147
  return false;
148
148
  }
149
+
150
+ [[nodiscard]] std::string
151
+ status_to_string(uint16_t code)
152
+ {
153
+ if (is_valid_status(code)) {
154
+ return fmt::format("{} ({})", code, static_cast<status>(code));
155
+ }
156
+ return fmt::format("{} (unknown)", code);
157
+ }
158
+
149
159
  } // namespace protocol
150
160
  } // namespace couchbase
151
161
 
@@ -225,8 +235,8 @@ struct fmt::formatter<couchbase::protocol::status> : formatter<string_view> {
225
235
  case couchbase::protocol::status::busy:
226
236
  name = "busy";
227
237
  break;
228
- case couchbase::protocol::status::temp_failure:
229
- name = "temp_failure";
238
+ case couchbase::protocol::status::temporary_failure:
239
+ name = "temporary_failure";
230
240
  break;
231
241
  case couchbase::protocol::status::xattr_invalid:
232
242
  name = "xattr_invalid";