mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
class: rename ClassLibrary -> ClassInfo
This commit is contained in:
parent
89c826f531
commit
79a14d0367
@ -185,12 +185,12 @@ void handle_notify(MMonObserveNotify *notify)
|
||||
ClassList list;
|
||||
::decode(list, p);
|
||||
// show the first class info
|
||||
map<string, ClassLibrary>::iterator iter = list.library_map.begin();
|
||||
map<string, ClassInfo>::iterator iter = list.library_map.begin();
|
||||
if (iter != list.library_map.end()) {
|
||||
dout(0) << " class " << iter->second << dendl;
|
||||
}
|
||||
} else {
|
||||
ClassLibrary info;
|
||||
ClassInfo info;
|
||||
|
||||
while (!p.end()) {
|
||||
info.decode(p);
|
||||
|
@ -37,7 +37,7 @@ struct ClassImpl {
|
||||
WRITE_CLASS_ENCODER(ClassImpl)
|
||||
|
||||
|
||||
struct ClassLibrary {
|
||||
struct ClassInfo {
|
||||
string name;
|
||||
version_t version;
|
||||
|
||||
@ -51,7 +51,7 @@ struct ClassLibrary {
|
||||
}
|
||||
};
|
||||
|
||||
WRITE_CLASS_ENCODER(ClassLibrary)
|
||||
WRITE_CLASS_ENCODER(ClassInfo)
|
||||
|
||||
struct ClassLibraryIncremental {
|
||||
bool add;
|
||||
@ -74,7 +74,7 @@ struct ClassLibraryIncremental {
|
||||
::decode(i, iter);
|
||||
}
|
||||
|
||||
void decode_info(ClassLibrary& l) {
|
||||
void decode_info(ClassInfo& l) {
|
||||
bufferlist::iterator iter = info.begin();
|
||||
::decode(l, iter);
|
||||
}
|
||||
@ -84,18 +84,18 @@ WRITE_CLASS_ENCODER(ClassLibraryIncremental)
|
||||
|
||||
struct ClassList {
|
||||
version_t version;
|
||||
map<string, ClassLibrary> library_map;
|
||||
map<string, ClassInfo> library_map;
|
||||
|
||||
ClassList() : version(0) {}
|
||||
|
||||
void add(const string& name, const version_t version) {
|
||||
ClassLibrary library;
|
||||
ClassInfo library;
|
||||
library.version = version;
|
||||
library.name = name;
|
||||
add(library);
|
||||
}
|
||||
|
||||
void add(ClassLibrary& library) {
|
||||
void add(ClassInfo& library) {
|
||||
library_map[library.name] = library;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ struct ClassList {
|
||||
}
|
||||
|
||||
bool get_ver(string& name, version_t *ver) {
|
||||
map<string, ClassLibrary>::iterator iter = library_map.find(name);
|
||||
map<string, ClassInfo>::iterator iter = library_map.find(name);
|
||||
if (iter == library_map.end())
|
||||
return false;
|
||||
*ver = (iter->second).version;
|
||||
@ -126,7 +126,7 @@ struct ClassList {
|
||||
};
|
||||
WRITE_CLASS_ENCODER(ClassList)
|
||||
|
||||
inline ostream& operator<<(ostream& out, const ClassLibrary& e)
|
||||
inline ostream& operator<<(ostream& out, const ClassInfo& e)
|
||||
{
|
||||
return out << e.name << " (v" << e.version << ")";
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ enum {
|
||||
class MClass : public Message {
|
||||
public:
|
||||
ceph_fsid_t fsid;
|
||||
deque<ClassLibrary> info;
|
||||
deque<ClassInfo> info;
|
||||
deque<ClassImpl> impl;
|
||||
deque<bool> add;
|
||||
version_t last;
|
||||
|
@ -65,7 +65,7 @@ void ClassMonitor::create_initial(bufferlist& bl)
|
||||
{
|
||||
dout(10) << "create_initial -- creating initial map" << dendl;
|
||||
ClassImpl i;
|
||||
ClassLibrary l;
|
||||
ClassInfo l;
|
||||
l.name = "test";
|
||||
l.version = 12;
|
||||
i.seq = 0;
|
||||
@ -80,7 +80,7 @@ void ClassMonitor::create_initial(bufferlist& bl)
|
||||
pending_class.insert(pair<utime_t,ClassLibraryIncremental>(i.stamp, inc));
|
||||
}
|
||||
|
||||
bool ClassMonitor::store_impl(ClassLibrary& info, ClassImpl& impl)
|
||||
bool ClassMonitor::store_impl(ClassInfo& info, ClassImpl& impl)
|
||||
{
|
||||
char *store_name;
|
||||
int len = info.name.length() + 16;
|
||||
@ -133,7 +133,7 @@ bool ClassMonitor::update_from_paxos()
|
||||
ClassLibraryIncremental inc;
|
||||
::decode(inc, p);
|
||||
ClassImpl impl;
|
||||
ClassLibrary info;
|
||||
ClassInfo info;
|
||||
inc.decode_impl(impl);
|
||||
inc.decode_info(info);
|
||||
if (inc.add) {
|
||||
@ -211,7 +211,7 @@ bool ClassMonitor::preprocess_class(MClass *m)
|
||||
dout(10) << "preprocess_class " << *m << " from " << m->get_orig_source() << dendl;
|
||||
|
||||
int num_new = 0;
|
||||
for (deque<ClassLibrary>::iterator p = m->info.begin();
|
||||
for (deque<ClassInfo>::iterator p = m->info.begin();
|
||||
p != m->info.end();
|
||||
p++) {
|
||||
if (!pending_list.contains((*p).name))
|
||||
@ -235,7 +235,7 @@ bool ClassMonitor::prepare_class(MClass *m)
|
||||
}
|
||||
deque<ClassImpl>::iterator impl_iter = m->impl.begin();
|
||||
|
||||
for (deque<ClassLibrary>::iterator p = m->info.begin();
|
||||
for (deque<ClassInfo>::iterator p = m->info.begin();
|
||||
p != m->info.end();
|
||||
p++, impl_iter++) {
|
||||
dout(10) << " writing class " << *p << dendl;
|
||||
@ -298,7 +298,7 @@ bool ClassMonitor::prepare_command(MMonCommand *m)
|
||||
m->cmd.size() >= 4) {
|
||||
string name = m->cmd[2];
|
||||
version_t ver = atoi(m->cmd[3].c_str());
|
||||
ClassLibrary& info = list.library_map[name];
|
||||
ClassInfo& info = list.library_map[name];
|
||||
ClassImpl impl;
|
||||
impl.binary = m->get_data();
|
||||
dout(0) << "payload.length=" << m->get_data().length() << dendl;
|
||||
@ -337,7 +337,7 @@ void ClassMonitor::handle_request(MClass *m)
|
||||
|
||||
deque<ClassImpl>::iterator impl_iter = m->impl.begin();
|
||||
|
||||
for (deque<ClassLibrary>::iterator p = m->info.begin();
|
||||
for (deque<ClassInfo>::iterator p = m->info.begin();
|
||||
p != m->info.end();
|
||||
p++) {
|
||||
ClassImpl impl;
|
||||
@ -367,7 +367,7 @@ void ClassMonitor::handle_request(MClass *m)
|
||||
{
|
||||
dout(0) << "ClassMonitor::handle_request() CLASS_SET" << dendl;
|
||||
/* FIXME should handle entries removal */
|
||||
ClassLibrary& entry = list.library_map[(*p).name];
|
||||
ClassInfo& entry = list.library_map[(*p).name];
|
||||
entry.name = (*p).name;
|
||||
entry.version = (*p).version;
|
||||
store_impl(entry, *impl_iter);
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
|
||||
bool preprocess_command(MMonCommand *m);
|
||||
bool prepare_command(MMonCommand *m);
|
||||
bool store_impl(ClassLibrary& info, ClassImpl& impl);
|
||||
bool store_impl(ClassInfo& info, ClassImpl& impl);
|
||||
public:
|
||||
ClassMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p) { }
|
||||
void handle_request(MClass *m);
|
||||
|
@ -85,7 +85,7 @@ void ClassHandler::handle_response(MClass *m)
|
||||
{
|
||||
Mutex::Locker locker(mutex);
|
||||
|
||||
deque<ClassLibrary>::iterator info_iter;
|
||||
deque<ClassInfo>::iterator info_iter;
|
||||
deque<ClassImpl>::iterator impl_iter;
|
||||
deque<bool>::iterator add_iter;
|
||||
|
||||
|
@ -3741,7 +3741,7 @@ void OSD::wait_for_no_ops()
|
||||
bool OSD::get_class(const char *name)
|
||||
{
|
||||
MClass *m = new MClass(osdmap->get_fsid(), 0);
|
||||
ClassLibrary info;
|
||||
ClassInfo info;
|
||||
info.name = name;
|
||||
m->info.push_back(info);
|
||||
m->action = CLASS_GET;
|
||||
|
Loading…
Reference in New Issue
Block a user