Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
f8b67ef8
Commit
f8b67ef8
authored
May 07, 2022
by
Pavel Vainerman
Committed by
Pavel Vainerman
May 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(IOController): direct use DBServer (optimization)
parent
5dec0299
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
12 deletions
+33
-12
libUniSet2BackendOpenTSDB.pc.in
extensions/Backend-OpenTSDB/libUniSet2BackendOpenTSDB.pc.in
+1
-1
DBServer_PostgreSQL.cc
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
+5
-2
DBServer_PostgreSQL.h
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.h
+2
-1
Makefile.am
extensions/DBServer-PostgreSQL/Makefile.am
+6
-6
libUniSet2PostgreSQL.pc.in
extensions/DBServer-PostgreSQL/libUniSet2PostgreSQL.pc.in
+1
-1
IOController.h
include/IOController.h
+5
-1
IOController.cc
src/Processes/IOController.cc
+13
-0
No files found.
extensions/Backend-OpenTSDB/libUniSet2BackendOpenTSDB.pc.in
View file @
f8b67ef8
...
@@ -5,7 +5,7 @@ includedir=@includedir@
...
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: libUniSet2BackendOpenTSDB
Name: libUniSet2BackendOpenTSDB
Description: Support library for UniSet2BackendOpenTSDB
Description: Support library for UniSet2BackendOpenTSDB
Requires: libUniSet2Extensions
Requires: libUniSet2Extensions
libUniSet2SharedMemory
Version: @VERSION@
Version: @VERSION@
Libs: -L${libdir} -lUniSet2BackendOpenTSDB
Libs: -L${libdir} -lUniSet2BackendOpenTSDB
Cflags: -I${includedir}/@PACKAGE@/extensions
Cflags: -I${includedir}/@PACKAGE@/extensions
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
View file @
f8b67ef8
...
@@ -531,7 +531,7 @@ string DBServer_PostgreSQL::getMonitInfo( const string& params )
...
@@ -531,7 +531,7 @@ string DBServer_PostgreSQL::getMonitInfo( const string& params )
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
std
::
shared_ptr
<
DBServer_PostgreSQL
>
DBServer_PostgreSQL
::
init_dbserver
(
int
argc
,
const
char
*
const
*
argv
,
std
::
shared_ptr
<
DBServer_PostgreSQL
>
DBServer_PostgreSQL
::
init_dbserver
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
&
prefix
)
const
std
::
shared_ptr
<
uniset
::
SharedMemory
>&
shm
,
const
std
::
string
&
prefix
)
{
{
auto
conf
=
uniset_conf
();
auto
conf
=
uniset_conf
();
...
@@ -551,7 +551,10 @@ std::shared_ptr<DBServer_PostgreSQL> DBServer_PostgreSQL::init_dbserver( int arg
...
@@ -551,7 +551,10 @@ std::shared_ptr<DBServer_PostgreSQL> DBServer_PostgreSQL::init_dbserver( int arg
}
}
uinfo
<<
"(DBServer_PostgreSQL): name = "
<<
name
<<
"("
<<
ID
<<
")"
<<
endl
;
uinfo
<<
"(DBServer_PostgreSQL): name = "
<<
name
<<
"("
<<
ID
<<
")"
<<
endl
;
return
make_shared
<
DBServer_PostgreSQL
>
(
ID
,
prefix
);
auto
db
=
make_shared
<
DBServer_PostgreSQL
>
(
ID
,
prefix
);
if
(
shm
)
shm
->
setDBServer
(
db
);
return
db
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
DBServer_PostgreSQL
::
help_print
(
int
argc
,
const
char
*
const
*
argv
)
void
DBServer_PostgreSQL
::
help_print
(
int
argc
,
const
char
*
const
*
argv
)
...
...
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.h
View file @
f8b67ef8
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "UniSetTypes.h"
#include "UniSetTypes.h"
#include "PostgreSQLInterface.h"
#include "PostgreSQLInterface.h"
#include "DBServer.h"
#include "DBServer.h"
#include "SharedMemory.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
namespace
uniset
namespace
uniset
{
{
...
@@ -61,7 +62,7 @@ namespace uniset
...
@@ -61,7 +62,7 @@ namespace uniset
virtual
~
DBServer_PostgreSQL
();
virtual
~
DBServer_PostgreSQL
();
/*! глобальная функция для инициализации объекта */
/*! глобальная функция для инициализации объекта */
static
std
::
shared_ptr
<
DBServer_PostgreSQL
>
init_dbserver
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
&
prefix
=
"pgsql"
);
static
std
::
shared_ptr
<
DBServer_PostgreSQL
>
init_dbserver
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
s
hared_ptr
<
uniset
::
SharedMemory
>&
ic
=
nullptr
,
const
std
::
s
tring
&
prefix
=
"pgsql"
);
/*! глобальная функция для вывода help-а */
/*! глобальная функция для вывода help-а */
static
void
help_print
(
int
argc
,
const
char
*
const
*
argv
);
static
void
help_print
(
int
argc
,
const
char
*
const
*
argv
);
...
...
extensions/DBServer-PostgreSQL/Makefile.am
View file @
f8b67ef8
...
@@ -4,17 +4,17 @@ UPGSQL_VER=@LIBVER@
...
@@ -4,17 +4,17 @@ UPGSQL_VER=@LIBVER@
lib_LTLIBRARIES
=
libUniSet2-pgsql.la
lib_LTLIBRARIES
=
libUniSet2-pgsql.la
libUniSet2_pgsql_la_LDFLAGS
=
-version-info
$(UPGSQL_VER)
libUniSet2_pgsql_la_LDFLAGS
=
-version-info
$(UPGSQL_VER)
libUniSet2_pgsql_la_SOURCES
=
PostgreSQLInterface.cc DBServer_PostgreSQL.cc
libUniSet2_pgsql_la_SOURCES
=
PostgreSQLInterface.cc DBServer_PostgreSQL.cc
libUniSet2_pgsql_la_LIBADD
=
$(top_builddir)
/lib/libUniSet2.la
$(PGSQL_LIBS)
libUniSet2_pgsql_la_LIBADD
=
$(top_builddir)
/lib/libUniSet2.la
$(
top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
$(
PGSQL_LIBS)
libUniSet2_pgsql_la_CXXFLAGS
=
-std
=
c++17
$(PGSQL_CFLAGS)
libUniSet2_pgsql_la_CXXFLAGS
=
-std
=
c++17
-I
$(top_builddir)
/extensions/SharedMemory
$(PGSQL_CFLAGS)
bin_PROGRAMS
=
@PACKAGE@-pgsql-dbserver
bin_PROGRAMS
=
@PACKAGE@-pgsql-dbserver
@PACKAGE@
_pgsql_dbserver_LDADD
=
libUniSet2-pgsql.la
$(top_builddir)
/lib/libUniSet2.la
$(PGSQL_LIBS)
@PACKAGE@
_pgsql_dbserver_LDADD
=
libUniSet2-pgsql.la
$(top_builddir)
/lib/libUniSet2.la
$(
top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
$(
PGSQL_LIBS)
@PACKAGE@
_pgsql_dbserver_CXXFLAGS
=
-std
=
c++17
$(PGSQL_CFLAGS)
@PACKAGE@
_pgsql_dbserver_CXXFLAGS
=
-std
=
c++17
-I
$(top_builddir)
/extensions/SharedMemory
$(PGSQL_CFLAGS)
@PACKAGE@
_pgsql_dbserver_SOURCES
=
main.cc
@PACKAGE@
_pgsql_dbserver_SOURCES
=
main.cc
noinst_PROGRAMS
=
pgsql-test
noinst_PROGRAMS
=
pgsql-test
pgsql_test_LDADD
=
libUniSet2-pgsql.la
$(top_builddir)
/lib/libUniSet2.la
$(PGSQL_LIBS)
pgsql_test_LDADD
=
libUniSet2-pgsql.la
$(top_builddir)
/lib/libUniSet2.la
$(
top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
$(
PGSQL_LIBS)
pgsql_test_CXXFLAGS
=
-std
=
c++17
$(PGSQL_CFLAGS)
pgsql_test_CXXFLAGS
=
-std
=
c++17
-I
$(top_builddir)
/extensions/SharedMemory
$(PGSQL_CFLAGS)
pgsql_test_SOURCES
=
test.cc
pgsql_test_SOURCES
=
test.cc
# install
# install
...
...
extensions/DBServer-PostgreSQL/libUniSet2PostgreSQL.pc.in
View file @
f8b67ef8
...
@@ -5,7 +5,7 @@ includedir=@includedir@
...
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: libUniSet2PostgreSQL
Name: libUniSet2PostgreSQL
Description: Support library for libUniSet2PostgreSQL
Description: Support library for libUniSet2PostgreSQL
Requires: libUniSet2 libpqxx
Requires: libUniSet2 libpqxx
libUniSet2SharedMemory
Version: @VERSION@
Version: @VERSION@
Libs: -L${libdir} -lUniSet2-pgsql
Libs: -L${libdir} -lUniSet2-pgsql
Cflags: -std=c++17 -I${includedir}/@PACKAGE@ -I${includedir}/@PACKAGE@/extensions/pgsql
Cflags: -std=c++17 -I${includedir}/@PACKAGE@ -I${includedir}/@PACKAGE@/extensions/pgsql
include/IOController.h
View file @
f8b67ef8
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "UniSetManager.h"
#include "UniSetManager.h"
#include "Configuration.h"
#include "Configuration.h"
#include "Mutex.h"
#include "Mutex.h"
#include "DBServer.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
namespace
uniset
namespace
uniset
{
{
...
@@ -41,7 +42,7 @@ namespace uniset
...
@@ -41,7 +42,7 @@ namespace uniset
* Поэтому неизменность ioList во время всей жизни объекта должна гарантироваться.
* Поэтому неизменность ioList во время всей жизни объекта должна гарантироваться.
* В частности, очень важной является структура USensorInfo, а также userdata,
* В частности, очень важной является структура USensorInfo, а также userdata,
* которые используются для "кэширования" (сохранения) указателей на специальные данные.
* которые используются для "кэширования" (сохранения) указателей на специальные данные.
* (см. также IONotifyContoller).
* (см. также IONotifyCont
r
oller).
*/
*/
class
IOController
:
class
IOController
:
public
UniSetManager
,
public
UniSetManager
,
...
@@ -53,6 +54,8 @@ namespace uniset
...
@@ -53,6 +54,8 @@ namespace uniset
IOController
(
const
uniset
::
ObjectId
id
);
IOController
(
const
uniset
::
ObjectId
id
);
virtual
~
IOController
();
virtual
~
IOController
();
void
setDBServer
(
const
std
::
shared_ptr
<
uniset
::
DBServer
>&
dbserver
);
virtual
uniset
::
ObjectType
getType
()
override
virtual
uniset
::
ObjectType
getType
()
override
{
{
return
uniset
::
ObjectType
(
"IOController"
);
return
uniset
::
ObjectType
(
"IOController"
);
...
@@ -293,6 +296,7 @@ namespace uniset
...
@@ -293,6 +296,7 @@ namespace uniset
bool
isPingDBServer
;
// флаг связи с DBServer-ом
bool
isPingDBServer
;
// флаг связи с DBServer-ом
uniset
::
ObjectId
dbserverID
=
{
uniset
::
DefaultObjectId
};
uniset
::
ObjectId
dbserverID
=
{
uniset
::
DefaultObjectId
};
std
::
shared_ptr
<
uniset
::
DBServer
>
dbserver
=
{
nullptr
};
std
::
mutex
loggingMutex
;
/*!< logging info mutex */
std
::
mutex
loggingMutex
;
/*!< logging info mutex */
...
...
src/Processes/IOController.cc
View file @
f8b67ef8
...
@@ -493,12 +493,25 @@ void IOController::ioUnRegistration( const uniset::ObjectId sid )
...
@@ -493,12 +493,25 @@ void IOController::ioUnRegistration( const uniset::ObjectId sid )
ui
->
unregister
(
sid
);
ui
->
unregister
(
sid
);
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
void
IOController
::
setDBServer
(
const
std
::
shared_ptr
<
DBServer
>&
db
)
{
dbserver
=
db
;
}
// ---------------------------------------------------------------------------
void
IOController
::
logging
(
uniset
::
SensorMessage
&
sm
)
void
IOController
::
logging
(
uniset
::
SensorMessage
&
sm
)
{
{
std
::
lock_guard
<
std
::
mutex
>
l
(
loggingMutex
);
std
::
lock_guard
<
std
::
mutex
>
l
(
loggingMutex
);
try
try
{
{
if
(
dbserver
)
{
sm
.
consumer
=
dbserverID
;
dbserver
->
push
(
sm
.
transport_msg
());
isPingDBServer
=
true
;
return
;
}
// значит на этом узле нет DBServer-а
// значит на этом узле нет DBServer-а
if
(
dbserverID
==
uniset
::
DefaultObjectId
)
if
(
dbserverID
==
uniset
::
DefaultObjectId
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment