ArnLib  4.0.x
Active Registry Network
ArnPersist Class Reference

Class for handling persistent Arn Data object. More...

#include <ArnPersist.hpp>

Inheritance diagram for ArnPersist:
Collaboration diagram for ArnPersist:

Public Slots

bool doArchive (const QString &name=QString())
 Do a persistent database backup. More...
 

Public Member Functions

 ArnPersist (QObject *parent=arnNullptr)
 
 ~ArnPersist ()
 
bool setMountPoint (const QString &path)
 Set the persistent enabled tree path. More...
 
void setPersistDir (const QString &path)
 Set the persistent file directory root More...
 
void setArchiveDir (const QString &path)
 Set the persistent database backup directory. More...
 
void setVcs (ArnVcs *vcs)
 Set the Version Control System to be used. More...
 
bool setupDataBase (const QString &dbName="persist.db")
 Setup the persistent database. More...
 
bool flush (const QString &path=QString())
 Save any pending values now. More...
 

Detailed Description

Class for handling persistent Arn Data object.

About Persistent Arn Data Object

This class is used at an ArnServer to implemennt persistent objects.

Example usage

// In class declare
ArnPersist *_persist;
VcsGit *_git;
// In class code
_persist = new ArnPersist( this);
_persist->setupDataBase("persist.db");
_persist->setArchiveDir("archive"); // Use this directory for backup
_persist->setPersistDir("persist"); // use this directory for VCS persist files
_persist->setMountPoint("/");
_persist->setVcs( _git);

Definition at line 168 of file ArnPersist.hpp.

Constructor & Destructor Documentation

◆ ArnPersist()

ArnPersist::ArnPersist ( QObject *  parent = arnNullptr)
explicit

Definition at line 210 of file ArnPersist.cpp.

◆ ~ArnPersist()

ArnPersist::~ArnPersist ( )

Definition at line 226 of file ArnPersist.cpp.

Member Function Documentation

◆ doArchive

bool ArnPersist::doArchive ( const QString &  name = QString())
slot

Do a persistent database backup.

By default the backup file will be marked by date and clock. Optionally a custom name can be set for the backup file.

Parameters
[in]nameis the file name of the backup. QString() gives default name.
See also
setArchiveDir()

Definition at line 843 of file ArnPersist.cpp.

◆ flush()

bool ArnPersist::flush ( const QString &  path = QString())

Save any pending values now.

Persistent values are normally delayed before saving.

Parameters
[in]pathis the starting path (tree) as filter. If empty, no filter.
Return values
falseif error.
See also
Persistent Arn Data Objects

Definition at line 527 of file ArnPersist.cpp.

◆ setArchiveDir()

void ArnPersist::setArchiveDir ( const QString &  path)

Set the persistent database backup directory.

In this directory, all backup files are stored.

Parameters
[in]pathis the persistent file directory root.
See also
doArchive()
Persistent Arn Data Objects

Definition at line 240 of file ArnPersist.cpp.

◆ setMountPoint()

bool ArnPersist::setMountPoint ( const QString &  path)

Set the persistent enabled tree path.

Mountpoint is a folder. When an Arn Data Object change to Save mode in this folder or anywhere below in the tree, it will be treated as a persistent object.

Parameters
[in]pathis the persistent enabled tree.
Return values
falseif error.
See also
Persistent Arn Data Objects

Definition at line 434 of file ArnPersist.cpp.

◆ setPersistDir()

void ArnPersist::setPersistDir ( const QString &  path)

Set the persistent file directory root

In this directory and below, all persistent files are stored. The path correspond to the root in Arn.

This file directory can optionally be managed by a version control system, set by using setVcs().

Example: path is set to "/usr/local/arn_persist". There is a file stored at "/usr/local/arn_persist/@/doc/help.html". This file will be mapped to Arn at "//doc/help.html".

Parameters
[in]pathis the persistent file directory root.
See also
setVcs()
Persistent Arn Data Objects

Definition at line 232 of file ArnPersist.cpp.

◆ setupDataBase()

bool ArnPersist::setupDataBase ( const QString &  dbName = "persist.db")

Setup the persistent database.

Starting a SQLite database to store persistent Arn Data Object in.

Parameters
[in]dbNameis the name (and path) of the SQLite database file.
Return values
falseif error.
See also
Persistent Arn Data Objects

Definition at line 466 of file ArnPersist.cpp.

◆ setVcs()

void ArnPersist::setVcs ( ArnVcs *  vcs)

Set the Version Control System to be used.

The VCS is implemented in a class derived from ArnVcs. Ownership is taken of this VCS. Any previos set VCS will be deleted.

Parameters
[in]vcsis the class implementing the VCS. Use 0 (null) to set none.
See also
setPersistDir()
Persistent Arn Data Objects

Definition at line 248 of file ArnPersist.cpp.


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