The two implementations are part of two different objects. One is the Bundle which contains the whole bundle data including all block. MetaBundle is just a summary of the bundle and used at several places where only meta-data is needed.
The sorting process is done during the insertion. You should read the documentation for std::set objects in C++. The objects in there are always sorted. This sort can customized by using a comparison method. CMP_BUNDLE_PRIORITY is such a method and implements a strict ordering based on the priority. "lhs" and "rhs" are just variables for the left and right bundle to compare.
Kind regards, Johannes
-------- Weitergeleitete Nachricht -------- Von: Alex López lopalex87@gmail.com An: Johannes Morgenroth morgenroth@ibr.cs.tu-bs.de Kopie: ibr-dtn@ibr.cs.tu-bs.de Betreff: Re: [ibr-dtn] How Priority parameter works? Datum: Fri, 11 Jan 2013 16:08:51 +0100
Thank you for your fast answer Johannes.
That's the thing that bothers me, why do you have 2 implementations for the same thing? Which one are you finally using?
About what you explain how bundle priority is working, I have figured it more or less reading the code, but it would be really helpful to now where specifically in the code is this ordered list defined, or where "storage sort all the bundles according to the priority and iterate them in this order." is implemented in the code.
I found that this function has something to do about this, but I don't understand really well how it works:
ibrcommon::Mutex _bundleslock; 00112 std::setdtn::data::Bundle _bundles; 00113 00114 struct CMP_BUNDLE_PRIORITY 00115 { 00116 bool operator() (const dtn::data::MetaBundle& lhs, const dtn::data::MetaBundle& rhs) const 00117 { 00118 if (lhs.getPriority() == rhs.getPriority()) 00119 return rhs > lhs; 00120 00121 return (lhs.getPriority() > rhs.getPriority()); 00122 } 00123 }; 00124 00125 std::set<dtn::data::MetaBundle, CMP_BUNDLE_PRIORITY> _priority_index; 00126 std::map<dtn::data::BundleID, ssize_t> _bundle_lengths; 00127 00128 size_t _maxsize; 00129 size_t _currentsize;
What's the meaning of rhs and lhs? It's maybe _priority_index the ordered list are you talking about? If it's so, where is the sorting process done? I think this function works to compare the priorities, but I can't find the function that pushes forward or pull back the files in the storage sorted list.
Thanks,
Alex López.
May
2013/1/11 Johannes Morgenroth morgenroth@ibr.cs.tu-bs.de Hello Alex!
Bundle::getPriority() and MetaBundle::getPriority() does exactly the same thing. Both read the corresponding priority encoded in the processing flags. This is defined in the bundle protocol specification (RFC 5050).
The effect is, that bundles with higher priority are delivered preferential to bundles with a lower priority. This is implemented as ordered list in the bundle storages. A storage sort all the bundles according to the priority and iterate them in this order.
That means, a routing module will process the bundles with higher priority first.
Kind regards, Johannes Morgenroth
-- !! This message is brought to you via the `ibr-dtn' mailing list. !! Please do not reply to this message to unsubscribe. To unsubscribe or adjust !! your settings, send a mail message to ibr-dtn-request@ibr.cs.tu-bs.de !! or look at https://www.ibr.cs.tu-bs.de/mailman/listinfo/ibr-dtn.