]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/lib/bget_msg.h
authorAlain Spineux <alain@baculasystems.com>
Mon, 20 Apr 2020 14:49:58 +0000 (16:49 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:16 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Oct 31 11:06:59 2019 +0100

    Fix compilation warning on bget_msg.h

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Sep 24 10:17:51 2019 +0200

    dedup: move all dedup code into the plugin

    - remove global variables: dedupengine and bucker_manager
    - update protocol SD<->DIR
    - extend dedup_dev and BufferedMsgSD to suuport all function
    - create "dummy" functions in dev.h
    Warning :
    - include a dedupengine use counter
    - .status storage=XXX dedupengine display all the dedupengine on the SD
     instead of the one(s) related to the "device"

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Aug 4 11:09:05 2015 +0200

    dedup: create "loaded reference", a reference that hold embeded data

    - A reference can hold data, that is not in the DDE.
    this is mostly for small chunk of data.
    This is useful when we know a chunk will not dedup or when a chunk
    is too small.
    The metadata in STREAM_WIN32_DATA is a good candidate

    - DedupEngine::decode_ref() help in decoding reference

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Jul 14 21:00:47 2015 +0200

    add new file bget_msg.h

bacula/src/lib/bget_msg.h

index ad9ede9b65157f92e511e1b4212da79bf43baf16..5a3185486dbf1396f7fef082f28892ab82c3cabf 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "bacula.h"
 
+struct DEV_RECORD;
+
 typedef uint64_t blockaddr;
 typedef int64_t  blockidx;
 
@@ -33,6 +35,12 @@ typedef int64_t  blockidx;
 #endif
 
 
+/*
+ * class bmessage and class GetMsg are used by client side rehydartion
+ * to control latency
+ *
+ */
+
 class bmessage: public SMARTALLOC
 {
 public:
@@ -47,6 +55,15 @@ public:
    int ret;         // return value from bget_msg()
    int jobbytes;    // must be added to jcr->JobBytes if block is downloaded
 
+   unsigned char *hash; // point to an offset of msg, the hash
+   char *eraw;          // point to an offset of msg, lz4encoded raw data
+   blockaddr *paddr;      // point to an offset of msg
+   blockaddr addr;        // the block address
+   int32_t dedup_size;   // block size from reference
+   bool is_sparse;  // is a SPARSE stream
+   bool is_header;  // is a header record
+   bool is_dedup;   // is a dedup reference
+   bool do_flowcontrol;
    bmessage(int bufsize);
    virtual ~bmessage();
    void swap(BSOCK *sock);
@@ -92,6 +109,14 @@ public:
 
    bmessage *new_msg() { return New(bmessage(bufsize)); };
 
+   /* used by inherited classes to commit any pending operations at the end */
+   virtual int commit(POOLMEM *&/*errmsg*/, uint32_t /*jobid*/) { return 0; };
+
+   /* used by classes to commit any pending operations at the end */
+   virtual bool dedup_store_chunk(DEV_RECORD */*rec*/, const char */*rbuf*/, int /*rbuflen*/,
+                                  char */*dedup_ref_buf*/, char */*wdedup_ref_buf*/, POOLMEM *&/*errmsg*/)
+      { return true; /* OK */ };
+
 };
 
 /* Call this function to release the memory associated with the message queue