1 /***************************************************************************** 2 3 Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved. 4 5 This program is free software; you can redistribute it and/or modify it under 6 the terms of the GNU General Public License, version 2.0, as published by the 7 Free Software Foundation. 8 9 This program is also distributed with certain software (including but not 10 limited to OpenSSL) that is licensed under separate terms, as designated in a 11 particular file or component or in included license documentation. The authors 12 of MySQL hereby grant you an additional permission to link the program and 13 your derivative works with the separately licensed software that they have 14 included with MySQL. 15 16 This program is distributed in the hope that it will be useful, but WITHOUT 17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, 19 for more details. 20 21 You should have received a copy of the GNU General Public License along with 22 this program; if not, write to the Free Software Foundation, Inc., 23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 25 *****************************************************************************/ 26 #ifndef zlob0read_h 27 #define zlob0read_h 28 29 #include "zlob0index.h" 30 31 namespace lob { 32 33 /** Read one data chunk associated with one index entry. 34 @param[in] index the clustered index containing the LOB. 35 @param[in] entry pointer to the index entry 36 @param[in] offset the offset from which to read the chunk. 37 @param[in,out] len the length of the output buffer. This length can 38 be greater than the chunk size. 39 @param[in,out] buf the output buffer. 40 @param[in] mtr mini-transaction context. 41 @return number of bytes copied into the output buffer. */ 42 ulint z_read_chunk(dict_index_t *index, z_index_entry_t &entry, ulint offset, 43 ulint &len, byte *&buf, mtr_t *mtr); 44 45 /** Read one zlib stream fully, given its index entry. 46 @param[in] index the index dictionary object. 47 @param[in] entry the index entry (memory copy). 48 @param[in,out] zbuf the output buffer 49 @param[in] zbuf_size the size of the output buffer. 50 @param[in,out] mtr mini-transaction. 51 @return the size of the zlib stream.*/ 52 ulint z_read_strm(dict_index_t *index, z_index_entry_t &entry, byte *zbuf, 53 ulint zbuf_size, mtr_t *mtr); 54 55 /** Fetch a compressed large object (ZLOB) from the system. 56 @param[in] ctx the read context information. 57 @param[in] trx the transaction that is doing the read. 58 @param[in] ref the LOB reference identifying the LOB. 59 @param[in] offset read the LOB from the given offset. 60 @param[in] len the length of LOB data that needs to be fetched. 61 @param[out] buf the output buffer (owned by caller) of minimum len bytes. 62 @return the amount of data (in bytes) that was actually read. */ 63 ulint z_read(ReadContext *ctx, trx_t *trx, lob::ref_t ref, ulint offset, 64 ulint len, byte *buf); 65 66 #ifdef UNIV_DEBUG 67 /** Validate one zlib stream, given its index entry. 68 @param[in] index the index dictionary object. 69 @param[in] entry the index entry (memory copy). 70 @param[in] mtr mini-transaction. 71 @return true if validation passed. 72 @return does not return if validation failed.*/ 73 bool z_validate_strm(dict_index_t *index, z_index_entry_t &entry, mtr_t *mtr); 74 #endif /* UNIV_DEBUG */ 75 76 } /* namespace lob */ 77 78 #endif /* zlob0read_h */ 79