group-manager-db.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_GROUP_MANAGER_DB_HPP
24 #define NDN_GROUP_MANAGER_DB_HPP
25 
26 #include <map>
27 #include "../name.hpp"
28 #include "schedule.hpp"
29 
30 namespace ndn {
31 
40 public:
45  class Error : public std::exception {
46  public:
47  Error(const std::string& errorMessage) throw();
48 
49  virtual ~Error() throw();
50 
51  std::string
52  Msg() const { return errorMessage_; }
53 
54  virtual const char*
55  what() const throw();
56 
57  private:
58  const std::string errorMessage_;
59  };
60 
64  virtual
66 
68 
75  virtual bool
76  hasSchedule(const std::string& name) = 0;
77 
83  virtual void
84  listAllScheduleNames(std::vector<std::string>& nameList) = 0;
85 
93  virtual ptr_lib::shared_ptr<Schedule>
94  getSchedule(const std::string& name) = 0;
95 
106  virtual void
108  (const std::string& name, std::map<Name, Blob>& memberMap) = 0;
109 
117  virtual void
118  addSchedule(const std::string& name, const Schedule& schedule) = 0;
119 
126  virtual void
127  deleteSchedule(const std::string& name) = 0;
128 
137  virtual void
138  renameSchedule(const std::string& oldName, const std::string& newName) = 0;
139 
148  virtual void
149  updateSchedule(const std::string& name, const Schedule& schedule) = 0;
150 
152 
159  virtual bool
160  hasMember(const Name& identity) = 0;
161 
167  virtual void
168  listAllMembers(std::vector<Name>& nameList) = 0;
169 
177  virtual std::string
178  getMemberSchedule(const Name& identity) = 0;
179 
189  virtual void
190  addMember
191  (const std::string& scheduleName, const Name& keyName, const Blob& key) = 0;
192 
201  virtual void
202  updateMemberSchedule(const Name& identity, const std::string& scheduleName) = 0;
203 
210  virtual void
211  deleteMember(const Name& identity) = 0;
212 };
213 
214 }
215 
216 #endif
virtual std::string getMemberSchedule(const Name &identity)=0
Get the name of the schedule for the given member's identity name.
virtual bool hasMember(const Name &identity)=0
Check if there is a member with the given identity name.
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
virtual void updateMemberSchedule(const Name &identity, const std::string &scheduleName)=0
Change the name of the schedule for the given member's identity name.
virtual void deleteMember(const Name &identity)=0
Delete a member with the given identity name.
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 void renameSchedule(const std::string &oldName, const std::string &newName)=0
Rename a schedule with oldName to newName.
virtual void updateSchedule(const std::string &name, const Schedule &schedule)=0
Update the schedule with name and replace the old object with the given schedule. ...
virtual void addSchedule(const std::string &name, const Schedule &schedule)=0
Add a schedule with the given name.
GroupManagerDb::Error extends std::exception for errors using GroupManagerDb methods.
Definition: group-manager-db.hpp:45
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 ptr_lib::shared_ptr< Schedule > getSchedule(const std::string &name)=0
Get a schedule with the given name.
virtual void deleteSchedule(const std::string &name)=0
Delete the schedule with the given name.
virtual ~GroupManagerDb()
The virtual Destructor.
Definition: group-manager-db.cpp:41
virtual void getScheduleMembers(const std::string &name, std::map< Name, Blob > &memberMap)=0
For each member using the given schedule, get the name and public key DER of the member's key...
virtual void listAllScheduleNames(std::vector< std::string > &nameList)=0
Append all the names of the schedules to the nameList.
virtual void addMember(const std::string &scheduleName, const Name &keyName, const Blob &key)=0
Add a new member with the given key named keyName into a schedule named scheduleName.
virtual void listAllMembers(std::vector< Name > &nameList)=0
Append all the members to the nameList.
virtual bool hasSchedule(const std::string &name)=0
Check if there is a schedule with the given name.