// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef __MOSDGETMAPACK_H #define __MOSDGETMAPACK_H #include "msg/Message.h" #include "osd/OSDMap.h" class MOSDMap : public Message { public: map maps; map incremental_maps; epoch_t get_first() { epoch_t e = 0; map::iterator i = maps.begin(); if (i != maps.end()) e = i->first; i = incremental_maps.begin(); if (i != incremental_maps.end() && (e == 0 || i->first < e)) e = i->first; return e; } epoch_t get_last() { epoch_t e = 0; map::reverse_iterator i = maps.rbegin(); if (i != maps.rend()) e = i->first; i = incremental_maps.rbegin(); if (i != incremental_maps.rend() && (e == 0 || i->first > e)) e = i->first; return e; } MOSDMap() : Message(MSG_OSD_MAP) {} MOSDMap(OSDMap *oc) : Message(MSG_OSD_MAP) { oc->encode(maps[oc->get_epoch()]); } // marshalling virtual void decode_payload() { int off = 0; ::_decode(maps, payload, off); ::_decode(incremental_maps, payload, off); } virtual void encode_payload() { ::_encode(maps, payload); ::_encode(incremental_maps, payload); } virtual char *get_type_name() { return "omap"; } }; #endif