+
+memcached_return_t memcached_bucket_set(memcached_st *self,
+ const uint32_t *host_map,
+ const uint32_t *forward_map,
+ const uint32_t buckets,
+ const uint32_t replicas)
+{
+ memcached_return_t rc;
+
+ if (! self)
+ return MEMCACHED_INVALID_ARGUMENTS;
+
+ if (! host_map)
+ return MEMCACHED_INVALID_ARGUMENTS;
+
+ memcached_server_distribution_t old;
+ old= memcached_behavior_get_distribution(self);
+
+ rc =memcached_behavior_set_distribution(self, MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ return rc;
+ }
+
+ rc= memcached_virtual_bucket_create(self, host_map, forward_map, buckets, replicas);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_behavior_set_distribution(self, old);
+ }
+
+ return rc;
+}