return MEMCACHED_SUCCESS;
}
+
+const char * memcached_get_namespace(memcached_st *self)
+{
+ if (not self->_namespace)
+ return NULL;
+
+ return memcached_array_string(self->_namespace);
+}
LIBMEMCACHED_LOCAL
memcached_return_t memcached_set_namespace(memcached_st *self, const char *str, size_t length);
+LIBMEMCACHED_API
+ const char * memcached_get_namespace(memcached_st *self);
+
#ifdef __cplusplus
}
#endif
305, 309, 313, 317, 321, 325, 329, 333, 340, 344,
348, 352, 356, 360, 364, 368, 372, 376, 380, 384,
391, 392, 397, 398, 403, 407, 411, 415, 419, 423,
- 427, 431, 435, 442, 446, 457, 461, 465
+ 427, 431, 435, 442, 446, 453, 457, 461
};
#endif
#line 447 "libmemcached/options/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
- #if 0
- (yyval.string).c_str= (yyvsp[(1) - (1)].string).c_str +1; // +1 to move use passed the initial quote
- (yyval.string).size= (yyvsp[(1) - (1)].string).size -2; // -2 removes the begin and end quote
- #endif
;}
break;
case 65:
/* Line 1464 of yacc.c */
-#line 458 "libmemcached/options/parser.yy"
+#line 454 "libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
;}
case 66:
/* Line 1464 of yacc.c */
-#line 462 "libmemcached/options/parser.yy"
+#line 458 "libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
;}
case 67:
/* Line 1464 of yacc.c */
-#line 466 "libmemcached/options/parser.yy"
+#line 462 "libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
;}
/* Line 1464 of yacc.c */
-#line 2119 "libmemcached/options/parser.cc"
+#line 2115 "libmemcached/options/parser.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
/* Line 1684 of yacc.c */
-#line 471 "libmemcached/options/parser.yy"
+#line 467 "libmemcached/options/parser.yy"
void Context::start()
| QUOTED_STRING
{
$$= $1;
- #if 0
- $$.c_str= $1.c_str +1; // +1 to move use passed the initial quote
- $$.size= $1.size -2; // -2 removes the begin and end quote
- #endif
}
;
Error << "Failed while running on_error()";
break;
}
-
- Logn();
}
if (next->post and world->runner->post)
cleanup:
world->shutdown(creators_ptr);
+ Logn();
}
if (not is_shutdown())
{"server with weights", 0, (test_callback_fn*)server_with_weight_test },
{"parsing servername, port, and weight", 0, (test_callback_fn*)test_hostname_port_weight },
{"--socket=", 0, (test_callback_fn*)test_parse_socket },
+ {"--namespace=", 0, (test_callback_fn*)test_namespace_keyword },
{0, 0, (test_callback_fn*)0}
};
}
// Check and make sure the prefix_key is what we expect it to be
-static test_return_t __check_prefix_key(memcached_st *memc, const scanner_string_st &hostname)
+static test_return_t __check_namespace(memcached_st *memc, const scanner_string_st &arg)
{
- memcached_server_instance_st instance=
- memcached_server_instance_by_position(memc, 0);
-
- test_true(instance);
-
- const char *first_hostname = memcached_server_name(instance);
- test_true(first_hostname);
- test_strcmp(first_hostname, hostname.c_str);
+ const char *_namespace = memcached_get_namespace(memc);
+ test_true(_namespace);
+ test_strcmp(_namespace, arg.c_str);
return TEST_SUCCESS;
}
{ NIL, scanner_string_null, scanner_string_null, NULL}
};
-scanner_variable_t prefix_key_strings[]= {
- { ARRAY, make_scanner_string("--NAMESPACE=foo"), make_scanner_string("foo"), __check_prefix_key },
- { ARRAY, make_scanner_string("--NAMESPACE=\"foo\""), make_scanner_string("foo"), __check_prefix_key },
- { ARRAY, make_scanner_string("--NAMESPACE=\"This_is_a_very_long_key\""), make_scanner_string("This_is_a_very_long_key"), __check_prefix_key },
+scanner_variable_t namespace_strings[]= {
+ { ARRAY, make_scanner_string("--NAMESPACE=foo"), make_scanner_string("foo"), __check_namespace },
+ { ARRAY, make_scanner_string("--NAMESPACE=\"foo\""), make_scanner_string("foo"), __check_namespace },
+ { ARRAY, make_scanner_string("--NAMESPACE=\"This_is_a_very_long_key\""), make_scanner_string("This_is_a_very_long_key"), __check_namespace },
{ NIL, scanner_string_null, scanner_string_null, NULL}
};
return _test_option(distribution_strings);
}
+test_return_t test_namespace_keyword(memcached_st*)
+{
+ return _test_option(namespace_strings);
+}
+
#define SUPPORT_EXAMPLE_CNF "support/example.cnf"
test_return_t memcached_create_with_options_with_filename(memcached_st*)
for (scanner_variable_t *ptr= test_boolean_options; ptr->type != NIL; ptr++)
option_list.push_back(&ptr->option);
- for (scanner_variable_t *ptr= prefix_key_strings; ptr->type != NIL; ptr++)
+ for (scanner_variable_t *ptr= namespace_strings; ptr->type != NIL; ptr++)
option_list.push_back(&ptr->option);
for (scanner_variable_t *ptr= distribution_strings; ptr->type != NIL; ptr++)
LIBTEST_INTERNAL_API
test_return_t test_parse_socket(memcached_st *);
+LIBTEST_INTERNAL_API
+test_return_t test_namespace_keyword(memcached_st*);
+
#ifdef __cplusplus
}
#endif