Debian Codegraph @

storage/innobase/include/zlob0read.h

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