CUBRID Engine  latest
transaction_transient.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef _TRANSACTION_TRANSIENT_HPP_
20 #define _TRANSACTION_TRANSIENT_HPP_
21 
22 #include "lob_locator.hpp"
23 #include "dbtype_def.h"
24 #include "log_lsa.hpp"
25 #include "storage_common.h"
26 
27 #include <forward_list>
28 #include <functional>
29 
30 // todo - namespace cubtx
31 
32 // forward declarations
33 struct log_tdes;
34 namespace cubthread
35 {
36  class entry;
37 }
38 
39 //
40 // Modified classes
41 //
42 
44 {
47  std::string m_class_name;
48 
49  tx_transient_class_entry () = default;
50  tx_transient_class_entry (const char *class_name, const OID &class_oid, const LOG_LSA &lsa);
51 
52  const char *get_classname () const;
53 };
54 
56 {
57  private:
58  using list_type = std::forward_list<tx_transient_class_entry>;
60 
61  public:
62  using map_func_type = std::function<void (const tx_transient_class_entry &, bool &)>;
63 
64  tx_transient_class_registry () = default;
65  ~tx_transient_class_registry () = default;
66 
67  // inspection functions
68  bool empty () const;
69  bool has_class (const OID &class_oid) const;
70 
71  // map all entries
72  void map (const map_func_type &func) const;
73 
74  // utility functions
75  char *to_string () const; // private allocated
76 
77  // manipulation functions
78  void add (const char *classname, const OID &class_oid, const LOG_LSA &lsa);
79  void decache_heap_repr (const LOG_LSA &downto_lsa);
80  void clear ();
81 };
82 
83 //
84 // Lobs
85 //
86 
87 // forward declarations
88 struct lob_locator_entry;
89 
90 // matches RB_HEAD of rb_tree.h
92 {
94 
95  void init ();
96 };
97 
98 LOB_LOCATOR_STATE xtx_find_lob_locator (cubthread::entry *thread_p, const char *locator, char *real_locator);
99 int xtx_add_lob_locator (cubthread::entry *thread_p, const char *locator, LOB_LOCATOR_STATE state);
100 int xtx_change_state_of_locator (cubthread::entry *thread_p, const char *locator, const char *new_locator,
101  LOB_LOCATOR_STATE state);
102 int xtx_drop_lob_locator (cubthread::entry *thread_p, const char *locator);
103 void tx_lob_locator_clear (cubthread::entry *thread_p, log_tdes *tdes, bool at_commit, LOG_LSA *savept_lsa);
104 
105 #endif // !_TRANSACTION_TRANSIENT_HPP_
std::string m_class_name
lob_locator_entry * rbh_root
std::function< void(const tx_transient_class_entry &, bool &)> map_func_type
void tx_lob_locator_clear(cubthread::entry *thread_p, log_tdes *tdes, bool at_commit, LOG_LSA *savept_lsa)
std::forward_list< tx_transient_class_entry > list_type
OID m_class_oid
int xtx_change_state_of_locator(cubthread::entry *thread_p, const char *locator, const char *new_locator, LOB_LOCATOR_STATE state)
LOB_LOCATOR_STATE xtx_find_lob_locator(cubthread::entry *thread_p, const char *locator, char *real_locator)
int xtx_drop_lob_locator(cubthread::entry *thread_p, const char *locator)
enum lob_locator_state LOB_LOCATOR_STATE
Definition: lob_locator.hpp:62
LOG_LSA m_last_modified_lsa
int xtx_add_lob_locator(cubthread::entry *thread_p, const char *locator, LOB_LOCATOR_STATE state)
void clear(cub_regex_object *&regex, char *&pattern)