Turi Create
4.0
|
#include <core/storage/fileio/fixed_size_cache_manager.hpp>
Public Member Functions | |
bool | extend_capacity (size_t new_capacity) |
bool | is_pointer () const |
bool | is_file () const |
char * | get_pointer () const |
const size_t | get_pointer_capacity () const |
const size_t | get_pointer_size () const |
const std::string & | get_filename () const |
bool | write_bytes_to_memory_cache (const char *c, std::streamsize bufsize) |
std::shared_ptr< fileio_impl::general_fstream_sink > | write_to_file () |
~cache_block () | |
A struct that contains either an array buffer or a file resource. This struct cannot be created by anything else other than the fixed_size_cache_manager.
This struct is not generally thread safe.
Definition at line 34 of file fixed_size_cache_manager.hpp.
turi::fileio::cache_block::~cache_block | ( | ) |
Destructor. Clears all the memory in the cache block.
bool turi::fileio::cache_block::extend_capacity | ( | size_t | new_capacity | ) |
If this points to an in-memory cache, attempts to extend the in-memory cache have capacity at least new_capacity. Returns true on success, false on failure. If false, this means that the cache block size has reached the maximum capacity permitted.
|
inline |
Returns the disk backed filename.
Definition at line 82 of file fixed_size_cache_manager.hpp.
|
inline |
Returns the pointer to the in memory cache.
Definition at line 67 of file fixed_size_cache_manager.hpp.
|
inline |
Returns the total capacity of the in memory cache
Definition at line 72 of file fixed_size_cache_manager.hpp.
|
inline |
Returns the used capacity of the in memory cache
Definition at line 77 of file fixed_size_cache_manager.hpp.
|
inline |
Returns true if this points to a file
Definition at line 62 of file fixed_size_cache_manager.hpp.
|
inline |
Returns true if this points to an in memory cache.
Definition at line 57 of file fixed_size_cache_manager.hpp.
|
inline |
If this is an in memory cache, writes bufsize bytes to it. Returns true on success, false on failure.
Definition at line 88 of file fixed_size_cache_manager.hpp.
std::shared_ptr<fileio_impl::general_fstream_sink> turi::fileio::cache_block::write_to_file | ( | ) |
If this cache block is an in memory cache, dumps it to a file returning the output file handle. Fails if the cache block is not an in memory cache. Thread safe.