kDB: Knowledge DataBase
Loading...
Searching...
No Matches
kDB::Repository::Store Class Reference

#include <Store.h>

Public Member Functions

 Store (const QDir &_storage, int _port=1242)
 
 Store (const SectionName &_section, const StoreName &_store, int _port)
 
 Store (const StoreName &_store, int _port)
 
QDir directory () const
 
int port () const
 
cres_qresult< void > startIfNeeded ()
 
cres_qresult< void > start ()
 
cres_qresult< void > restart (bool _force=false)
 
cres_qresult< void > stop (bool _force=false)
 
cres_qresult< void > erase ()
 
Connection createConnection () const
 
bool isControlling () const
 
void detach ()
 
bool isRunning () const
 
void autoSelectPort ()
 
cres_qresult< void > setConfiguration (const QString &_key, const QString &_value, bool _restart_server=false)
 
cres_qresult< void > setConfiguration (const QList< QPair< QString, QString > > &_value, bool _restart_server=false)
 

Static Public Member Functions

static QDir standardDir (const SectionName &_section, const StoreName &_name)
 
static QDir standardDir (const StoreName &_name)
 

Detailed Description

Represent a postgresql server, allow it to start, stop and create connection to it.

Member Function Documentation

◆ autoSelectPort()

void Store::autoSelectPort ( )

Attempt to guess the port, it only works if the store has already been started.

◆ createConnection()

Connection Store::createConnection ( ) const

Create a connection to that store.

◆ detach()

void Store::detach ( )

detach this instance of the store, and release control, i.e., the postgresql database will not be stopped automatically when this object is deleted.

◆ erase()

cres_qresult< void > Store::erase ( )

This will erase all the content of the database.

◆ isControlling()

bool Store::isControlling ( ) const
Returns
true if this object is controlling the store. If set to true, the store will be stopped when this object is deleted, unless a call to detach is made

◆ setConfiguration() [1/2]

cres_qresult< void > Store::setConfiguration ( const QList< QPair< QString, QString > > & _value,
bool _restart_server = false )

Set the configuration of the postgresql server.

This function start the server if needed (and then stop if it was started this way). Some changes to configuration require the server to be restarted, this can be done if _restart_server is set to true (default is false)

◆ setConfiguration() [2/2]

cres_qresult< void > Store::setConfiguration ( const QString & _key,
const QString & _value,
bool _restart_server = false )

Set the configuration of server, convenient overload.

◆ standardDir()

QDir Store::standardDir ( const SectionName & _section,
const StoreName & _name )
static
Returns
a directory with the _section and _name from the standard directory. On linux it would be .local/share/auksys/kdb/stores/section/name

◆ start()

cres_qresult< void > Store::start ( )

Starts the store. And takes control of the server, when this object is deleted the server will be stopped.

Returns
false if the server failed to start or was already running

◆ startIfNeeded()

cres_qresult< void > Store::startIfNeeded ( )

Starts the store if needed (if the store is already started, the object does not take control of the instance, and it won't be stopped when the object is deleted)

Returns
true if the server was started or running, false if it failed to start

◆ stop()

cres_qresult< void > Store::stop ( bool _force = false)

Stop the server (even if it is not controlled!).


The documentation for this class was generated from the following files: