All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | Static Protected Member Functions | List of all members
ndn::ProducerDb Class Referenceabstract

ProducerDb is an abstract base class for the storage of keys for the producer. More...

#include <producer-db.hpp>

Inheritance diagram for ndn::ProducerDb:
ndn::Sqlite3ProducerDb

Classes

class  Error
 ProducerDb::Error extends std::exception for errors using ProducerDb methods. More...
 

Public Member Functions

virtual ~ProducerDb ()
 The virtual Destructor.
 
virtual bool hasContentKey (MillisecondsSince1970 timeSlot)=0
 Check if a content key exists for the hour covering timeSlot. More...
 
virtual Blob getContentKey (MillisecondsSince1970 timeSlot)=0
 Get the content key for the hour covering timeSlot. More...
 
virtual void addContentKey (MillisecondsSince1970 timeSlot, const Blob &key)=0
 Add key as the content key for the hour covering timeSlot. More...
 
virtual void deleteContentKey (MillisecondsSince1970 timeSlot)=0
 Delete the content key for the hour covering timeSlot. More...
 

Static Protected Member Functions

static int getFixedTimeSlot (MillisecondsSince1970 timeSlot)
 Get the hour-based time slot. More...
 

Detailed Description

ProducerDb is an abstract base class for the storage of keys for the producer.

It contains one table that maps time slots (to the nearest hour) to the content key created for that time slot. A subclass must implement the methods. For example, see Sqlite3ProducerDb.

Note
This class is an experimental feature. The API may change.

Member Function Documentation

virtual void ndn::ProducerDb::addContentKey ( MillisecondsSince1970  timeSlot,
const Blob key 
)
pure virtual

Add key as the content key for the hour covering timeSlot.

Parameters
timeSlotThe time slot as milliseconds since Jan 1, 1970 UTC.
keyThe encoded key.
Exceptions
ProducerDb::Errorif a key for the same hour already exists in the database, or other database error.

Implemented in ndn::Sqlite3ProducerDb.

virtual void ndn::ProducerDb::deleteContentKey ( MillisecondsSince1970  timeSlot)
pure virtual

Delete the content key for the hour covering timeSlot.

If there is no key for the time slot, do nothing.

Parameters
timeSlotThe time slot as milliseconds since Jan 1, 1970 UTC.
Exceptions
ProducerDb::Errorfor a database error.

Implemented in ndn::Sqlite3ProducerDb.

virtual Blob ndn::ProducerDb::getContentKey ( MillisecondsSince1970  timeSlot)
pure virtual

Get the content key for the hour covering timeSlot.

Parameters
timeSlotThe time slot as milliseconds since Jan 1, 1970 UTC.
Returns
A Blob with the encoded key.
Exceptions
ProducerDb::Errorif there is no key covering timeSlot or other database error.

Implemented in ndn::Sqlite3ProducerDb.

int ndn::ProducerDb::getFixedTimeSlot ( MillisecondsSince1970  timeSlot)
staticprotected

Get the hour-based time slot.

Parameters
timeSlotThe time slot as milliseconds since Jan 1, 1970 UTC.
Returns
The hour-based time slot as hours since Jan 1, 1970 UTC.
virtual bool ndn::ProducerDb::hasContentKey ( MillisecondsSince1970  timeSlot)
pure virtual

Check if a content key exists for the hour covering timeSlot.

Parameters
timeSlotThe time slot as milliseconds since Jan 1, 1970 UTC.
Returns
True if there is a content key for timeSlot.
Exceptions
ProducerDb::Errorfor a database error.

Implemented in ndn::Sqlite3ProducerDb.


The documentation for this class was generated from the following files: