InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
|
create new Table object More...
#include <Table.h>
Public Member Functions | |
Table (int64_t idarg) | |
virtual | ~Table () |
void | setname (string namearg) |
set name More... | |
std::string * | getname () |
get name More... | |
int64_t | addfield (fieldtype_e type, int64_t length, std::string name, indextype_e indextype) |
add field/column More... | |
bool | makerow (vector< fieldValue_s > *fieldVal, std::string *res) |
assemble row string from fields More... | |
bool | unmakerow (std::string *rowstring, vector< fieldValue_s > *resultFields) |
extract fields from row string More... | |
void | getrows (vector< int64_t > rowids, locktype_e locktype, int64_t subtransactionid, int64_t pendingcmdid, vector< returnRow_s > *returnRows, vector< int64_t > *lockPendingRowids, int64_t tacmdentrypoint) |
orphan? More... | |
int64_t | getnextrowid () |
generate unique, ever-increasing row identifier More... | |
void | newrow (int64_t newrowid, int64_t subtransactionid, string &row) |
create new row More... | |
int64_t | updaterow (int64_t rowid, int64_t subtransactionid, string *row) |
modify row More... | |
int64_t | deleterow (int64_t rowid, int64_t subtransactionid) |
delete row More... | |
int64_t | deleterow (int64_t rowid, int64_t subtransactionid, int64_t forward_rowid, int64_t forward_engineid) |
delete row part of replacement More... | |
void | selectrows (vector< int64_t > *rowids, locktype_e locktype, int64_t subtransactionid, int64_t pendingcmdid, vector< returnRow_s > *returnRows, int64_t tacmdentrypoint) |
return rows for select based on index hits More... | |
locktype_e | assignToLockQueue (int64_t rowid, locktype_e locktype, int64_t subtransactionid, int64_t pendingcmdid, int64_t tacmdentrypoint) |
add subtransactionid to queue waiting to acquire lock on row More... | |
void | commitRollbackUnlock (int64_t rowid, int64_t subtransactionid, enginecmd_e cmd) |
Public Attributes | |
int64_t | id |
std::string | name |
int64_t | nextindexid |
std::vector< class Field > | fields |
boost::unordered_map< int64_t, std::queue< lockQueueRowEntry > > | lockQueue |
class Table * | shadowTable |
boost::unordered_map < std::string, int64_t > | columnaNameToFieldMap |
boost::unordered_map< int64_t, rowdata_s * > | rows |
int64_t | rowsize |
int64_t | nextrowid |
boost::unordered_map< int64_t, forwarderEntry > | forwarderMap |
Friends | |
class | ApiInterface |
class | TransactionAgent |
class | Engine |
class | Transaction |
class | SubTransaction |
class | UserSchemaMgr |
Table::Table | ( | int64_t | idarg) |
|
inlinevirtual |
Definition at line 79 of file Table.h.
References shadowTable.
int64_t Table::addfield | ( | fieldtype_e | type, |
int64_t | length, | ||
std::string | name, | ||
indextype_e | indextype | ||
) |
add field/column
type | field type |
length | length (for CHARX) |
name | field name |
indextype | index type |
Definition at line 52 of file Table.cc.
References BOOL, CHAR, CHARX, columnaNameToFieldMap, fields, FLOAT, INT, Field::length, logfile, name, rowsize, UINT, and VARCHAR.
Referenced by TransactionAgent::TAaddcolumn().
locktype_e Table::assignToLockQueue | ( | int64_t | rowid, |
locktype_e | locktype, | ||
int64_t | subtransactionid, | ||
int64_t | pendingcmdid, | ||
int64_t | tacmdentrypoint | ||
) |
add subtransactionid to queue waiting to acquire lock on row
rowid | rowid |
locktype | lock type |
subtransactionid | subtransactionid |
pendingcmdid | pending command by calling Transaction |
tacmdentrypoint | entry point back to pending Transaction command |
Definition at line 1047 of file Table.cc.
References getinsertflag(), lockQueue, lockQueueRowEntry::locktype, NOTFOUNDLOCK, lockQueueRowEntry::pendingcmdid, rows, lockQueueRowEntry::subtransactionid, and lockQueueRowEntry::tacmdentrypoint.
Referenced by selectrows().
void Table::commitRollbackUnlock | ( | int64_t | rowid, |
int64_t | subtransactionid, | ||
enginecmd_e | cmd | ||
) |
Definition at line 651 of file Table.cc.
References cleardeleteflag(), clearlockedflag(), clearreplacedeleteflag(), COMMITCMD, rowdata_s::flags, forwarderMap, getdeleteflag(), getinsertflag(), getlocktype(), getreplacedeleteflag(), logfile, rowdata_s::previoussubtransactionid, READLOCK, rowdata_s::readlockHolders, REVERTCMD, ROLLBACKCMD, rows, setreadlock(), shadowTable, UNLOCKCMD, WRITELOCK, and rowdata_s::writelockHolder.
Referenced by SubTransaction::commitRollbackUnlock(), and SubTransaction::processTransactionMessage().
int64_t Table::deleterow | ( | int64_t | rowid, |
int64_t | subtransactionid | ||
) |
delete row
rowid | rowid |
subtransactionid | subtransactionid |
Definition at line 1026 of file Table.cc.
References rowdata_s::flags, getlocktype(), logfile, rows, setdeleteflag(), STATUS_NOTOK, STATUS_OK, WRITELOCK, and rowdata_s::writelockHolder.
Referenced by SubTransaction::deleterow(), and deleterow().
int64_t Table::deleterow | ( | int64_t | rowid, |
int64_t | subtransactionid, | ||
int64_t | forward_rowid, | ||
int64_t | forward_engineid | ||
) |
delete row part of replacement
rowid | rowid |
subtransactionid | subtransactionid |
forward_rowid | rowid to forward index hits to |
forward_engineid | engineid to forward index hits to |
Definition at line 428 of file Table.cc.
References deleterow(), forwarderEntry::engineid, rowdata_s::flags, forwarderMap, forwarderEntry::rowid, rows, setreplacedeleteflag(), and STATUS_OK.
string * Table::getname | ( | ) |
int64_t Table::getnextrowid | ( | ) |
generate unique, ever-increasing row identifier
Definition at line 1006 of file Table.cc.
References nextrowid.
Referenced by SubTransaction::newrow().
void Table::getrows | ( | vector< int64_t > | rowids, |
locktype_e | locktype, | ||
int64_t | subtransactionid, | ||
int64_t | pendingcmdid, | ||
vector< returnRow_s > * | returnRows, | ||
vector< int64_t > * | lockPendingRowids, | ||
int64_t | tacmdentrypoint | ||
) |
orphan?
rowids | |
locktype | |
subtransactionid | |
pendingcmdid | |
returnRows | |
lockPendingRowids | |
tacmdentrypoint |
Definition at line 253 of file Table.cc.
References rowdata_s::flags, getinsertflag(), getlocktype(), lockQueue, lockQueueRowEntry::locktype, logfile, NOLOCK, lockQueueRowEntry::pendingcmdid, READLOCK, rowdata_s::readlockHolders, rowdata_s::row, returnRow_s::row, returnRow_s::rowid, rows, setreadlock(), setwritelock(), lockQueueRowEntry::subtransactionid, lockQueueRowEntry::tacmdentrypoint, WRITELOCK, and rowdata_s::writelockHolder.
bool Table::makerow | ( | vector< fieldValue_s > * | fieldVal, |
std::string * | res | ||
) |
assemble row string from fields
fieldVal | fields |
res | resulting string |
Definition at line 101 of file Table.cc.
References BOOL, CHAR, CHARX, fields, FLOAT, INT, Field::length, logfile, rowsize, Field::type, UINT, and VARCHAR.
Referenced by Statement::branchtotype(), Statement::continueUpdate(), and Transaction::updateRow().
void Table::newrow | ( | int64_t | newrowid, |
int64_t | subtransactionid, | ||
string & | row | ||
) |
create new row
newrowid | rowid |
subtransactionid | subtransactionid |
row | row |
Definition at line 1011 of file Table.cc.
References rowdata_s::flags, rowdata_s::row, rows, setinsertflag(), setwritelock(), shadowTable, and rowdata_s::writelockHolder.
Referenced by SubTransaction::newrow().
void Table::selectrows | ( | vector< int64_t > * | rowids, |
locktype_e | locktype, | ||
int64_t | subtransactionid, | ||
int64_t | pendingcmdid, | ||
vector< returnRow_s > * | returnRows, | ||
int64_t | tacmdentrypoint | ||
) |
return rows for select based on index hits
rowids | list of rowids |
locktype | lock type |
subtransactionid | subtransactionid |
pendingcmdid | pending command by calling Transaction |
returnRows | return rows |
tacmdentrypoint | entry point back to pending Transaction command |
Definition at line 448 of file Table.cc.
References assignToLockQueue(), getlocktype(), returnRow_s::locktype, logfile, NOLOCK, NOTFOUNDLOCK, PENDINGLOCK, READLOCK, returnRow_s::row, returnRow_s::rowid, rows, setreadlock(), setwritelock(), and WRITELOCK.
Referenced by SubTransaction::selectrows().
void Table::setname | ( | string | namearg) |
bool Table::unmakerow | ( | std::string * | rowstring, |
vector< fieldValue_s > * | resultFields | ||
) |
extract fields from row string
rowstring | input row |
resultFields | resulting fields |
Definition at line 911 of file Table.cc.
References BOOL, CHAR, CHARX, fields, FLOAT, INT, Field::length, logfile, rowsize, Field::type, UINT, and VARCHAR.
Referenced by Statement::andPredicate(), Transaction::continueCommitTransaction(), Statement::continueSelect(), Transaction::continueSqlReplace(), Statement::continueUpdate(), TransactionAgent::handledispatch(), ApiInterface::insertRow(), Statement::stagedPredicate(), and Transaction::updateRow().
int64_t Table::updaterow | ( | int64_t | rowid, |
int64_t | subtransactionid, | ||
string * | row | ||
) |
modify row
rowid | rowid |
subtransactionid | subtransactionid |
row | new row |
Definition at line 401 of file Table.cc.
References rowdata_s::flags, getlocktype(), logfile, rowdata_s::row, rows, shadowTable, STATUS_NOTOK, STATUS_OK, WRITELOCK, and rowdata_s::writelockHolder.
Referenced by SubTransaction::updaterow().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
boost::unordered_map<std::string, int64_t> Table::columnaNameToFieldMap |
Definition at line 247 of file Table.h.
Referenced by addfield().
std::vector<class Field> Table::fields |
Definition at line 244 of file Table.h.
Referenced by addfield(), Statement::andPredicate(), Engine::applyItem(), Statement::branchtotype(), Transaction::checkNullConstraintOK(), SubTransaction::commitRollbackUnlock(), Transaction::continueCommitTransaction(), Transaction::continueInsertRow(), Transaction::continueSqlInsert(), Transaction::continueSqlReplace(), Statement::continueUpdate(), Transaction::continueUpdateRow(), Transaction::getEngineid(), TransactionAgent::handledispatch(), ApiInterface::insertRow(), makerow(), SubTransaction::processTransactionMessage(), Statement::resolveTableFields2(), Statement::stagedPredicate(), Statement::startQuery(), Statement::subqueryUnique(), and unmakerow().
boost::unordered_map<int64_t, forwarderEntry> Table::forwarderMap |
Definition at line 254 of file Table.h.
Referenced by commitRollbackUnlock(), and deleterow().
boost::unordered_map< int64_t, std::queue<lockQueueRowEntry> > Table::lockQueue |
Definition at line 245 of file Table.h.
Referenced by assignToLockQueue(), SubTransaction::drainRowLockQueue(), and getrows().
std::string Table::name |
Definition at line 242 of file Table.h.
Referenced by UserSchemaMgr::addcolumn(), addfield(), getname(), setname(), and Table().
int64_t Table::nextrowid |
Definition at line 252 of file Table.h.
Referenced by getnextrowid().
boost::unordered_map<int64_t, rowdata_s *> Table::rows |
Definition at line 249 of file Table.h.
Referenced by Engine::applyItem(), assignToLockQueue(), commitRollbackUnlock(), deleterow(), getrows(), newrow(), SubTransaction::processTransactionMessage(), selectrows(), and updaterow().
int64_t Table::rowsize |
Definition at line 251 of file Table.h.
Referenced by addfield(), makerow(), Table(), and unmakerow().
class Table* Table::shadowTable |
Definition at line 246 of file Table.h.
Referenced by commitRollbackUnlock(), newrow(), Table(), updaterow(), and ~Table().