libfoedus-core
FOEDUS Core Library
masstree_reserve_impl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
18 #ifndef FOEDUS_STORAGE_MASSTREE_MASSTREE_RESERVE_IMPL_HPP_
19 #define FOEDUS_STORAGE_MASSTREE_MASSTREE_RESERVE_IMPL_HPP_
20 
21 #include "foedus/error_code.hpp"
24 #include "foedus/thread/fwd.hpp"
26 
27 namespace foedus {
28 namespace storage {
29 namespace masstree {
30 
57 struct ReserveRecords final : public xct::SysxctFunctor {
65  const void* const suffix_;
79 
90 
92  thread::Thread* context,
93  MasstreeBorderPage* target,
94  KeySlice slice,
95  KeyLength remainder_length,
96  const void* suffix,
97  PayloadLength payload_count,
98  bool should_aggresively_create_next_layer,
99  SlotIndex hint_check_from)
100  : xct::SysxctFunctor(),
101  context_(context),
102  target_(target),
103  slice_(slice),
104  suffix_(suffix),
105  remainder_length_(remainder_length),
106  payload_count_(payload_count),
107  hint_check_from_(hint_check_from),
108  should_aggresively_create_next_layer_(should_aggresively_create_next_layer),
109  out_split_needed_(false) {
110  }
111  virtual ErrorCode run(xct::SysxctWorkspace* sysxct_workspace) override;
112 };
113 
114 } // namespace masstree
115 } // namespace storage
116 } // namespace foedus
117 #endif // FOEDUS_STORAGE_MASSTREE_MASSTREE_RESERVE_IMPL_HPP_
MasstreeBorderPage *const target_
The page to install a new physical record.
const KeySlice slice_
The slice of the key.
uint16_t PayloadLength
Represents a byte-length of a payload in this package.
Definition: masstree_id.hpp:92
uint16_t SlotIndex
Index of a record in a (border) page.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Represents one thread running on one NUMA core.
Definition: thread.hpp:48
A system transaction to reserve a physical record(s) in a border page.
Represents one border page in Masstree Storage.
const PayloadLength payload_count_
Minimal required length of the payload.
uint64_t KeySlice
Each key slice is an 8-byte integer.
thread::Thread *const context_
Thread context.
Definitions of IDs in this package and a few related constant values.
uint16_t KeyLength
Represents a byte-length of a key in this package.
Definition: masstree_id.hpp:69
A functor representing the logic in a system transaction via virtual-function.
virtual ErrorCode run(xct::SysxctWorkspace *sysxct_workspace) override
Execute the system transaction.
const void *const suffix_
Suffix of the key.
const bool should_aggresively_create_next_layer_
When we CAN create a next layer for the new record, whether to make it a next-layer from the beginnin...
const KeyLength remainder_length_
Length of the remainder.
const SlotIndex hint_check_from_
The in-page location from which this sysxct will look for matching records.
Forward declarations of classes in masstree storage package.
Forward declarations of classes in thread package.
ErrorCode
Enum of error codes defined in error_code.xmacro.
Definition: error_code.hpp:85
Per-thread reused work memory for system transactions.
ReserveRecords(thread::Thread *context, MasstreeBorderPage *target, KeySlice slice, KeyLength remainder_length, const void *suffix, PayloadLength payload_count, bool should_aggresively_create_next_layer, SlotIndex hint_check_from)