<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>DTN Reference Implementation: BundleStore.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>BundleStore.h</h1><a href="BundleStore_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright 2004-2006 Intel Corporation</span> <a name="l00003"></a>00003 <span class="comment"> * </span> <a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> <a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> <a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span> <a name="l00007"></a>00007 <span class="comment"> * </span> <a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> <a name="l00009"></a>00009 <span class="comment"> * </span> <a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> <a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> <a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> <a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span> <a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span> <a name="l00015"></a>00015 <span class="comment"> */</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="preprocessor">#ifndef _BUNDLE_STORE_H_</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _BUNDLE_STORE_H_</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <oasys/debug/DebugUtils.h></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <oasys/serialize/TypeShims.h></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <oasys/storage/InternalKeyDurableTable.h></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <oasys/util/OpenFdCache.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <oasys/util/Singleton.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="DTNStorageConfig_8h.html">DTNStorageConfig.h</a>"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">namespace </span>dtn { <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keyword">class </span>Bundle; <a name="l00030"></a>00030 <a name="l00036"></a><a class="code" href="classdtn_1_1BundleStore.html">00036</a> <span class="keyword">class </span><a class="code" href="classdtn_1_1BundleStore.html" title="The class for bundle storage is an instantiation of an oasys durable table to store...">BundleStore</a> : <span class="keyword">public</span> oasys::Singleton<BundleStore, false> { <a name="l00037"></a>00037 <span class="keyword">public</span>: <a name="l00039"></a><a class="code" href="classdtn_1_1BundleStore.html#7f6ec449ca0ee33258d444af8426510d">00039</a> <span class="keyword">typedef</span> oasys::OpenFdCache<std::string> <a class="code" href="classdtn_1_1BundleStore.html#7f6ec449ca0ee33258d444af8426510d" title="Helper class typedefs.">FdCache</a>; <a name="l00040"></a>00040 <span class="keyword">typedef</span> oasys::InternalKeyDurableTable< <a name="l00041"></a><a class="code" href="classdtn_1_1BundleStore.html#17dedcf81fa5b62013a4754fe48409fb">00041</a> oasys::UIntShim, u_int32_t, <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>> <a class="code" href="classdtn_1_1BundleStore.html#17dedcf81fa5b62013a4754fe48409fb">BundleTable</a>; <a name="l00042"></a><a class="code" href="classdtn_1_1BundleStore.html#fb4b85e14a877a86628c0b6bcf619e68">00042</a> <span class="keyword">typedef</span> BundleTable::iterator <a class="code" href="classdtn_1_1BundleStore.html#fb4b85e14a877a86628c0b6bcf619e68">iterator</a>; <a name="l00043"></a>00043 <a name="l00048"></a>00048 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1BundleStore.html#98d13600ce59a19e79d256518c32e314" title="Boot time initializer that takes as a parameter the storage configuration to use...">init</a>(<span class="keyword">const</span> <a class="code" href="classdtn_1_1DTNStorageConfig.html" title="Subclass of the basic oasys storage config to add dtn-specific configuration variables...">DTNStorageConfig</a>& cfg, <a name="l00049"></a>00049 oasys::DurableStore* store); <a name="l00050"></a>00050 <a name="l00054"></a>00054 <a class="code" href="classdtn_1_1BundleStore.html#0d7ddf276c76fa7933fa445ca3edcf5a" title="Constructor.">BundleStore</a>(<span class="keyword">const</span> <a class="code" href="classdtn_1_1DTNStorageConfig.html" title="Subclass of the basic oasys storage config to add dtn-specific configuration variables...">DTNStorageConfig</a>& cfg); <a name="l00055"></a>00055 <a name="l00057"></a>00057 <span class="keywordtype">bool</span> <span class="keyword">add</span>(<a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle); <a name="l00058"></a>00058 <a name="l00060"></a>00060 <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* <span class="keyword">get</span>(u_int32_t bundleid); <a name="l00061"></a>00061 <a name="l00063"></a>00063 <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1BundleStore.html#3821a93fdc9d3566951764be76d2c649" title="Update the metabundle for the bundle.">update</a>(<a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle); <a name="l00064"></a>00064 <a name="l00066"></a>00066 <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1BundleStore.html#87d444672b4bdb825be09b0ad3b37150" title="Delete the bundle.">del</a>(<a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle); <a name="l00067"></a>00067 <a name="l00069"></a>00069 <a class="code" href="classdtn_1_1BundleStore.html#fb4b85e14a877a86628c0b6bcf619e68">iterator</a>* <a class="code" href="classdtn_1_1BundleStore.html#2018d15d04bd544f78dc8bb4b23c4df2" title="Return a new iterator.">new_iterator</a>(); <a name="l00070"></a>00070 <a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleStore.html#65ec6e97b58f4b9cab96cad6968145ab" title="Close down the table.">close</a>(); <a name="l00073"></a>00073 <a name="l00075"></a><a class="code" href="classdtn_1_1BundleStore.html#86524d860e9407dd3d0613e81a9990d2">00075</a> <span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1BundleStore.html#86524d860e9407dd3d0613e81a9990d2" title="Accessors.">payload_dir</a>() { <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1BundleStore.html#3f8c7283db7c084c29f7688ee2597dec" title="Storage configuration.">cfg_</a>.<a class="code" href="classdtn_1_1DTNStorageConfig.html#47eba04a1384e682f940d679a2578cea" title="Directory to store payload files.">payload_dir_</a>; } <a name="l00076"></a><a class="code" href="classdtn_1_1BundleStore.html#8a503100de1f9c00d38fa66aebd78da1">00076</a> u_int64_t <a class="code" href="classdtn_1_1BundleStore.html#8a503100de1f9c00d38fa66aebd78da1" title="Accessors.">payload_quota</a>() { <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1BundleStore.html#3f8c7283db7c084c29f7688ee2597dec" title="Storage configuration.">cfg_</a>.<a class="code" href="classdtn_1_1DTNStorageConfig.html#de4119b09da071ce449fddeb7c786375" title="Total quota for the payload storage.">payload_quota_</a>; } <a name="l00077"></a><a class="code" href="classdtn_1_1BundleStore.html#c3df23a2c4d9d3714d088f36d07c1ba2">00077</a> <a class="code" href="classdtn_1_1BundleStore.html#7f6ec449ca0ee33258d444af8426510d" title="Helper class typedefs.">FdCache</a>* <a class="code" href="classdtn_1_1BundleStore.html#c3df23a2c4d9d3714d088f36d07c1ba2" title="Accessors.">payload_fdcache</a>() { <span class="keywordflow">return</span> &<a class="code" href="classdtn_1_1BundleStore.html#187e6b5009ecf6ba0bf84e46da520234" title="File descriptor cache.">payload_fdcache_</a>; } <a name="l00078"></a><a class="code" href="classdtn_1_1BundleStore.html#b360ea44c0fbb86453a1b53174154ddb">00078</a> u_int64_t <a class="code" href="classdtn_1_1BundleStore.html#b360ea44c0fbb86453a1b53174154ddb" title="Accessors.">total_size</a>() { <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1BundleStore.html#ffb89e9cd7f3ce15c9c136fd31474a2e">total_size_</a>; } <a name="l00080"></a>00080 <a name="l00081"></a>00081 <span class="keyword">protected</span>: <a name="l00082"></a><a class="code" href="classdtn_1_1BundleStore.html#fc7f6330f6d1e3b33bfc1e2e1c751537">00082</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classdtn_1_1BundleDaemon.html" title="Class that handles the basic event / action mechanism.">BundleDaemon</a>; <a name="l00083"></a>00083 <a name="l00086"></a><a class="code" href="classdtn_1_1BundleStore.html#e353ebf2181c93689adde1ba532192e0">00086</a> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleStore.html#e353ebf2181c93689adde1ba532192e0" title="When the bundle store is loaded at boot time, we need to reset the in-memory total_size_...">set_total_size</a>(u_int64_t sz) { <a class="code" href="classdtn_1_1BundleStore.html#ffb89e9cd7f3ce15c9c136fd31474a2e">total_size_</a> = sz; } <a name="l00087"></a>00087 <a name="l00088"></a><a class="code" href="classdtn_1_1BundleStore.html#3f8c7283db7c084c29f7688ee2597dec">00088</a> <span class="keyword">const</span> <a class="code" href="classdtn_1_1DTNStorageConfig.html" title="Subclass of the basic oasys storage config to add dtn-specific configuration variables...">DTNStorageConfig</a>& <a class="code" href="classdtn_1_1BundleStore.html#3f8c7283db7c084c29f7688ee2597dec" title="Storage configuration.">cfg_</a>; <a name="l00089"></a><a class="code" href="classdtn_1_1BundleStore.html#6276fa50b81e2907ace7e7a10d270650">00089</a> <a class="code" href="classdtn_1_1BundleStore.html#17dedcf81fa5b62013a4754fe48409fb">BundleTable</a> <a class="code" href="classdtn_1_1BundleStore.html#6276fa50b81e2907ace7e7a10d270650" title="Bundle metabundle table.">bundles_</a>; <a name="l00090"></a><a class="code" href="classdtn_1_1BundleStore.html#187e6b5009ecf6ba0bf84e46da520234">00090</a> <a class="code" href="classdtn_1_1BundleStore.html#7f6ec449ca0ee33258d444af8426510d" title="Helper class typedefs.">FdCache</a> <a class="code" href="classdtn_1_1BundleStore.html#187e6b5009ecf6ba0bf84e46da520234" title="File descriptor cache.">payload_fdcache_</a>; <a name="l00091"></a><a class="code" href="classdtn_1_1BundleStore.html#ffb89e9cd7f3ce15c9c136fd31474a2e">00091</a> u_int64_t <a class="code" href="classdtn_1_1BundleStore.html#ffb89e9cd7f3ce15c9c136fd31474a2e">total_size_</a>; <a name="l00092"></a>00092 }; <a name="l00093"></a>00093 <a name="l00094"></a>00094 } <span class="comment">// namespace dtn</span> <a name="l00095"></a>00095 <a name="l00096"></a>00096 <span class="preprocessor">#endif </span><span class="comment">/* _BUNDLE_STORE_H_ */</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:38 2008 for DTN Reference Implementation by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>