Debian Codegraph @

unittest/gunit/innodb/lob/lot0lob.h

raw symbols SCIP
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 _lot0lob_h_
28 #define _lot0lob_h_
29
30 #include <string.h>
31
32 #include "db0err.h"
33 #include "fil0types.h"
34 #include "fut0fut.h"
35 #include "fut0lst.h"
36 #include "lob0int.h"
37 #include "trx0types.h"
38
39 namespace lob {
40
41 struct ref_t {
42 lobid_t m_id;
43 bool operator<(const ref_t &that) const { return (m_id < that.m_id); }
44 std::ostream &print(std::ostream &out) const {
45 out << "[ref_t: m_id=" << m_id << "]";
46 return (out);
47 }
48 };
49
50 inline std::ostream &operator<<(std::ostream &out, const ref_t &obj) {
51 return (obj.print(out));
52 }
53
54 /** Insert a large object (LOB) into the system.
55 @param[in,out] ref the LOB reference.
56 @param[in] blob the large object.
57 @param[in] len the length of the large object.*/
58 dberr_t insert(trx_id_t trxid, ref_t ref, byte *blob, ulint len);
59
60 /** Insert a large object (LOB) into the system.
61 @param[in,out] ref the LOB reference.
62 @param[in] blob the large object.
63 @param[in] len the length of the large object.*/
64 dberr_t z_insert(trx_id_t trxid, ref_t ref, byte *blob, ulint len);
65
66 /** Fetch a large object (LOB) from the system.
67 @param[in] trxid the transaction that is doing the read.
68 @param[in] ref the LOB reference identifying the LOB.
69 @param[in] offset read the LOB from the given offset.
70 @param[in] len the length of LOB data that needs to be fetched.
71 @param[out] buf the output buffer (owned by caller) of minimum len bytes.
72 @return the amount of data (in bytes) that was actually read. */
73 ulint read(trx_id_t trxid, ref_t ref, ulint offset, ulint len, byte *buf);
74
75 /** Replace a large object (LOB) with the given new data.
76 @param[in] trxid the transaction that is doing the read.
77 @param[in] ref the LOB reference identifying the LOB.
78 @param[in] offset replace the LOB from the given offset.
79 @param[in] len the length of LOB data that needs to be replaced.
80 @param[in] buf the buffer (owned by caller) with new data (len bytes).*/
81 dberr_t replace(trx_id_t trxid, ref_t ref, ulint offset, ulint len, byte *buf);
82
83 /** Insert data into the middle of an LOB */
84 ulint insert_middle(trx_id_t trxid, ref_t ref, ulint offset, byte *&data,
85 ulint &len);
86
87 /** Delete a portion of the given large object (LOB)
88 @param[in] trxid the transaction that is doing the read.
89 @param[in] ref the LOB reference identifying the LOB.
90 @param[in] offset remove the LOB from the given offset.
91 @param[in] len the length of LOB data that needs to be removed. */
92 dberr_t remove_middle(trx_id_t trxid, ref_t ref, ulint offset, ulint len);
93
94 /** Remove/Delete/Destory the given LOB.
95 @param[in] trxid The transaction identifier.
96 @param[in] ref The LOB reference.*/
97 void remove(trx_id_t trxid, ref_t ref);
98
99 void trx_purge(trx_id_t trxid, ref_t ref);
100
101 void print(std::ostream &out, ref_t ref);
102
103 inline void trx_rollback(trx_id_t trxid, ref_t ref) { trx_purge(trxid, ref); }
104
105 } // namespace lob
106
107 #endif // _lot0lob_h_