From: Norbert Bizet Date: Tue, 12 May 2020 16:44:09 +0000 (+0200) Subject: BEE Backport bacula/src/stored/cloud_parts.h X-Git-Tag: Release-11.3.2~1664 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e68291d7c24100f3f4e953849e30e2189bc123d;p=thirdparty%2Fbacula.git BEE Backport bacula/src/stored/cloud_parts.h This commit is the result of the squash of the following main commits: Author: Norbert Bizet Date: Mon Apr 29 10:07:01 2019 -0400 cloud: compute part hash at upload and download Use GENERATE_CLOUD_HASH to enable it. Not enabled with S3 cloud. Author: Norbert Bizet Date: Wed Oct 12 10:53:12 2016 +0200 Move parts comparison procedures within cloud_parts comparison are dummy unit tested. --- diff --git a/bacula/src/stored/cloud_parts.h b/bacula/src/stored/cloud_parts.h index 5f5116bccd..a84ccc8669 100644 --- a/bacula/src/stored/cloud_parts.h +++ b/bacula/src/stored/cloud_parts.h @@ -20,6 +20,7 @@ * Routines for managing Volumes contains and comparing parts * * Written by Norbert Bizet, May MMXVI + * */ #ifndef _CLOUD_PARTS_H_ #define _CLOUD_PARTS_H_ @@ -33,6 +34,7 @@ struct cloud_part uint32_t index; utime_t mtime; uint64_t size; + unsigned char hash64[64]; }; /* equality operators for cloud_part structure */ @@ -76,10 +78,10 @@ class cloud_proxy : public SMARTALLOC private: htable *m_hash; /* the root htable */ bool m_owns; /* determines if ilist own the cloud_parts */ - pthread_mutex_t m_mutex; /* protect access*/ + pthread_mutex_t m_mutex; /* protect access*/ static cloud_proxy *m_pinstance; /* singleton instance */ static uint64_t m_count; /* static refcount */ - + ~cloud_proxy(); public: @@ -92,7 +94,7 @@ public: /* either using a part ptr (part can be disposed afterward)... */ bool set(const char *volume, cloud_part *part); /* ...or by passing basic part parameters (part is constructed internally) */ - bool set(const char *volume, uint32_t index, utime_t mtime, uint64_t size); + bool set(const char *volume, uint32_t index, utime_t mtime, uint64_t size, unsigned char *hash64); /* one can retrieve the proxied cloud_part using the get method */ cloud_part *get(const char *volume, uint32_t part_idx); @@ -101,7 +103,7 @@ public: /* Check if the volume entry exists and return true if it's the case */ bool volume_lookup(const char *volume); - + /* reset the volume list content with the content of part_list */ bool reset(const char *volume, ilist *part_list);