10
10
#define DB_SQL_Net_H
12
12
#include "NodePtr.h"
13
#include "QtSQLWrapper.hpp"
15
17
//------------------------------------------------------------------------------
17
ANNOUNCE_CLASS(sDB_SQL_NodeUID)
18
ANNOUNCE_CLASS(sDB_SQL_NodeLocation)
20
//---------------------------------------------------------- sDB_SQL_NodeUID ---
22
class RANet_EXPORT sDB_SQL_NodeUID : public sNodeUID
25
explicit sDB_SQL_NodeUID ();
26
sDB_SQL_NodeUID (rcsDB_SQL_NodeUID);
27
rsDB_SQL_NodeUID operator= (rcsDB_SQL_NodeUID);
32
//----------------------------------------------------- sDB_SQL_NodeLocation ---
34
class RANet_EXPORT sDB_SQL_NodeLocation : public sNodeLocation
37
virtual void Dummy () =0;
38
explicit sDB_SQL_NodeLocation ();
39
sDB_SQL_NodeLocation (rcsDB_SQL_NodeLocation);
40
rsDB_SQL_NodeLocation operator= (rcsDB_SQL_NodeLocation);
41
bool operator== (rcsDB_SQL_NodeLocation) const;
42
virtual psNodeLocation Replica () const;
47
// enum eIOPrefix //used on disk
48
// {NoNode //for NullNode
53
// {NotAllocated //for newborn nodes, not
54
// //attached to the net
60
// sNodeLocation (eType AType
63
// sNodeLocation (eType AType
66
// ,rcsString APathSuffix
67
// ,tStreamPos AnOffset);
70
// tNodeUID NodeUID; // =0 for NullNode
71
// // =1 for nodes having one host and
72
// // stored with it in the same file
73
// // >1 and unique for others
75
// sString DefaultSuffix;
79
// static unsigned int Counter;
19
ANNOUNCE_CLASS(sDB_SQL_Net)
83
21
//-------------------------------------------------------------- sDB_SQL_Net ---
85
23
class RANet_EXPORT sDB_SQL_Net : public sNet
26
//------------------------------------------- sDB_SQL_Net::sNodeUUID ---
27
ANNOUNCE_CLASS(sNodeUUID)
28
class RANet_EXPORT sNodeUUID : public sNodeLocation
31
static QByteArray RootId ();
33
virtual psNodeLocation Replica () const;
34
bool operator == (rcsNodeUUID) const;
35
explicit sNodeUUID (const QByteArray & db_id
36
,const QByteArray & node_id)
38
,DBId(db_id),NodeId(node_id)
41
QByteArray DBId; //!< Universally Unique Identifier (UUID)
42
//! in common 38-length textual form, like
43
//! "{550e8400-e29b-41d4-a716-446655440000}".
44
QByteArray NodeId; //!< Universally Unique Identifier (UUID)
45
//! in common 38-length textual form, like
46
//! "{550e8400-e29b-41d4-a716-446655440000}".
49
//-------------------------------------------- sDB_SQL_Net::sDB_Info ---
50
ANNOUNCE_CLASS(sDB_Info)
51
class RANet_EXPORT sDB_Info
59
unsigned short int Port;
62
//------------------------------------------- sDB_SQL_Net::sNodeInfo ---
63
ANNOUNCE_CLASS(sNodeInfo)
64
class RANet_EXPORT sNodeInfo
67
friend class sDB_SQL_Net;
69
//----------------------------------------------------------------------
71
typedef std::map<sNodeUUID,psNodeInfo> tNodeIndex;
88
74
virtual ~sDB_SQL_Net ();
89
75
sDB_SQL_Net (const QString & sqlite_file_name);
91
77
public://implementation of inherited
78
virtual bool CreateNew ();
92
79
virtual bool Initiate ();
93
virtual bool CreateNew ();
80
virtual rsNodePtr Root ();
81
virtual psNode GetNode (RA::psNodeLocation);
96
84
virtual bool CreateTables ();
85
// void RegisterNode ();
99
const QString RootDBType;
100
const QString RootDBName;
101
const QString RootHost;
102
const unsigned short int RootHostPort;
103
const QString RootHostLoginName;
92
tNodeIndex LoadedNodes;
106
95
//------------------------------------------------------------------------------