Classified ads
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
CaDbRecord Class Reference

Data record in distributed database. More...

#include <cadbrecord.h>

Collaboration diagram for CaDbRecord:
Collaboration graph
[legend]

Classes

struct  SearchStructure
 

Public Types

typedef struct CaDbRecord::SearchStructure SearchTerms
 

Public Member Functions

 CaDbRecord ()
 
 ~CaDbRecord ()
 
QByteArray asJSon () const
 
bool fromJSon (const QByteArray &aJSonBytes)
 

Public Attributes

Hash iRecordId
 
Hash iCollectionId
 
Hash iSenderHash
 
QString iSearchPhrase
 
qint64 iSearchNumber
 
QByteArray iData
 
bool iIsEncrypted
 
quint32 iTimeOfPublish
 
bool iIsSignatureVerified
 
QByteArray iSignature
 

Detailed Description

Data record in distributed database.

In same manner as classified ads are published in groups, it is possible to publish records in a collection. This class carries one record in a collection. Db records may be accessed via TCL interface, alternative APIs are possible too.

Member Typedef Documentation

◆ SearchTerms

Data structure for expressing db record search conditions

Constructor & Destructor Documentation

◆ CaDbRecord()

CaDbRecord::CaDbRecord ( )

constructor

◆ ~CaDbRecord()

CaDbRecord::~CaDbRecord ( )

destructor

Member Function Documentation

◆ asJSon()

QByteArray CaDbRecord::asJSon ( ) const

returns db record data as JSon stream

◆ fromJSon()

bool CaDbRecord::fromJSon ( const QByteArray &  aJSonBytes)

parses json into members

Member Data Documentation

◆ iCollectionId

Hash CaDbRecord::iCollectionId

Records belong to collections. Collection is a Hash usually obtained by calculating SHA1 over a string.

◆ iData

QByteArray CaDbRecord::iData

Actual record data. May be empty. Max size is limited by classified ads network object size, slightly less than 2MB.

◆ iIsEncrypted

bool CaDbRecord::iIsEncrypted

true if iData needs to be de-crypted before use

◆ iIsSignatureVerified

bool CaDbRecord::iIsSignatureVerified

True if signature is checked against profile key. It is possible to receive database records without having key of the profile that published the records. If this happens we have a record that we can't verify so mark the situation also here: we can try to pull the profile when record is used and try to verify it then.

◆ iRecordId

Hash CaDbRecord::iRecordId

About unique id given to db record. Value is assigned when record is first persisted via CaDbRecordModel::publishDbRecord and then never changed no matter what happens to the record

◆ iSearchNumber

qint64 CaDbRecord::iSearchNumber

Similar to iSearchPhrase but a number.

◆ iSearchPhrase

QString CaDbRecord::iSearchPhrase

Helper-string for helping in finding the records once they are published and stored. Because actual record data is only an array of bytes and classified ads does not try to parse or interpret that data, user of database records may want to assign here any number of strings that may later be used in CaDbRecordModel::searchRecords to find records somehow relevant to business-case in hand.

◆ iSenderHash

Hash CaDbRecord::iSenderHash

Fingerprint of Profile that published the record

◆ iSignature

QByteArray CaDbRecord::iSignature

Signature of data. Signature is calculated over iData ( may be empty ) and string-presentation of recordId/collectionId/senderHash -string-presentations. See implementation of method CaDbRecordModel::tryVerifyRecord for details. When record is initially published, this is naturally empty, when record is modified and gets re-published, the publish -process will calculate signature again.

◆ iTimeOfPublish

quint32 CaDbRecord::iTimeOfPublish

time when record was last time published


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