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)
 
QDir directory () const
 
int port () const
 
knowCore::ReturnVoid startIfNeeded ()
 
knowCore::ReturnVoid start ()
 
knowCore::ReturnVoid restart (bool _force=false)
 
knowCore::ReturnVoid stop (bool _force=false)
 
knowCore::ReturnVoid erase ()
 
Connection createConnection () const
 
bool isControlling () const
 
void detach ()
 
bool isRunning () const
 
void autoSelectPort ()
 
knowCore::ReturnVoid setConfiguration (const QString &_key, const QString &_value, bool _restart_server=false)
 
knowCore::ReturnVoid setConfiguration (const QList< QPair< QString, QString > > &_value, bool _restart_server=false)
 

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()

knowCore::ReturnVoid 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]

knowCore::ReturnVoid 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]

knowCore::ReturnVoid Store::setConfiguration ( const QString & _key,
const QString & _value,
bool _restart_server = false )

Set the configuration of server, convenient overload.

◆ start()

knowCore::ReturnVoid 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()

knowCore::ReturnVoid 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()

knowCore::ReturnVoid 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: