• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

daemon/src/core/BundleStorage.h

Go to the documentation of this file.
00001 /*
00002  * BundleStorage.h
00003  *
00004  *  Created on: 24.03.2009
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef BUNDLESTORAGE_H_
00009 #define BUNDLESTORAGE_H_
00010 
00011 #include <ibrdtn/data/Bundle.h>
00012 #include <ibrdtn/data/BundleID.h>
00013 #include <ibrdtn/data/MetaBundle.h>
00014 #include <ibrcommon/data/BloomFilter.h>
00015 
00016 #include <stdexcept>
00017 #include <iterator>
00018 #include <set>
00019 
00020 namespace dtn
00021 {
00022         namespace core
00023         {
00024                 class BundleStorage
00025                 {
00026                 public:
00027                         class NoBundleFoundException : public dtn::MissingObjectException
00028                         {
00029                         public:
00030                                 NoBundleFoundException(string what = "No bundle match the specified criteria.") throw() : dtn::MissingObjectException(what)
00031                                 {
00032                                 };
00033                         };
00034 
00035                         class StorageSizeExeededException : public ibrcommon::Exception
00036                         {
00037                         public:
00038                                 StorageSizeExeededException(string what = "No space left in the storage.") throw() : ibrcommon::Exception(what)
00039                                 {
00040                                 };
00041                         };
00042 
00046                         virtual ~BundleStorage() = 0;
00047 
00053                         void addToFilter(const dtn::data::EID &eid);
00054 
00059                         virtual void store(const dtn::data::Bundle &bundle) = 0;
00060 
00066                         virtual dtn::data::Bundle get(const dtn::data::BundleID &id) = 0;
00067 
00075                         virtual const dtn::data::MetaBundle getByDestination(const dtn::data::EID &eid, bool exact = false) = 0;
00076 
00082                         virtual const dtn::data::MetaBundle getByFilter(const ibrcommon::BloomFilter &filter) = 0;
00083 
00089                         virtual void remove(const dtn::data::BundleID &id) = 0;
00090 
00096                         void remove(const dtn::data::Bundle &b);
00097 
00103                         virtual dtn::data::MetaBundle remove(const ibrcommon::BloomFilter &filter) = 0;
00104 
00108                         virtual void clear() {};
00109 
00113                         virtual bool empty() { return true; };
00114 
00118                         virtual unsigned int count() { return 0; };
00119 
00125                         virtual void releaseCustody(dtn::data::BundleID &bundle) = 0;
00126 
00133                         void acceptCustody(dtn::data::Bundle &bundle);
00134 
00140                         void rejectCustody(const dtn::data::Bundle &bundle);
00141 
00142                 protected:
00146                         BundleStorage();
00147 
00152                         std::set<dtn::data::EID> _destination_filter;
00153                 };
00154         }
00155 }
00156 
00157 #endif /* BUNDLESTORAGE_H_ */

Generated on Thu Nov 11 2010 09:49:46 for IBR-DTNSuite by  doxygen 1.7.1