Krotos Modules 3
Loading...
Searching...
No Matches
krotos::FactoryAssetsWatcher Class Reference

Trigger processing of data when there is changes in the factory assets root directory. More...

#include <FactoryAssetsWatcher.h>

Inheritance diagram for krotos::FactoryAssetsWatcher:

Public Member Functions

 FactoryAssetsWatcher (const File &dirToWatch)
 
 ~FactoryAssetsWatcher () override
 
bool handleContentUpdate ()
 handles content update and triggers ttp embeddings calculation accordingly
 
void getAllFiles (const File &directory, Array< File > &fileArray)
 gets all files under a directory recursivelly
 

Private Member Functions

int useTimeSlice () override
 timeslice thread checks for modufication dir date and handles it accordingly

 
int64 getTotalFolderSize (const juce::File &folder)
 caclulates the folder size recursivelly
 
bool addFileToEmbeddings (const File &file)
 adds file(s) to embeddigs
 
bool removeFileFromEmbeddings (const File &file)
 removes file(s) from embeddigs
 
bool initEmbeddings (const File &file)
 inits embeddigs
 
void checkAddFileInEmbeddings ()
 check if there is available embeddings if not add it to an array that will be processed by TTP module
 

Private Attributes

TimeSliceThread thread {" Factory Assets Watcher Thread"}
 
String m_dirModificationDate
 
int64 m_dirSize {0}
 
bool m_assetsHaveBeenRemoved {false}
 
File m_directory
 
TextToAssetsShared m_textToAssetsSharedInstance
 
Array< File > m_filesArray
 
StringArray m_filesWithEmbeddings
 
Array< File > m_filesToProcess
 
CriticalSection m_cs
 
AssetsStatus m_assetsStatus {AssetsStatus::kAssetsInit}
 

Detailed Description

Trigger processing of data when there is changes in the factory assets root directory.

Constructor & Destructor Documentation

◆ FactoryAssetsWatcher()

krotos::FactoryAssetsWatcher::FactoryAssetsWatcher ( const File & dirToWatch)

Constructor.

◆ ~FactoryAssetsWatcher()

krotos::FactoryAssetsWatcher::~FactoryAssetsWatcher ( )
override

Destructor.

Member Function Documentation

◆ addFileToEmbeddings()

bool krotos::FactoryAssetsWatcher::addFileToEmbeddings ( const File & file)
private

adds file(s) to embeddigs

Parameters
theembeddings file
Returns
true on success

◆ checkAddFileInEmbeddings()

void krotos::FactoryAssetsWatcher::checkAddFileInEmbeddings ( )
private

check if there is available embeddings if not add it to an array that will be processed by TTP module

◆ getAllFiles()

void krotos::FactoryAssetsWatcher::getAllFiles ( const File & directory,
Array< File > & fileArray )

gets all files under a directory recursivelly

Parameters
rootdirectory
arraythat holds the files

◆ getTotalFolderSize()

int64 krotos::FactoryAssetsWatcher::getTotalFolderSize ( const juce::File & folder)
private

caclulates the folder size recursivelly

Parameters
folderthe folder path
Returns
the folder size in bytes

◆ handleContentUpdate()

bool krotos::FactoryAssetsWatcher::handleContentUpdate ( )

handles content update and triggers ttp embeddings calculation accordingly

Returns
Returns true if the operation was successful, false if it failed

◆ initEmbeddings()

bool krotos::FactoryAssetsWatcher::initEmbeddings ( const File & file)
private

inits embeddigs

Parameters
theembeddings file
Returns
true on success

◆ removeFileFromEmbeddings()

bool krotos::FactoryAssetsWatcher::removeFileFromEmbeddings ( const File & file)
private

removes file(s) from embeddigs

Parameters
theembeddings file
Returns
true on success

◆ useTimeSlice()

int krotos::FactoryAssetsWatcher::useTimeSlice ( )
overrideprivate

timeslice thread checks for modufication dir date and handles it accordingly

Member Data Documentation

◆ m_assetsHaveBeenRemoved

bool krotos::FactoryAssetsWatcher::m_assetsHaveBeenRemoved {false}
private

◆ m_assetsStatus

AssetsStatus krotos::FactoryAssetsWatcher::m_assetsStatus {AssetsStatus::kAssetsInit}
private

◆ m_cs

CriticalSection krotos::FactoryAssetsWatcher::m_cs
private

◆ m_directory

File krotos::FactoryAssetsWatcher::m_directory
private

◆ m_dirModificationDate

String krotos::FactoryAssetsWatcher::m_dirModificationDate
private

◆ m_dirSize

int64 krotos::FactoryAssetsWatcher::m_dirSize {0}
private

◆ m_filesArray

Array<File> krotos::FactoryAssetsWatcher::m_filesArray
private

◆ m_filesToProcess

Array<File> krotos::FactoryAssetsWatcher::m_filesToProcess
private

◆ m_filesWithEmbeddings

StringArray krotos::FactoryAssetsWatcher::m_filesWithEmbeddings
private

◆ m_textToAssetsSharedInstance

TextToAssetsShared krotos::FactoryAssetsWatcher::m_textToAssetsSharedInstance
private

◆ thread

TimeSliceThread krotos::FactoryAssetsWatcher::thread {" Factory Assets Watcher Thread"}
private

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