Classified ads
|
Data record in distributed database. More...
#include <cadbrecord.h>
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 |
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.
typedef struct CaDbRecord::SearchStructure CaDbRecord::SearchTerms |
Data structure for expressing db record search conditions
CaDbRecord::CaDbRecord | ( | ) |
constructor
CaDbRecord::~CaDbRecord | ( | ) |
destructor
QByteArray CaDbRecord::asJSon | ( | ) | const |
returns db record data as JSon stream
bool CaDbRecord::fromJSon | ( | const QByteArray & | aJSonBytes | ) |
parses json into members
Hash CaDbRecord::iCollectionId |
Records belong to collections. Collection is a Hash usually obtained by calculating SHA1 over a string.
QByteArray CaDbRecord::iData |
Actual record data. May be empty. Max size is limited by classified ads network object size, slightly less than 2MB.
bool CaDbRecord::iIsEncrypted |
true if iData needs to be de-crypted before use
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.
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
qint64 CaDbRecord::iSearchNumber |
Similar to iSearchPhrase but a number.
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.
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.
quint32 CaDbRecord::iTimeOfPublish |
time when record was last time published