1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-27 21:01:50 +03:00
Files
mariadb-columnstore-engine/versioning/BRM/lbidresourcegraph.h
Roman Nozdrin 4fe9cd64a3 Revert "No boost condition (#2822)" (#2828)
This reverts commit f916e64927.
2023-04-22 15:49:50 +03:00

75 lines
2.0 KiB
C++

/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/******************************************************************************
* $Id: lbidresourcegraph.h 1823 2013-01-21 14:13:09Z rdempsey $
*
*****************************************************************************/
/** @file
* class XXX interface
*/
#pragma once
#include <map>
#include <set>
#include <tr1/unordered_set>
#include <boost/thread.hpp>
#include "brmtypes.h"
#include "transactionnode.h"
#include "resourcenode.h"
#define EXPORT
namespace BRM
{
class LBIDResourceGraph
{
public:
typedef std::tr1::unordered_set<ResourceNode*, RNHasher, RNEquals> RNodes_t;
EXPORT LBIDResourceGraph();
EXPORT ~LBIDResourceGraph();
EXPORT int reserveRange(LBID_t start, LBID_t end, VER_t txn, boost::mutex& mutex);
/// releases all resources held by txn
EXPORT void releaseResources(VER_t txn);
/// releases one resource
EXPORT void releaseResource(LBID_t start);
private:
uint64_t color;
LBIDResourceGraph(const LBIDResourceGraph&);
LBIDResourceGraph& operator=(const LBIDResourceGraph&);
void connectResources(LBID_t start, LBID_t end, TransactionNode* txnNode);
bool checkDeadlock(TransactionNode&);
bool DFSStep(RGNode*, uint64_t, uint64_t) const;
std::map<VER_t, TransactionNode*> txns;
RNodes_t resources;
};
} // namespace BRM
#undef EXPORT