InfiniSQL  v0.1.2-alpha
Massive Scale Transaction Processing
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Engine.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 INFINISQLENGINE_H
30 #define INFINISQLENGINE_H
31 
32 #include "gch.h"
33 #include "Table.h"
34 #include "TransactionAgent.h"
35 #include "SubTransaction.h"
36 
40 class Engine
41 {
42 public:
51  struct background_s
52  {
53  int64_t applierid;
55 
56  std::vector<MessageDispatch::record_s> rows;
57  std::vector<MessageApply::applyindex_s> indices;
58  };
59 
65  Engine(Topology::partitionAddress *myIdentityArg);
66  virtual ~Engine();
67 
77  bool applyItem(int64_t subtransactionid, class Schema &schemaRef,
88  bool applyItem(int64_t subtransactionid, class Schema &schemaRef,
89  MessageApply::applyindex_s &indexinfo);
90 
91  friend class SubTransaction;
92 
93  // public for replyTa:
94  class Message *msgsnd;
95  int64_t operationid;
96  int64_t domainid;
97  int64_t userid;
98  int64_t status;
100  //public for createSchema:
101  class Message *msgrcv;
104  class Mboxes mboxes;
106  int64_t partitionid;
107 
108 private:
115  int64_t getnextsubtransactionid();
120  void createschema();
125  void createtable();
130  void addcolumn();
135  void deleteindex();
140  void deletetable();
145  void deleteschema();
150  void getMyPartitionid();
155  void apply();
166  void background(class MessageApply &inmsg, MessageDispatch::record_s &item);
177  void background(class MessageApply &inmsg, MessageApply::applyindex_s &item);
178 
180 
181  class Mbox *mymboxPtr;
182  int64_t argsize;
184  int64_t instance;
185  boost::unordered_map<int64_t, class SubTransaction *> SubTransactions;
186  std::map<int64_t, background_s> backgrounded;
187 };
188 
189 void *engine(void *identity);
190 
191 #endif /* INFINISQLENGINE_H */