InfiniSQL  v0.1.2-alpha
Massive Scale Transaction Processing
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Applier.cc
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 #include "gch.h"
30 #include "Applier.h"
31 #include "TransactionAgent.h"
32 #line 33 "Applier.cc"
33 
34 int64_t applierid;
38 
39 Applier::Applier(class TransactionAgent *taPtrarg, int64_t domainidarg,
40  Topology::addressStruct sourceAddrarg,
41  int64_t partitioncountarg) :
42  taPtr(taPtrarg), domainid(domainidarg), sourceAddr(sourceAddrarg),
43  partitioncount(partitioncountarg)
44 {
45  applierid = taPtr->getnextapplierid();
46  taPtr->Appliers[applierid] = this;
47 }
48 
50 {
51 }
52 
54 {
55  if (msg.ackapplyStruct.status != STATUS_OK)
56  {
57  printf("%s %i bad apply ack status %i %li,%li,%li\n", __FILE__, __LINE__,
59  delete this;
60  return;
61  }
62 
63  if (!--partitioncount)
64  {
65  taPtr->Appliers.erase(applierid);
66  delete this;
67  }
68 }