InfiniSQL  v0.1.2-alpha
Massive Scale Transaction Processing
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UserSchemaMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Mark Travis <mtravis15432+src@gmail.com>
3  * All rights reserved. No warranty, explicit or implicit, provided.
4  *
5  * This file is part of InfiniSQL(tm).
6 
7  * InfiniSQL is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 3
9  * as published by the Free Software Foundation.
10  *
11  * InfiniSQL is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with InfiniSQL. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
29 #ifndef INFINISQLUSERSCHEMAMGR_H
30 #define INFINISQLUSERSCHEMAMGR_H
31 
32 #include "gch.h"
33 #include "Table.h"
34 #include "TransactionAgent.h"
35 
40 typedef struct
41 {
42  std::string clearpassword;
43  byte digest[64];
45 
46 typedef boost::unordered_map<std::string, int64_t> domainNameToDomainIdMap;
47 typedef boost::unordered_map<std::string, int64_t> userNameToUserIdMap;
48 typedef boost::unordered_map<int64_t, passwordStruct> userIdToPasswordMap;
49 typedef boost::unordered_map<int64_t, userNameToUserIdMap *>
51 typedef boost::unordered_map<int64_t, userIdToPasswordMap *>
53 
54 // map of domainid->nextuserid
55 typedef boost::unordered_map<int64_t, int64_t> domainIdToNextUserIdMap;
56 
63 {
64 public:
66  virtual ~UserSchemaMgr();
67 
68  // pubic for replyTa:
69  class Message *msgsnd;
70  int64_t operationid;
71  int64_t domainid;
72  int64_t userid;
73  int64_t status;
74  int64_t tainstance;
75  //public for createSchema:
76  class Message *msgrcv;
79  class Mboxes mboxes;
81 
82 private:
90  int64_t getnextdomainid();
97  int64_t getnextuserid(int64_t argdomainid);
103  void operationHandler(class MessageUserSchema &msgrcvref);
115  int64_t operationLogin(string &username, string &domainname,
116  string &password, int64_t *uid, int64_t *did);
117 
122  void login();
127  void changepassword();
132  void createdomain();
137  void createuser();
142  void deleteuser();
147  void deletedomain();
153  void createschema(builtincmds_e cmd);
159  void createtable(builtincmds_e cmd);
165  void addcolumn(builtincmds_e cmd);
171  void deleteindex(builtincmds_e cmd);
177  void deletetable(builtincmds_e cmd);
183  void deleteschema(builtincmds_e cmd);
184 
185  //private:
186  int64_t argsize;
187  int64_t instance;
188  class Mbox *mymboxPtr;
190  domainNameToDomainIdMap::iterator domainNameToDomainIdIterator;
192  domainIdToUserNamesMap::iterator domainIdToUserNamesIterator;
194  domainIdToUserIdsMap::iterator domainIdToUserIdsIterator;
196  domainIdToNextUserIdMap::iterator domainIdToNextUserIdIterator;
198  userNameToUserIdMap::iterator userNameToUserIdIterator;
200  userIdToPasswordMap::iterator userIdToPasswordIterator;
203  std::vector<std::string> *resultVector;
204  int64_t nextdomainid;
205  domainidToSchemaMap::iterator domainidsToSchemataIterator;
206  boost::unordered_map <std::string, fieldtype_e> fieldTypeMap;
207  boost::unordered_map <std::string, indextype_e> indexTypeMap;
208 };
209 
217 void *userSchemaMgr(void *identity);
218 
219 #endif /* INFINISQLUSERSCHEMAMGR_H */