Turi Create  4.0
turi::sarray_format_reader_v2< T > Class Template Reference

#include <core/storage/sframe_data/sarray_file_format_v2.hpp>

Public Member Functions

 sarray_format_reader_v2 ()
 Default Constructor.
 
 ~sarray_format_reader_v2 ()
 
 sarray_format_reader_v2 (const sarray_format_reader_v2 &other)=delete
 deleted copy constructor
 
sarray_format_reader_v2operator= (const sarray_format_reader_v2 &other)=delete
 deleted assignment
 
void open (index_file_information index)
 
void open (std::string sidx_file)
 
void close ()
 
size_t num_segments () const
 
size_t segment_size (size_t segmentid) const
 
const index_file_informationget_index_info () const
 
std::string get_index_file () const
 
size_t read_rows (size_t row_start, size_t row_end, std::vector< T > &out_obj)
 

Detailed Description

template<typename T>
class turi::sarray_format_reader_v2< T >

This class implements the version 2 file format. See the sarray_v2_block_manager for format details.

Definition at line 44 of file sarray_file_format_v2.hpp.

Constructor & Destructor Documentation

◆ ~sarray_format_reader_v2()

template<typename T >
turi::sarray_format_reader_v2< T >::~sarray_format_reader_v2 ( )
inline

Destructor. Also closes the sarray if open.

Definition at line 54 of file sarray_file_format_v2.hpp.

Member Function Documentation

◆ close()

template<typename T >
void turi::sarray_format_reader_v2< T >::close ( )
inlinevirtual

Closes an sarray file set. No-op if the array is already closed.

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 118 of file sarray_file_format_v2.hpp.

◆ get_index_file()

template<typename T >
std::string turi::sarray_format_reader_v2< T >::get_index_file ( ) const
inlinevirtual

Returns the index_file of the array (the argument in open)

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 152 of file sarray_file_format_v2.hpp.

◆ get_index_info()

template<typename T >
const index_file_information& turi::sarray_format_reader_v2< T >::get_index_info ( ) const
inlinevirtual

Gets the contents of the index file information read from the index file

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 145 of file sarray_file_format_v2.hpp.

◆ num_segments()

template<typename T >
size_t turi::sarray_format_reader_v2< T >::num_segments ( ) const
inlinevirtual

Return the number of segments in the sarray

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 130 of file sarray_file_format_v2.hpp.

◆ open() [1/2]

template<typename T >
void turi::sarray_format_reader_v2< T >::open ( index_file_information  index)
inlinevirtual

Open has to be called before any of the other functions are called. Throws a string exception if it is unable to open the index file, or if there is a format error in the sarray index file.

Will throw an exception if a file set is already open.

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 72 of file sarray_file_format_v2.hpp.

◆ open() [2/2]

template<typename T >
void turi::sarray_format_reader_v2< T >::open ( std::string  sidx_file)
inlinevirtual

Opens a single sidx file

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 112 of file sarray_file_format_v2.hpp.

◆ read_rows()

template<typename T >
size_t turi::sarray_format_reader_v2< T >::read_rows ( size_t  row_start,
size_t  row_end,
std::vector< T > &  out_obj 
)
inlinevirtual

Reads a collection of rows, storing the result in out_obj. This function is independent of the open_segment/read_segment/close_segment functions, and can be called anytime. This function is also fully concurrent.

Parameters
row_startFirst row to read
row_endone past the last row to read (i.e. EXCLUSIVE). row_end can be beyond the end of the array, in which case, fewer rows will be read.
out_objThe output array
Returns
Actual number of rows read. Return (size_t)(-1) on failure.
Note
This function is currently only optimized for "mostly" sequential reads. i.e. we are expecting read_rows(a, b), to be soon followed by read_rows(b,c), etc.

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 176 of file sarray_file_format_v2.hpp.

◆ segment_size()

template<typename T >
size_t turi::sarray_format_reader_v2< T >::segment_size ( size_t  segmentid) const
inlinevirtual

Returns the number of elements in a given segment.

Implements turi::sarray_format_reader_common_base< T >.

Definition at line 137 of file sarray_file_format_v2.hpp.


The documentation for this class was generated from the following file: