diff options
Diffstat (limited to 'qpid/cpp/src/qpid/linearstore/jrnl/utils/enq_hdr.h')
-rw-r--r-- | qpid/cpp/src/qpid/linearstore/jrnl/utils/enq_hdr.h | 88 |
1 files changed, 37 insertions, 51 deletions
diff --git a/qpid/cpp/src/qpid/linearstore/jrnl/utils/enq_hdr.h b/qpid/cpp/src/qpid/linearstore/jrnl/utils/enq_hdr.h index f0d052c1f3..5cfb6150cf 100644 --- a/qpid/cpp/src/qpid/linearstore/jrnl/utils/enq_hdr.h +++ b/qpid/cpp/src/qpid/linearstore/jrnl/utils/enq_hdr.h @@ -21,66 +21,52 @@ * */ -/** - * \file enq_hdr.h - * - * Qpid asynchronous store plugin library - * - * File containing code for class mrg::journal::enq_hdr (enueue header), - * used to start an enqueue record in the journal. - * - * \author Kim van der Riet - */ - #include <stdbool.h> #include "rec_hdr.h" #pragma pack(1) - /** - * \brief Struct for enqueue record. - * - * Struct for enqueue record. In addition to the common data, this header includes both the - * xid and data blob sizes. - * - * This header precedes all enqueue data in journal files. - * - * Record header info in binary format (32 bytes): - * <pre> - * 0 7 - * +---+---+---+---+---+---+---+---+ -+ - * | magic | v | e | flags | | - * +---+---+---+---+---+---+---+---+ | struct hdr - * | rid | | - * +---+---+---+---+---+---+---+---+ -+ - * | xidsize | - * +---+---+---+---+---+---+---+---+ - * | dsize | - * +---+---+---+---+---+---+---+---+ - * v = file version (If the format or encoding of this file changes, then this - * number should be incremented) - * e = endian flag, false (0x00) for little endian, true (0x01) for big endian - * </pre> - * - * Note that journal files should be transferable between 32- and 64-bit - * hardware of the same endianness, but not between hardware of opposite - * entianness without some sort of binary conversion utility. Thus buffering - * will be needed for types that change size between 32- and 64-bit compiles. - */ +/** + * \brief Struct for enqueue record. + * + * Struct for enqueue record. In addition to the common data, this header includes both the + * xid and data blob sizes. + * + * This header precedes all enqueue data in journal files. + * + * Record header info in binary format (32 bytes): + * <pre> + * 0 7 + * +---+---+---+---+---+---+---+---+ -+ + * | magic | ver | flags | | + * +---+---+---+---+---+---+---+---+ | struct rec_hdr_t + * | rid | | + * +---+---+---+---+---+---+---+---+ -+ + * | xidsize | + * +---+---+---+---+---+---+---+---+ + * | dsize | + * +---+---+---+---+---+---+---+---+ + * v = file version (If the format or encoding of this file changes, then this + * number should be incremented) + * </pre> + */ typedef struct enq_hdr_t { - rec_hdr_t _rhdr; - uint64_t _xidsize; ///< XID size - uint64_t _dsize; ///< Record data size + rec_hdr_t _rhdr; /**< Common record header struct */ + uint64_t _xidsize; /**< XID size in octets */ + uint64_t _dsize; /**< Record data size in octets */ } enq_hdr_t; -static const uint16_t ENQ_HDR_TRANSIENT_MASK; -static const uint16_t ENQ_HDR_EXTERNAL_MASK; +static const uint16_t ENQ_HDR_TRANSIENT_MASK = 0x10; +static const uint16_t ENQ_HDR_EXTERNAL_MASK = 0x20; -bool is_transient(enq_hdr_t *eh); -void set_transient(enq_hdr_t *eh, const bool transient); -bool is_external(enq_hdr_t *eh); -void set_external(enq_hdr_t *eh, const bool external); +void enq_hdr_init(enq_hdr_t* dest, const uint32_t magic, const uint16_t version, const uint16_t uflag, + const uint64_t rid, const uint64_t xidsize, const uint64_t dsize); +void enq_hdr_copy(enq_hdr_t* dest, const enq_hdr_t* src); +bool is_enq_transient(const enq_hdr_t *eh); +void set_enq_transient(enq_hdr_t *eh, const bool transient); +bool is_enq_external(const enq_hdr_t *eh); +void set_enq_external(enq_hdr_t *eh, const bool external); #pragma pack() -#endif // ifndef QPID_LINEARSTORE_JRNL_UTILS_ENQ_HDR_H +#endif /* ifndef QPID_LINEARSTORE_JRNL_UTILS_ENQ_HDR_H */ |