summaryrefslogtreecommitdiffstats
path: root/src/osdc/Objecter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osdc/Objecter.h')
-rw-r--r--src/osdc/Objecter.h79
1 files changed, 78 insertions, 1 deletions
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h
index 32089f8d89f..28b725e1f1b 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -24,7 +24,6 @@
#include "common/admin_socket.h"
#include "common/Timer.h"
#include "common/RWLock.h"
-#include "include/rados/rados_types.h"
#include "include/rados/rados_types.hpp"
#include <list>
@@ -216,6 +215,14 @@ struct ObjectOperation {
flags |= CEPH_OSD_FLAG_PGOP;
}
+ void pg_nls(uint64_t count, bufferlist& filter, collection_list_handle_t cookie, epoch_t start_epoch) {
+ if (filter.length() == 0)
+ add_pgls(CEPH_OSD_OP_PGNLS, count, cookie, start_epoch);
+ else
+ add_pgls_filter(CEPH_OSD_OP_PGNLS_FILTER, count, filter, cookie, start_epoch);
+ flags |= CEPH_OSD_FLAG_PGOP;
+ }
+
void create(bool excl) {
OSDOp& o = add_op(CEPH_OSD_OP_CREATE);
o.op.flags = (excl ? CEPH_OSD_OP_FLAG_EXCL : 0);
@@ -1242,6 +1249,71 @@ public:
// Pools and statistics
+ struct NListContext {
+ int current_pg;
+ collection_list_handle_t cookie;
+ epoch_t current_pg_epoch;
+ int starting_pg_num;
+ bool at_end_of_pool;
+ bool at_end_of_pg;
+
+ int64_t pool_id;
+ int pool_snap_seq;
+ int max_entries;
+ string nspace;
+
+ bufferlist bl; // raw data read to here
+ std::list<librados::ListObjectImpl> list;
+
+ bufferlist filter;
+
+ bufferlist extra_info;
+
+ // The budget associated with this context, once it is set (>= 0),
+ // the budget is not get/released on OP basis, instead the budget
+ // is acquired before sending the first OP and released upon receiving
+ // the last op reply.
+ int ctx_budget;
+
+ NListContext() : current_pg(0), current_pg_epoch(0), starting_pg_num(0),
+ at_end_of_pool(false),
+ at_end_of_pg(false),
+ pool_id(0),
+ pool_snap_seq(0),
+ max_entries(0),
+ nspace(),
+ bl(),
+ list(),
+ filter(),
+ extra_info(),
+ ctx_budget(-1) {}
+
+ bool at_end() const {
+ return at_end_of_pool;
+ }
+
+ uint32_t get_pg_hash_position() const {
+ return current_pg;
+ }
+ };
+
+ struct C_NList : public Context {
+ NListContext *list_context;
+ Context *final_finish;
+ Objecter *objecter;
+ epoch_t epoch;
+ C_NList(NListContext *lc, Context * finish, Objecter *ob) :
+ list_context(lc), final_finish(finish), objecter(ob), epoch(0) {}
+ void finish(int r) {
+ if (r >= 0) {
+ objecter->_nlist_reply(list_context, r, final_finish, epoch);
+ } else {
+ final_finish->complete(r);
+ }
+ }
+ };
+
+ // Old pgls context we still use for talking to older OSDs
struct ListContext {
int current_pg;
collection_list_handle_t cookie;
@@ -1574,6 +1646,8 @@ public:
void _reopen_session(OSDSession *session);
void close_session(OSDSession *session);
+ void _nlist_reply(NListContext *list_context, int r, Context *final_finish,
+ epoch_t reply_epoch);
void _list_reply(ListContext *list_context, int r, Context *final_finish,
epoch_t reply_epoch);
@@ -1610,6 +1684,7 @@ public:
put_op_budget_bytes(op_budget);
}
void put_list_context_budget(ListContext *list_context);
+ void put_nlist_context_budget(NListContext *list_context);
Throttle op_throttle_bytes, op_throttle_ops;
public:
@@ -2192,6 +2267,8 @@ public:
return op_submit(o);
}
+ void list_nobjects(NListContext *p, Context *onfinish);
+ uint32_t list_nobjects_seek(NListContext *p, uint32_t pos);
void list_objects(ListContext *p, Context *onfinish);
uint32_t list_objects_seek(ListContext *p, uint32_t pos);