Overpass API regression suite coverage (Saxony) / template_db/transaction_insulator.h

template_db/transaction_insulator.h

0 of 1 instrumented lines run by the suite (0.0%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#ifndef DE__OSM3S___TEMPLATE_DB__TRANSACTION_INSULATOR_H
20#define DE__OSM3S___TEMPLATE_DB__TRANSACTION_INSULATOR_H
22#include "file_tools.h"
23#include "types.h"
25#include <map>
26#include <set>
27#include <vector>
30class Idx_Footprints
32 public:
33 typedef uint pid_t;
35 void set_current_footprint(const std::vector< bool >& footprint);
36 void register_pid(pid_t pid);
37 void unregister_pid(pid_t pid);
38 std::vector< pid_t > registered_processes() const;
39 std::vector< bool > total_footprint() const;
41 private:
42 std::vector< bool > current_footprint;
43 std::map< pid_t, std::vector< bool > > footprint_per_pid;
44};
47class Transaction_Insulator
49public:
50 Transaction_Insulator(const std::string& db_dir, const std::vector< File_Properties* >& controlled_files_);
51 void request_read_and_idx(pid_t pid);
52 void read_finished(pid_t pid);
53 std::vector< ::pid_t > registered_pids() const;
55 void copy_shadows_to_mains();
56 void copy_mains_to_shadows();
57 void remove_shadows();
58 void remove_migrated();
59 void set_current_footprints();
60 void write_index_of_empty_blocks();
61 void move_migrated_files_in_place();
630 const std::string& db_dir() const { return db_dir_; }
65private:
66 std::string db_dir_;
67 std::vector< File_Properties* > controlled_files;
68 std::vector< Idx_Footprints > data_footprints;
69 std::vector< Idx_Footprints > map_footprints;
70};
73#endif