Logo
ApraPipes 1.0
Loading...
Searching...
No Matches
OrderedCacheOfFiles Class Reference

#include <OrderedCacheOfFiles.h>

Collaboration diagram for OrderedCacheOfFiles:
Collaboration graph

Classes

struct  CacheIteratorState
 
struct  Video
 
struct  videoPath
 
struct  videoTS
 

Public Member Functions

 OrderedCacheOfFiles (std::string &video_folder, uint32_t initial_batch_size=1440, uint32_t _lowerWaterMark=1441, uint32_t _upperWaterMark=2880)
 
 ~OrderedCacheOfFiles ()
 
void updateBatchSize (uint32_t _batchSize)
 
void cleanCacheOnSeperateThread (bool flag)
 
void deleteLostEntry (std::string &filePath)
 
uint64_t getFileDuration (std::string &filename)
 
std::string getFileAt (uint64_t timestamp, bool direction)
 
bool isTimeStampInFile (std::string &filename, uint64_t timestamp)
 
std::string getNextFileAfter (std::string &currentFile, bool direction)
 
std::vector< boost::filesystem::path > parseAndSortDateDir (const std::string &rootDir)
 
std::vector< boost::filesystem::path > parseAndSortHourDir (const std::string &rootDir)
 
std::vector< boost::filesystem::path > parseAndSortMp4Files (const std::string &rootDir)
 
bool parseFiles (uint64_t start_ts, bool direction, bool includeFloorFile=false, bool disableBatchSizeCheck=false, uint64_t skipTS=0)
 
bool getRandomSeekFile (uint64_t ts, bool direction, uint64_t &skipMsecs, std::string &fileName)
 
bool getFileFromCache (uint64_t timestamp, bool direction, std::string &fileName)
 
size_t getCacheSize ()
 
bool fetchAndUpdateFromDisk (std::string videoFile, uint64_t &start_ts, uint64_t &end_ts)
 
bool fetchFromCache (std::string &videoFile, uint64_t &start_ts, uint64_t &end_ts)
 
void readVideoStartEnd (std::string &filePath, uint64_t &start_ts, uint64_t &end_ts)
 
void clearCache ()
 
bool refreshCache ()
 
std::string getLastVideoInCache ()
 
void updateCache (std::string &filePath, uint64_t &start_ts, uint64_t &end_ts)
 
std::map< std::string, std::pair< uint64_t, uint64_t > > getSnapShot ()
 
bool probe (boost::filesystem::path dirPath, std::string &videoName)
 
bool getPreviousAndNextFile (std::string videoPath, std::string &previousFile, std::string &nextFile)
 

Private Types

typedef boost::multi_index_container< Video, bmi::indexed_by< bmi::ordered_unique< bmi::tag< videoPath >, bmi::member< Video, std::string, &Video::path > >, bmi::ordered_non_unique< bmi::tag< videoTS >, bmi::member< Video, uint64_t, &Video::start_ts > > > > VideoCache
 

Private Member Functions

bool filePatternCheck (const fs::path &path)
 
bool datePatternCheck (const boost::filesystem::path &path)
 
bool hourPatternCheck (const boost::filesystem::path &path)
 
void insertInVideoCache (Video vid)
 
void retireOldFiles (uint64_t startTSofRelevantFile)
 
void dropFarthestFromTS (uint64_t startTS)
 

Private Attributes

bool lastKnownPlaybackDir = true
 
boost::mutex m_mutex
 
boost::shared_ptr< boost::thread > mThread = nullptr
 
int cacheSize = 1440
 
int batchSize = 1440
 
std::string rootDir = ""
 
uint32_t lowerWaterMark
 
uint32_t upperWaterMark
 
bool cleanCacheOnMainThread = true
 
struct OrderedCacheOfFiles::CacheIteratorState cacheIteratorState
 
VideoCache videoCache
 
VideoCache::index< videoTS >::type & videoCacheStartTSIndex = videoCache.get<videoTS>()
 

Member Typedef Documentation

◆ VideoCache

boost::multi_index_container< Video, bmi::indexed_by< bmi::ordered_unique<bmi::tag<videoPath>, bmi::member<Video, std::string, &Video::path> >, bmi::ordered_non_unique<bmi::tag<videoTS>, bmi::member<Video, uint64_t, &Video::start_ts> > > > OrderedCacheOfFiles::VideoCache
private

Constructor & Destructor Documentation

◆ OrderedCacheOfFiles()

OrderedCacheOfFiles::OrderedCacheOfFiles ( std::string & video_folder,
uint32_t initial_batch_size = 1440,
uint32_t _lowerWaterMark = 1441,
uint32_t _upperWaterMark = 2880 )

◆ ~OrderedCacheOfFiles()

OrderedCacheOfFiles::~OrderedCacheOfFiles ( )
inline

Member Function Documentation

◆ cleanCacheOnSeperateThread()

void OrderedCacheOfFiles::cleanCacheOnSeperateThread ( bool flag)
inline

◆ clearCache()

void OrderedCacheOfFiles::clearCache ( )

◆ datePatternCheck()

bool OrderedCacheOfFiles::datePatternCheck ( const boost::filesystem::path & path)
private
Here is the caller graph for this function:

◆ deleteLostEntry()

void OrderedCacheOfFiles::deleteLostEntry ( std::string & filePath)

◆ dropFarthestFromTS()

void OrderedCacheOfFiles::dropFarthestFromTS ( uint64_t startTS)
private
Here is the caller graph for this function:

◆ fetchAndUpdateFromDisk()

bool OrderedCacheOfFiles::fetchAndUpdateFromDisk ( std::string videoFile,
uint64_t & start_ts,
uint64_t & end_ts )
Here is the call graph for this function:

◆ fetchFromCache()

bool OrderedCacheOfFiles::fetchFromCache ( std::string & videoFile,
uint64_t & start_ts,
uint64_t & end_ts )

◆ filePatternCheck()

bool OrderedCacheOfFiles::filePatternCheck ( const fs::path & path)
private
Here is the caller graph for this function:

◆ getCacheSize()

size_t OrderedCacheOfFiles::getCacheSize ( )
inline

◆ getFileAt()

std::string OrderedCacheOfFiles::getFileAt ( uint64_t timestamp,
bool direction )
Here is the caller graph for this function:

◆ getFileDuration()

uint64_t OrderedCacheOfFiles::getFileDuration ( std::string & filename)

◆ getFileFromCache()

bool OrderedCacheOfFiles::getFileFromCache ( uint64_t timestamp,
bool direction,
std::string & fileName )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLastVideoInCache()

std::string OrderedCacheOfFiles::getLastVideoInCache ( )
inline

◆ getNextFileAfter()

std::string OrderedCacheOfFiles::getNextFileAfter ( std::string & currentFile,
bool direction )
Here is the caller graph for this function:

◆ getPreviousAndNextFile()

bool OrderedCacheOfFiles::getPreviousAndNextFile ( std::string videoPath,
std::string & previousFile,
std::string & nextFile )

◆ getRandomSeekFile()

bool OrderedCacheOfFiles::getRandomSeekFile ( uint64_t ts,
bool direction,
uint64_t & skipMsecs,
std::string & fileName )
Here is the call graph for this function:

◆ getSnapShot()

std::map< std::string, std::pair< uint64_t, uint64_t > > OrderedCacheOfFiles::getSnapShot ( )

◆ hourPatternCheck()

bool OrderedCacheOfFiles::hourPatternCheck ( const boost::filesystem::path & path)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertInVideoCache()

void OrderedCacheOfFiles::insertInVideoCache ( Video vid)
private
Here is the caller graph for this function:

◆ isTimeStampInFile()

bool OrderedCacheOfFiles::isTimeStampInFile ( std::string & filename,
uint64_t timestamp )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseAndSortDateDir()

std::vector< boost::filesystem::path > OrderedCacheOfFiles::parseAndSortDateDir ( const std::string & rootDir)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseAndSortHourDir()

std::vector< boost::filesystem::path > OrderedCacheOfFiles::parseAndSortHourDir ( const std::string & rootDir)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseAndSortMp4Files()

std::vector< boost::filesystem::path > OrderedCacheOfFiles::parseAndSortMp4Files ( const std::string & rootDir)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseFiles()

bool OrderedCacheOfFiles::parseFiles ( uint64_t start_ts,
bool direction,
bool includeFloorFile = false,
bool disableBatchSizeCheck = false,
uint64_t skipTS = 0 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ probe()

bool OrderedCacheOfFiles::probe ( boost::filesystem::path dirPath,
std::string & videoName )
Here is the call graph for this function:

◆ readVideoStartEnd()

void OrderedCacheOfFiles::readVideoStartEnd ( std::string & filePath,
uint64_t & start_ts,
uint64_t & end_ts )
Here is the caller graph for this function:

◆ refreshCache()

bool OrderedCacheOfFiles::refreshCache ( )
Here is the call graph for this function:

◆ retireOldFiles()

void OrderedCacheOfFiles::retireOldFiles ( uint64_t startTSofRelevantFile)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBatchSize()

void OrderedCacheOfFiles::updateBatchSize ( uint32_t _batchSize)
inline

◆ updateCache()

void OrderedCacheOfFiles::updateCache ( std::string & filePath,
uint64_t & start_ts,
uint64_t & end_ts )
Here is the caller graph for this function:

Member Data Documentation

◆ batchSize

int OrderedCacheOfFiles::batchSize = 1440
private

◆ cacheIteratorState

struct OrderedCacheOfFiles::CacheIteratorState OrderedCacheOfFiles::cacheIteratorState
private

◆ cacheSize

int OrderedCacheOfFiles::cacheSize = 1440
private

◆ cleanCacheOnMainThread

bool OrderedCacheOfFiles::cleanCacheOnMainThread = true
private

◆ lastKnownPlaybackDir

bool OrderedCacheOfFiles::lastKnownPlaybackDir = true
private

◆ lowerWaterMark

uint32_t OrderedCacheOfFiles::lowerWaterMark
private

◆ m_mutex

boost::mutex OrderedCacheOfFiles::m_mutex
private

◆ mThread

boost::shared_ptr<boost::thread> OrderedCacheOfFiles::mThread = nullptr
private

◆ rootDir

std::string OrderedCacheOfFiles::rootDir = ""
private

◆ upperWaterMark

uint32_t OrderedCacheOfFiles::upperWaterMark
private

◆ videoCache

VideoCache OrderedCacheOfFiles::videoCache
private

◆ videoCacheStartTSIndex

VideoCache::index<videoTS>::type& OrderedCacheOfFiles::videoCacheStartTSIndex = videoCache.get<videoTS>()
private

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