4#include <Cyqlops/Crypto/Hash.h>
5#include <Cyqlops/Crypto/RSAAlgorithm.h>
7#include <knowCore/Timestamp.h>
8#include <knowCore/TypeDefinitions.h>
10#include <kDB/Repository/TriplesStore_p.h>
11#include <kDB/Repository/DatabaseInterface/PostgreSQL/SQLInterface_p.h>
13namespace kDB::Repository::VersionControl::Utils
15 inline QByteArray computeDeltaHash(
const QByteArray& _diff)
17 return Cyqlops::Crypto::Hash::md5(_diff);
19 inline QByteArray computeRevisionHash(
const QByteArray& _content_hash,
int _historicity)
21 return Cyqlops::Crypto::Hash::md5(_content_hash, _historicity);
24 inline QByteArray computeSignature(
const Cyqlops::Crypto::RSAAlgorithm& _signature_algortihm,
const QUuid& _author,
const knowCore::Timestamp& _time,
const QByteArray& _hash)
26 QByteArray hash = Cyqlops::Crypto::Hash::md5(_author.toByteArray(), _time.
toEpoch<knowCore::NanoSeconds>().count(), _hash);
27 return _signature_algortihm.sign(hash, Cyqlops::Crypto::Hash::Algorithm::RAW);
35 new_head_map.add(
"id", _revisionId);
36 new_head_map.add(
"hash", QString::fromLatin1(_hash.toHex()));
41 KNOWCORE_RETURN_VALUE_TRY(hash_var, DatabaseInterface::PostgreSQL::SQLInterface::getMeta(_connection_info, _definition->name,
QStringList() <<
"versioning" <<
"head" <<
"hash"));
42 KNOWCORE_RETURN_VALUE_TRY(hash_str, hash_var.value<QString>());
43 return kCrvSuccess(QByteArray::fromHex(hash_str.toLatin1()));
Definition QueryConnectionInfo.h:8
Definition Transaction.h:19
Definition Timestamp.h:39
_unit_ toEpoch() const
Definition Timestamp.h:161
Definition ValueHash.h:13
static Value fromValue(const _T_ &_value)
Definition Value.h:241