}
int cls_cxx_map_get_keys(cls_method_context_t hctx, const string &start_obj,
- uint64_t max_to_get, std::set<string> *keys) {
+ uint64_t max_to_get, std::set<string> *keys, bool *more) {
librados::TestClassHandler::MethodContext *ctx =
reinterpret_cast<librados::TestClassHandler::MethodContext*>(hctx);
keys->clear();
std::map<string, bufferlist> vals;
- std::string last_key = start_obj;
- do {
- vals.clear();
- int r = ctx->io_ctx_impl->omap_get_vals(ctx->oid, last_key, "", 1024,
- &vals);
- if (r < 0) {
- return r;
- }
+ int r = ctx->io_ctx_impl->omap_get_vals2(ctx->oid, start_obj, "", max_to_get,
+ &vals, more);
+ if (r < 0) {
+ return r;
+ }
- for (std::map<string, bufferlist>::iterator it = vals.begin();
- it != vals.end(); ++it) {
- last_key = it->first;
- keys->insert(last_key);
- }
- } while (!vals.empty());
+ for (std::map<string, bufferlist>::iterator it = vals.begin();
+ it != vals.end(); ++it) {
+ keys->insert(it->first);
+ }
return keys->size();
}
int cls_cxx_map_get_vals(cls_method_context_t hctx, const string &start_obj,
const string &filter_prefix, uint64_t max_to_get,
- std::map<string, bufferlist> *vals) {
+ std::map<string, bufferlist> *vals, bool *more) {
librados::TestClassHandler::MethodContext *ctx =
reinterpret_cast<librados::TestClassHandler::MethodContext*>(hctx);
- int r = ctx->io_ctx_impl->omap_get_vals(ctx->oid, start_obj, filter_prefix,
- max_to_get, vals);
+ int r = ctx->io_ctx_impl->omap_get_vals2(ctx->oid, start_obj, filter_prefix,
+ max_to_get, vals, more);
if (r < 0) {
return r;
}
const std::string &filter_prefix,
uint64_t max_return,
std::map<std::string, bufferlist> *out_vals) = 0;
+ virtual int omap_get_vals2(const std::string& oid,
+ const std::string& start_after,
+ const std::string &filter_prefix,
+ uint64_t max_return,
+ std::map<std::string, bufferlist> *out_vals,
+ bool *pmore) = 0;
virtual int omap_rm_keys(const std::string& oid,
const std::set<std::string>& keys) = 0;
virtual int omap_set(const std::string& oid,
}
-int TestMemIoCtxImpl::omap_get_vals(const std::string& oid,
+int TestMemIoCtxImpl::omap_get_vals2(const std::string& oid,
const std::string& start_after,
const std::string &filter_prefix,
uint64_t max_return,
- std::map<std::string, bufferlist> *out_vals) {
+ std::map<std::string, bufferlist> *out_vals,
+ bool *pmore) {
if (out_vals == NULL) {
return -EINVAL;
} else if (m_client->is_blacklisted()) {
RWLock::RLocker l(file->lock);
TestMemCluster::FileOMaps::iterator o_it = m_pool->file_omaps.find(oid);
if (o_it == m_pool->file_omaps.end()) {
+ if (pmore) {
+ *pmore = false;
+ }
return 0;
}
}
++it;
}
+ if (pmore) {
+ *pmore = (it != omap.end());
+ }
return 0;
}
+int TestMemIoCtxImpl::omap_get_vals(const std::string& oid,
+ const std::string& start_after,
+ const std::string &filter_prefix,
+ uint64_t max_return,
+ std::map<std::string, bufferlist> *out_vals) {
+ return omap_get_vals2(oid, start_after, filter_prefix, max_return, out_vals, nullptr);
+}
+
int TestMemIoCtxImpl::omap_rm_keys(const std::string& oid,
const std::set<std::string>& keys) {
if (get_snap_read() != CEPH_NOSNAP) {
const std::string &filter_prefix,
uint64_t max_return,
std::map<std::string, bufferlist> *out_vals) override;
+ int omap_get_vals2(const std::string& oid,
+ const std::string& start_after,
+ const std::string &filter_prefix,
+ uint64_t max_return,
+ std::map<std::string, bufferlist> *out_vals,
+ bool *pmore) override;
int omap_rm_keys(const std::string& oid,
const std::set<std::string>& keys) override;
int omap_set(const std::string& oid, const std::map<std::string,