Overpass API regression suite coverage (Nova Scotia) / overpass_api/dispatch/dispatcher_stub.h

overpass_api/dispatch/dispatcher_stub.h

3 of 4 instrumented lines run by the suite (75.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___OVERPASS_API__DISPATCH__DISPATCHER_STUB_H
20#define DE__OSM3S___OVERPASS_API__DISPATCH__DISPATCHER_STUB_H
22#include "../dispatch/resource_manager.h"
23#include "../../template_db/dispatcher_client.h"
25#include <errno.h>
26#include <fcntl.h>
27#include <sys/mman.h>
28#include <sys/select.h>
29#include <sys/stat.h>
30#include <sys/types.h>
31#include <unistd.h>
33#include <cstdint>
34#include <cstdlib>
35#include <cstring>
36#include <fstream>
37#include <iostream>
38#include <sstream>
39#include <string>
40#include <vector>
43struct Exit_Error {};
46class Dispatcher_Stub : public Watchdog_Callback
48public:
49 // Opens the connection to the database, sets db_dir accordingly
50 // and registers the process. error_output_ must remain valid over the
51 // entire lifetime of this object.
52 Dispatcher_Stub(
53 std::string db_dir_, Error_Output* error_output_, const std::string& xml_raw, int area_level,
54 uint32 max_allowed_time, uint64 max_allowed_space, Parsed_Query& global_settings_);
56 // Called once per minute from the resource manager
57 virtual void ping() const;
59 ~Dispatcher_Stub();
610 std::string get_db_dir() { return (db_dir == "" ? dispatcher_client->get_db_dir() : db_dir); }
62595595 q std::string get_timestamp() { return timestamp; }
63102102 q std::string get_area_timestamp() { return area_timestamp; }
642380595 q Resource_Manager& resource_manager() { return *rman; }
65 bool all_meta_empty() const;
66 bool is_meta_file(const std::string& filename) const;
67 bool all_attic_empty() const;
68 bool is_attic_file(const std::string& filename) const;
70private:
71 std::string db_dir, timestamp, area_timestamp;
73 Error_Output* error_output;
74 Dispatcher_Client* dispatcher_client;
75 Dispatcher_Client* area_dispatcher_client;
76 Nonsynced_Transaction* transaction;
77 Nonsynced_Transaction* area_transaction;
78 Resource_Manager* rman;
80 uint64_t full_hash;
81 uint64_t anon_hash;
82 uint32 client_token;
83 std::string client_identifier;
84};
87#endif