InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Operation.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 "
Operation.h
"
30
#include "
Pg.h
"
31
#line 32 "Operation.cc"
32
33
Operation::Operation
(
int
typearg,
class
TransactionAgent
*taarg, int64_t uid,
34
int64_t did) : type(typearg),
taPtr
(taarg), userid(uid),
35
domainid(did)
36
{
37
class
TransactionAgent
&taRef = *
taPtr
;
38
operationid
= ++taRef.
operationidcounter
;
39
taRef.
pendingOperations
[
operationid
] =
this
;
40
sockfd
= taRef.
sockfd
;
41
42
if
(
type
==
OP_SCHEMA
)
43
{
44
schemaData
.
msgwaits
=
45
__sync_add_and_fetch(&
nodeTopology
.
numtransactionagents
, 0) +
46
__sync_add_and_fetch(&
nodeTopology
.
numengines
, 0);
47
}
48
}
49
50
Operation::~Operation
()
51
{
52
}
53
54
int64_t
Operation::getid
()
55
{
56
return
operationid
;
57
}
58
59
void
Operation::setbuiltincmd
(
int
cmd)
60
{
61
schemaData
.
builtincmd
= cmd;
62
}
63
64
void
Operation::setDomainName
(
string
name)
65
{
66
domainName
= name;
67
}
68
69
void
Operation::handleOperation
(
class
MessageUserSchema
&msgrcvref)
70
{
71
switch
(msgrcvref.
userschemaStruct
.
caller
)
72
{
73
case
1:
// Pg login
74
{
75
boost::unordered_map<int, class Pg *>::iterator it;
76
it =
taPtr
->
Pgs
.find(
sockfd
);
77
78
if
(it !=
taPtr
->
Pgs
.end())
79
{
80
class
Pg
&pgref = *it->second;
81
pgref.
continueLogin
(msgrcvref.
userschemaStruct
.
callerstate
, msgrcvref);
82
taPtr
->
pendingOperations
.erase(
operationid
);
83
delete
this
;
84
}
85
else
86
{
87
printf(
"%s %i anomaly Pg object not in Pgs, sockfd %i\n"
, __FILE__,
88
__LINE__,
sockfd
);
89
}
90
}
91
break
;
92
93
default
:
94
printf(
"%s %i anomaly type %i\n"
, __FILE__, __LINE__,
type
);
95
}
96
}
infinisqld
Operation.cc
Generated on Tue Dec 24 2013 06:05:45 for InfiniSQL by
1.8.4