-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3: Mechanism to control the crunchers.
- Loading branch information
1 parent
4df2369
commit d026bb5
Showing
13 changed files
with
374 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
CAUTION: Do not modify this file unless you know what you are doing. | ||
Unexpected results may occur if the code is changed deliberately. | ||
--> | ||
<dbmodel pgmodeler-ver="0.8.1" last-position="1,0" last-zoom="1" | ||
default-schema="public" default-owner="postgres"> | ||
<database name="new_database"> | ||
</database> | ||
|
||
<schema name="public" protected="true" fill-color="#e1e1e1" sql-disabled="true"> | ||
</schema> | ||
|
||
<table name="command"> | ||
<schema name="public"/> | ||
<role name="postgres"/> | ||
<position x="117" y="77"/> | ||
<column name="run" not-null="true"> | ||
<type name="bool"/> | ||
</column> | ||
<column name="active" not-null="true"> | ||
<type name="bool"/> | ||
</column> | ||
</table> | ||
|
||
</dbmodel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- Database generated with pgModeler (PostgreSQL Database Modeler). | ||
-- pgModeler version: 0.8.1 | ||
-- PostgreSQL version: 9.4 | ||
-- Project Site: pgmodeler.com.br | ||
-- Model Author: --- | ||
|
||
|
||
-- Database creation must be done outside an multicommand file. | ||
-- These commands were put in this file only for convenience. | ||
-- -- object: new_database | type: DATABASE -- | ||
-- -- DROP DATABASE IF EXISTS new_database; | ||
-- CREATE DATABASE new_database | ||
-- ; | ||
-- -- ddl-end -- | ||
-- | ||
|
||
-- object: public.command | type: TABLE -- | ||
-- DROP TABLE IF EXISTS public.command CASCADE; | ||
CREATE TABLE public.command( | ||
run bool NOT NULL, | ||
active bool NOT NULL | ||
); | ||
-- ddl-end -- | ||
ALTER TABLE public.command OWNER TO postgres; | ||
-- ddl-end -- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*********************************************************************** | ||
* T R O K A M | ||
* Fair Search Engine | ||
* | ||
* Copyright (C) 2018, Nicolas Slusarenko | ||
* [email protected] | ||
* | ||
* This file is part of Trokam. | ||
* | ||
* Trokam 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, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Trokam 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 Trokam. If not, see <http://www.gnu.org/licenses/>. | ||
**********************************************************************/ | ||
|
||
#ifndef TROKAM_CONTROL_H | ||
#define TROKAM_CONTROL_H | ||
|
||
/// C++ | ||
#include <string> | ||
|
||
/// Boost | ||
#include <boost/scoped_ptr.hpp> | ||
|
||
/// Trokam | ||
#include "reporting.h" | ||
#include "options.h" | ||
#include "postgresql.h" | ||
|
||
namespace Trokam | ||
{ | ||
class Control | ||
{ | ||
public: | ||
|
||
Control(const Trokam::Options &value); | ||
bool run(); | ||
bool active(); | ||
|
||
private: | ||
|
||
Trokam::Options settings; | ||
Trokam::Postgresql db; | ||
Trokam::Reporting msg; | ||
}; | ||
} | ||
|
||
#endif /// TROKAM_INFOSTORE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*********************************************************************** | ||
* T R O K A M | ||
* Fair Search Engine | ||
* | ||
* Copyright (C) 2018, Nicolas Slusarenko | ||
* [email protected] | ||
* | ||
* This file is part of Trokam. | ||
* | ||
* Trokam 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, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Trokam 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 Trokam. If not, see <http://www.gnu.org/licenses/>. | ||
**********************************************************************/ | ||
|
||
/// C++ | ||
#include <string> | ||
#include <iostream> | ||
|
||
/// Trokam | ||
#include "common.h" | ||
#include "control.h" | ||
|
||
Trokam::Control::Control(const Trokam::Options &value): settings(value), | ||
db(value, DB_CONTROL), | ||
msg(value) | ||
{} | ||
|
||
bool Trokam::Control::run() | ||
{ | ||
bool state= false; | ||
|
||
std::string sentence; | ||
sentence= "SELECT run "; | ||
sentence+= "FROM command "; | ||
|
||
boost::scoped_ptr<pqxx::result> answer; | ||
db.execSql(sentence, answer); | ||
Trokam::Postgresql::extract(answer, state); | ||
|
||
return state; | ||
} | ||
|
||
bool Trokam::Control::active() | ||
{ | ||
bool state= false; | ||
|
||
std::string sentence; | ||
sentence= "SELECT active "; | ||
sentence+= "FROM command "; | ||
|
||
boost::scoped_ptr<pqxx::result> answer; | ||
db.execSql(sentence, answer); | ||
Trokam::Postgresql::extract(answer, state); | ||
|
||
return state; | ||
} |
Oops, something went wrong.