Turi Create  4.0
turi::sarray_format_reader_common_base< T > Class Template Referenceabstract

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

Public Member Functions

virtual void open (index_file_information index)=0
 
virtual void open (std::string sidx_file)=0
 
virtual void close ()=0
 
virtual size_t num_segments () const =0
 
virtual size_t segment_size (size_t segmentsid) const =0
 
virtual size_t read_rows (size_t row_start, size_t row_end, std::vector< T > &out_obj)=0
 
virtual std::string get_index_file () const =0
 
virtual const index_file_informationget_index_info () const =0
 

Detailed Description

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

A generic sarray file format reader interface. File format implementations should extend this.

The sarray file layout should generally be a file set (collection of files) with a common prefix. File format implementations can create or use as many prefixes as required. There must be an [prefix].sidx in the the Microsoft INI format with the following sections

* [sarray]
* ; The version of the file format. Required.
* version=0
* 

Definition at line 46 of file sarray_file_format_interface.hpp.

Member Function Documentation

◆ close()

template<typename T>
virtual void turi::sarray_format_reader_common_base< T >::close ( )
pure virtual

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

Implemented in turi::sarray_format_reader_v2< T >.

◆ get_index_file()

template<typename T>
virtual std::string turi::sarray_format_reader_common_base< T >::get_index_file ( ) const
pure virtual

Returns the file index of the array (the argument in open)

Implemented in turi::sarray_format_reader_v2< T >.

◆ get_index_info()

template<typename T>
virtual const index_file_information& turi::sarray_format_reader_common_base< T >::get_index_info ( ) const
pure virtual

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

Implemented in turi::sarray_format_reader_v2< T >.

◆ num_segments()

template<typename T>
virtual size_t turi::sarray_format_reader_common_base< T >::num_segments ( ) const
pure virtual

Return the number of segments in the sarray. Throws an exception if the array is not open.

Implemented in turi::sarray_format_reader_v2< T >.

◆ open() [1/2]

template<typename T>
virtual void turi::sarray_format_reader_common_base< T >::open ( index_file_information  index)
pure virtual

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

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

Implemented in turi::sarray_format_reader_v2< T >.

◆ open() [2/2]

template<typename T>
virtual void turi::sarray_format_reader_common_base< T >::open ( std::string  sidx_file)
pure virtual

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

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

Implemented in turi::sarray_format_reader_v2< T >.

◆ read_rows()

template<typename T>
virtual size_t turi::sarray_format_reader_common_base< T >::read_rows ( size_t  row_start,
size_t  row_end,
std::vector< T > &  out_obj 
)
pure virtual

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.

Implemented in turi::sarray_format_reader_v2< T >.

◆ segment_size()

template<typename T>
virtual size_t turi::sarray_format_reader_common_base< T >::segment_size ( size_t  segmentsid) const
pure virtual

Returns the number of elements in a given segment. should throw an exception if the segment ID does not exist,

Implemented in turi::sarray_format_reader_v2< T >.


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