sqlite3-group-manager-db.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_SQLITE3_GROUP_MANAGER_DB_HPP
24 #define NDN_SQLITE3_GROUP_MANAGER_DB_HPP
25 
26 // Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_SQLITE3.
27 #include "../ndn-cpp-config.h"
28 #ifdef NDN_CPP_HAVE_SQLITE3
29 
30 #include <sqlite3.h>
31 #include "../common.hpp"
32 #include "group-manager-db.hpp"
33 
34 namespace ndn {
35 
42 public:
47  Sqlite3GroupManagerDb(const std::string& databaseFilePath);
48 
50 
57  virtual bool
58  hasSchedule(const std::string& name);
59 
65  virtual void
66  listAllScheduleNames(std::vector<std::string>& nameList);
67 
75  virtual ptr_lib::shared_ptr<Schedule>
76  getSchedule(const std::string& name);
77 
88  virtual void
90  (const std::string& name, std::map<Name, Blob>& memberMap);
91 
99  virtual void
100  addSchedule(const std::string& name, const Schedule& schedule);
101 
108  virtual void
109  deleteSchedule(const std::string& name);
110 
119  virtual void
120  renameSchedule(const std::string& oldName, const std::string& newName);
121 
130  virtual void
131  updateSchedule(const std::string& name, const Schedule& schedule);
132 
134 
141  virtual bool
142  hasMember(const Name& identity);
143 
149  virtual void
150  listAllMembers(std::vector<Name>& nameList);
151 
159  virtual std::string
160  getMemberSchedule(const Name& identity);
161 
171  virtual void
172  addMember
173  (const std::string& scheduleName, const Name& keyName, const Blob& key);
174 
183  virtual void
184  updateMemberSchedule(const Name& identity, const std::string& scheduleName);
185 
192  virtual void
193  deleteMember(const Name& identity);
194 
195 private:
202  int
203  getScheduleId(const std::string& name);
204 
205  sqlite3 *database_;
206 };
207 
208 }
209 
210 #endif // NDN_CPP_HAVE_SQLITE3
211 
212 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
GroupManagerDb is an abstract base class for the storage of data used by the GroupManager.
Definition: group-manager-db.hpp:39
Schedule is used to manage the times when a member can access data using two sets of RepetitiveInterv...
Definition: schedule.hpp:43
virtual ptr_lib::shared_ptr< Schedule > getSchedule(const std::string &name)
Get a schedule with the given name.
virtual void deleteMember(const Name &identity)
Delete a member with the given identity name.
virtual std::string getMemberSchedule(const Name &identity)
Get the name of the schedule for the given member's identity name.
virtual void addSchedule(const std::string &name, const Schedule &schedule)
Add a schedule with the given name.
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
virtual void getScheduleMembers(const std::string &name, std::map< Name, Blob > &memberMap)
For each member using the given schedule, get the name and public key DER of the member's key...
virtual bool hasMember(const Name &identity)
Check if there is a member with the given identity name.
virtual void listAllScheduleNames(std::vector< std::string > &nameList)
Append all the names of the schedules to the nameList.
virtual void updateMemberSchedule(const Name &identity, const std::string &scheduleName)
Change the name of the schedule for the given member's identity name.
virtual void listAllMembers(std::vector< Name > &nameList)
Append all the members to the nameList.
virtual void renameSchedule(const std::string &oldName, const std::string &newName)
Rename a schedule with oldName to newName.
virtual void updateSchedule(const std::string &name, const Schedule &schedule)
Update the schedule with name and replace the old object with the given schedule. ...
Sqlite3GroupManagerDb(const std::string &databaseFilePath)
Create an Sqlite3GroupManagerDb to use the given SQLite3 file.
virtual bool hasSchedule(const std::string &name)
Check if there is a schedule with the given name.
virtual void addMember(const std::string &scheduleName, const Name &keyName, const Blob &key)
Add a new member with the given key named keyName into a schedule named scheduleName.
virtual void deleteSchedule(const std::string &name)
Delete the schedule with the given name.
Sqlite3GroupManagerDb extends GroupManagerDb to implement the storage of data used by the GroupManage...
Definition: sqlite3-group-manager-db.hpp:41