Turi Create  4.0
turi::fileio_impl::cache_stream_source Class Reference

#include <core/storage/fileio/cache_stream_source.hpp>

Public Member Functions

 cache_stream_source (cache_id_type cache_id)
 
std::streamsize read (char *c, std::streamsize bufsize)
 
void close ()
 
bool is_open () const
 
std::streampos seek (std::streamoff off, std::ios_base::seekdir way)
 
size_t file_size () const
 
std::shared_ptr< std::istream > get_underlying_stream ()
 

Detailed Description

A boost::iostreams::input_seekable concept implemented using cache_block as the underlying source device.

Definition at line 23 of file cache_stream_source.hpp.

Constructor & Destructor Documentation

◆ cache_stream_source()

turi::fileio_impl::cache_stream_source::cache_stream_source ( cache_id_type  cache_id)
explicit

Construct the source from a cache_id.

Intialize the underlying datasources, either the in memory array or the on disk cache file.

Member Function Documentation

◆ close()

void turi::fileio_impl::cache_stream_source::close ( )

Closes all file handles.

◆ file_size()

size_t turi::fileio_impl::cache_stream_source::file_size ( ) const

Returns the file size of the opened file. Returns (size_t)(-1) if there is no file opened, or if there is an error obtaining the file size.

◆ get_underlying_stream()

std::shared_ptr<std::istream> turi::fileio_impl::cache_stream_source::get_underlying_stream ( )

Returns the underlying stream object. The underlying stream object is an boost array_source if the cache is in memory, and is a some other stream object otherwise.

◆ is_open()

bool turi::fileio_impl::cache_stream_source::is_open ( ) const

Returns true if the stream is opened.

◆ read()

std::streamsize turi::fileio_impl::cache_stream_source::read ( char *  c,
std::streamsize  bufsize 
)

Attempts to read bufsize bytes into the buffer provided. Returns the actual number of bytes read.

◆ seek()

std::streampos turi::fileio_impl::cache_stream_source::seek ( std::streamoff  off,
std::ios_base::seekdir  way 
)

Seeks to a different location. Will fail on compressed files.


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