6 #ifndef TURI_SFRAME_SARRAY_V2_BLOCK_MANAGER_HPP 7 #define TURI_SFRAME_SARRAY_V2_BLOCK_MANAGER_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> 23 int LZ4_decompress_safe (
const char* source,
char* dest,
int inputSize,
int maxOutputSize);
38 namespace v2_block_impl {
208 std::shared_ptr<std::vector<char> >
220 std::vector<flexible_type>& ret,
234 std::vector<std::vector<flexible_type> >& ret,
235 std::vector<block_info>* ret_info = NULL);
246 template <
typename T>
250 bool success =
false;
272 std::string segment_file;
274 size_t file_size = 0;
276 size_t io_parallelism_id = 0;
280 std::weak_ptr<general_ifstream> segment_file_handle;
289 std::vector<std::vector<block_info> > blocks;
291 turi::atomic<size_t> reference_count;
295 size_t segment_id_counter = 0;
296 std::map<size_t, std::shared_ptr<segment> > m_segments;
297 std::map<std::string, size_t> m_file_to_segments;
302 std::deque<std::weak_ptr<general_ifstream> > m_file_handle_pool;
314 std::shared_ptr<general_ifstream> get_new_file_handle(std::string file);
323 std::shared_ptr<general_ifstream>
324 get_segment_file_handle(std::shared_ptr<segment>&
group);
334 std::shared_ptr<segment> get_segment(
size_t segmentid);
336 void init_segment(std::shared_ptr<segment>& seg);
void release_buffer(std::shared_ptr< T > &&buffer)
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
std::tuple< size_t, size_t, size_t > block_address
std::tuple< size_t, size_t > column_address
bool read_typed_block(block_address addr, std::vector< flexible_type > &ret, block_info **ret_info=NULL)
sframe group(sframe sframe_in, std::string key_column)
static block_manager & get_instance()
Get singleton instance.
column_address open_column(std::string column_file)
const std::vector< std::vector< block_info > > & get_all_block_info(size_t segment_id)
size_t num_blocks_in_column(column_address addr)
bool read_block(block_address addr, std::vector< T > &ret, block_info **ret_info=NULL)
std::shared_ptr< std::vector< char > > read_block(block_address addr, block_info **ret_info=NULL)
block_manager()
default constructor.
bool read_typed_blocks(block_address addr, size_t nblocks, std::vector< std::vector< flexible_type > > &ret, std::vector< block_info > *ret_info=NULL)
const block_info & get_block_info(block_address addr)
void close_column(column_address addr)