case EVENT_RESETJOURNAL: le = new EResetJournal; break;
case EVENT_SESSION: le = new ESession; break;
+ case EVENT_SESSIONS_OLD: le = new ESessions; ((ESessions *)le)->mark_old_encoding(); break;
case EVENT_SESSIONS: le = new ESessions; break;
case EVENT_UPDATE: le = new EUpdate; break;
#define EVENT_RESETJOURNAL 9
#define EVENT_SESSION 10
-#define EVENT_SESSIONS 11
+#define EVENT_SESSIONS_OLD 11
+#define EVENT_SESSIONS 12
#define EVENT_UPDATE 20
#define EVENT_SLAVEUPDATE 21
public:
map<client_t,entity_inst_t> client_map;
+ bool old_style_encode;
- ESessions() : LogEvent(EVENT_SESSIONS) { }
+ ESessions() : LogEvent(EVENT_SESSIONS), old_style_encode(false) { }
ESessions(version_t pv, map<client_t,entity_inst_t>& cm) :
LogEvent(EVENT_SESSIONS),
- cmapv(pv) {
+ cmapv(pv),
+ old_style_encode(false) {
client_map.swap(cm);
}
+
+ void mark_old_encoding() { old_style_encode = true; }
void encode(bufferlist &bl) const {
+ ENCODE_START(1, 1, bl);
::encode(client_map, bl);
::encode(cmapv, bl);
::encode(stamp, bl);
+ ENCODE_FINISH(bl);
}
- void decode(bufferlist::iterator &bl) {
+ void decode_old(bufferlist::iterator &bl) {
::decode(client_map, bl);
::decode(cmapv, bl);
if (!bl.end())
::decode(stamp, bl);
}
+ void decode_new(bufferlist::iterator &bl) {
+ DECODE_START(1, bl);
+ ::decode(client_map, bl);
+ ::decode(cmapv, bl);
+ if (!bl.end())
+ ::decode(stamp, bl);
+ DECODE_FINISH(bl);
+ }
+ void decode(bufferlist::iterator &bl) {
+ if (old_style_encode) decode_old(bl);
+ else decode_new(bl);
+ }
void print(ostream& out) {