The class for bundle storage is an instantiation of an oasys durable table to store the bundle metadata, tracking logic for the storage total, and other support classes for the payloads. More...
#include <BundleStore.h>
Public Types | |
typedef oasys::OpenFdCache < std::string > | FdCache |
Helper class typedefs. | |
typedef oasys::InternalKeyDurableTable < oasys::UIntShim, u_int32_t, Bundle > | BundleTable |
typedef BundleTable::iterator | iterator |
Public Member Functions | |
BundleStore (const DTNStorageConfig &cfg) | |
Constructor. | |
bool | add (Bundle *bundle) |
Add a new bundle. | |
Bundle * | get (u_int32_t bundleid) |
Retrieve a bundle. | |
bool | update (Bundle *bundle) |
Update the metabundle for the bundle. | |
bool | del (Bundle *bundle) |
Delete the bundle. | |
iterator * | new_iterator () |
Return a new iterator. | |
void | close () |
Close down the table. | |
const std::string & | payload_dir () |
Accessors. | |
u_int64_t | payload_quota () |
Accessors. | |
FdCache * | payload_fdcache () |
Accessors. | |
u_int64_t | total_size () |
Accessors. | |
Static Public Member Functions | |
static int | init (const DTNStorageConfig &cfg, oasys::DurableStore *store) |
Boot time initializer that takes as a parameter the storage configuration to use. | |
Protected Member Functions | |
void | set_total_size (u_int64_t sz) |
When the bundle store is loaded at boot time, we need to reset the in-memory total_size_ parameter. | |
Protected Attributes | |
const DTNStorageConfig & | cfg_ |
Storage configuration. | |
BundleTable | bundles_ |
Bundle metabundle table. | |
FdCache | payload_fdcache_ |
File descriptor cache. | |
u_int64_t | total_size_ |
Friends | |
class | BundleDaemon |
The class for bundle storage is an instantiation of an oasys durable table to store the bundle metadata, tracking logic for the storage total, and other support classes for the payloads.
Definition at line 36 of file BundleStore.h.
typedef oasys::InternalKeyDurableTable< oasys::UIntShim, u_int32_t, Bundle> dtn::BundleStore::BundleTable |
Definition at line 41 of file BundleStore.h.
typedef oasys::OpenFdCache<std::string> dtn::BundleStore::FdCache |
Helper class typedefs.
Definition at line 39 of file BundleStore.h.
typedef BundleTable::iterator dtn::BundleStore::iterator |
Definition at line 42 of file BundleStore.h.
dtn::BundleStore::BundleStore | ( | const DTNStorageConfig & | cfg | ) |
Add a new bundle.
Definition at line 54 of file BundleStore.cc.
References bundles_, dtn::Bundle::durable_size(), and total_size_.
void dtn::BundleStore::close | ( | ) |
Delete the bundle.
Definition at line 79 of file BundleStore.cc.
References ASSERT, dtn::Bundle::bundleid(), bundles_, dtn::Bundle::durable_size(), and total_size_.
Bundle * dtn::BundleStore::get | ( | u_int32_t | bundleid | ) |
int dtn::BundleStore::init | ( | const DTNStorageConfig & | cfg, | |
oasys::DurableStore * | store | |||
) | [static] |
Boot time initializer that takes as a parameter the storage configuration to use.
Definition at line 42 of file BundleStore.cc.
References BundleStore().
BundleStore::iterator * dtn::BundleStore::new_iterator | ( | ) |
const std::string& dtn::BundleStore::payload_dir | ( | ) | [inline] |
Accessors.
Definition at line 75 of file BundleStore.h.
References cfg_, and dtn::DTNStorageConfig::payload_dir_.
Referenced by dtn::BundlePayload::init(), and dtn::BundlePayload::init_from_store().
FdCache* dtn::BundleStore::payload_fdcache | ( | ) | [inline] |
Accessors.
Definition at line 77 of file BundleStore.h.
References payload_fdcache_.
Referenced by dtn::BundlePayload::init(), dtn::BundlePayload::init_from_store(), dtn::BundlePayload::pin_file(), and dtn::BundlePayload::replace_with_file().
u_int64_t dtn::BundleStore::payload_quota | ( | ) | [inline] |
Accessors.
Definition at line 76 of file BundleStore.h.
References cfg_, and dtn::DTNStorageConfig::payload_quota_.
void dtn::BundleStore::set_total_size | ( | u_int64_t | sz | ) | [inline, protected] |
When the bundle store is loaded at boot time, we need to reset the in-memory total_size_ parameter.
Definition at line 86 of file BundleStore.h.
References total_size_.
u_int64_t dtn::BundleStore::total_size | ( | ) | [inline] |
Update the metabundle for the bundle.
Reimplemented in dtn::SQLBundleStore.
Definition at line 72 of file BundleStore.cc.
References bundles_.
friend class BundleDaemon [friend] |
Definition at line 82 of file BundleStore.h.
BundleTable dtn::BundleStore::bundles_ [protected] |
Bundle metabundle table.
Definition at line 89 of file BundleStore.h.
Referenced by add(), close(), del(), get(), new_iterator(), and update().
const DTNStorageConfig& dtn::BundleStore::cfg_ [protected] |
Storage configuration.
Definition at line 88 of file BundleStore.h.
Referenced by payload_dir(), and payload_quota().
FdCache dtn::BundleStore::payload_fdcache_ [protected] |
File descriptor cache.
Definition at line 90 of file BundleStore.h.
Referenced by payload_fdcache().
u_int64_t dtn::BundleStore::total_size_ [protected] |
Definition at line 91 of file BundleStore.h.
Referenced by add(), del(), set_total_size(), and total_size().