Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 4623:95ffe3b6ef7c db-changes
handling of revisions for metadata
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 16 Apr 2021 17:13:03 +0200 |
parents | 2684544ff03c |
children | f7d5372b59b3 |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Fri Apr 16 10:48:57 2021 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Fri Apr 16 17:13:03 2021 +0200 @@ -254,10 +254,11 @@ } bool LookupMetadata(std::string& target, + int64_t& revision, int64_t id, MetadataType type) { - return transaction_.LookupMetadata(target, id, type); + return transaction_.LookupMetadata(target, revision, id, type); } bool LookupParent(int64_t& parentId, @@ -359,9 +360,10 @@ void SetMetadata(int64_t id, MetadataType type, - const std::string& value) + const std::string& value, + int64_t revision) { - return transaction_.SetMetadata(id, type, value); + return transaction_.SetMetadata(id, type, value, revision); } void SetProtectedPatient(int64_t internalId, @@ -503,6 +505,7 @@ const std::string& publicId); bool LookupMetadata(std::string& target, + int64_t& revision, const std::string& publicId, ResourceType expectedType, MetadataType type); @@ -569,12 +572,22 @@ void SetProtectedPatient(const std::string& publicId, bool isProtected); - void SetMetadata(const std::string& publicId, + void SetMetadata(int64_t& newRevision /*out*/, + const std::string& publicId, MetadataType type, - const std::string& value); + const std::string& value, + bool hasOldRevision, + int64_t oldRevision); - void DeleteMetadata(const std::string& publicId, - MetadataType type); + // Same as "SetMetadata()", but doesn't care about revisions + void OverwriteMetadata(const std::string& publicId, + MetadataType type, + const std::string& value); + + bool DeleteMetadata(const std::string& publicId, + MetadataType type, + bool hasRevision, + int64_t revision); uint64_t IncrementGlobalSequence(GlobalProperty sequence, bool shared);