6 #ifndef TURI_SFRAME_SARRAY_V2_BLOCK_WRITER_HPP 7 #define TURI_SFRAME_SARRAY_V2_BLOCK_WRITER_HPP 12 #include <core/parallel/pthread_tools.hpp> 13 #include <core/parallel/atomic.hpp> 14 #include <core/storage/fileio/general_fstream.hpp> 15 #include <core/storage/sframe_data/sarray_index_file.hpp> 16 #include <core/data/flexible_type/flexible_type.hpp> 17 #include <core/util/buffer_pool.hpp> 18 #include <core/storage/sframe_data/sarray_v2_block_types.hpp> 33 namespace v2_block_impl {
66 void init(std::string group_index_file,
74 std::string filename);
80 void set_options(
const std::string& option, int64_t value);
110 const std::vector<flexible_type>& data,
117 template <
typename T>
120 const std::vector<T>& data,
123 oarchive oarc(*serialization_buffer);
126 block.num_elem = data.size();
127 size_t ret =
write_block(segment_id, column_id, serialization_buffer->data(), block);
151 std::vector<std::shared_ptr<general_ofstream> > m_output_files;
153 std::vector<turi::mutex> m_output_file_locks;
155 std::vector<size_t> m_output_bytes_written;
166 std::vector<std::vector<std::vector<block_info> > > m_blocks;
169 std::vector<std::vector<size_t> > m_column_row_counter;
172 void emit_footer(
size_t segment_id);
175 bool m_disable_padding =
false;
void release_buffer(std::shared_ptr< T > &&buffer)
group_index_file_information & get_index_info()
size_t write_typed_block(size_t segment_id, size_t column_id, const std::vector< flexible_type > &data, block_info block)
void set_options(const std::string &option, int64_t value)
size_t write_block(size_t segment_id, size_t column_id, const std::vector< T > &data, block_info block)
uint64_t block_size
The length of the block in bytes on disk.
std::shared_ptr< T > get_new_buffer()
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
size_t write_block(size_t segment_id, size_t column_id, char *data, block_info block)
void init(std::string group_index_file, size_t num_segments, size_t num_columns)
void open_segment(size_t segment_id, std::string filename)
void close_segment(size_t segment_id)