Turi Create  4.0
sframe_saving_impl.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_SFRAME_SAVING_IMPL_HPP
7 #define TURI_SFRAME_SAVING_IMPL_HPP
8 #include <core/storage/sframe_data/sarray_v2_block_types.hpp>
9 namespace turi {
10 
11 
12 
13 /**
14  * \internal
15  * \ingroup sframe_physical
16  * \addtogroup sframe_internal SFrame Internal
17  * \{
18  */
19 
20 /**
21  * SFrame Saving Implementation Detail
22  */
23 namespace sframe_saving_impl {
24 /**
25  * Represents the writing state of a single column; which
26  * segment, and which block within the segment it is at.
27  */
28 struct column_blocks {
29  // index for this column
30  index_file_information column_index;
31  // column number this gets written into
32  size_t column_number = 0;
33 
34  // total number of segments in this column
35  size_t num_segments = 0;
36  // total number of columns in the current segment
37  size_t num_blocks_in_current_segment = 0;
38 
39  size_t current_segment_number = 0;
40  size_t current_block_number = 0;
41 
42  // reference to the opened segment
43  v2_block_impl::column_address segment_address;
44 
45  // the next row number to be read
46  size_t next_row = 0;
47 
48  bool eof = false;
49 };
50 
51 /**
52  * Advances the column block to the next block.
53  */
55  v2_block_impl::block_manager& block_manager,
56  column_blocks& block);
57 } // sframe_saving_impl
58 } // turicreate
59 #endif
std::tuple< size_t, size_t > column_address
void advance_column_blocks_to_next_block(v2_block_impl::block_manager &block_manager, column_blocks &block)