A DiskBuffer that reads and decodes text files.
More...
#include <DiskBufferText.hpp>
|
const int | mSize |
|
std::function< void(al::Socket *src)> | modified = [](al::Socket * ) {} |
|
A DiskBuffer that reads and decodes text files.
Definition at line 53 of file DiskBufferText.hpp.
◆ DiskBufferText()
tinc::DiskBufferText::DiskBufferText |
( |
std::string |
id, |
|
|
std::string |
fileName = "" , |
|
|
std::string |
relPath = "" , |
|
|
std::string |
rootPath = "" , |
|
|
uint16_t |
size = 2 |
|
) |
| |
|
inline |
◆ cleanupRoundRobinFiles()
void tinc::DiskBufferAbstract::cleanupRoundRobinFiles |
( |
| ) |
|
|
inlineinherited |
◆ doneWriting()
template<class DataType >
Mark a buffer as ready to read.
- Parameters
-
The buffer provided must come from getWritable() otherwise behavior is undefined.
Definition at line 114 of file BufferManager.hpp.
◆ enableRoundRobin()
void tinc::DiskBufferAbstract::enableRoundRobin |
( |
int |
cacheSize = 0 , |
|
|
bool |
clearLocks = true |
|
) |
| |
|
inlineinherited |
◆ encodeData()
bool tinc::DiskBufferText::encodeData |
( |
std::string |
fileName, |
|
|
std::string & |
newData |
|
) |
| |
|
inlineoverrideprotectedvirtual |
◆ get() [1/2]
template<class DataType >
Get current buffer for reading checking if data is new.
- Parameters
-
isNew | this is set to true if data returned is "new", false otherwise |
- Returns
Definition at line 76 of file BufferManager.hpp.
◆ get() [2/2]
template<class DataType >
Get current buffer for reading.
- Parameters
-
markAsUsed | if false, the returned buffer keeps its "new" status |
- Returns
- a pointer to the data
Definition at line 63 of file BufferManager.hpp.
◆ getBaseFileName()
std::string tinc::DiskBufferAbstract::getBaseFileName |
( |
| ) |
|
|
inlineinherited |
◆ getCurrentFileName()
std::string tinc::DiskBufferAbstract::getCurrentFileName |
( |
| ) |
|
|
inlineinherited |
getCurrentFileName
- Returns
This function is not thread safe. Needs to be called synchronously to any process functions
Definition at line 60 of file DiskBufferAbstract.hpp.
◆ getDocumentation()
std::string tinc::IdObject::getDocumentation |
( |
| ) |
const |
|
inherited |
◆ getFilenameForWriting()
std::string tinc::DiskBufferAbstract::getFilenameForWriting |
( |
| ) |
|
|
inlineinherited |
◆ getFullPath()
std::string tinc::DiskBufferAbstract::getFullPath |
( |
| ) |
|
|
inlineinherited |
◆ getId()
std::string tinc::IdObject::getId |
( |
| ) |
|
|
inherited |
◆ getRelativePath()
std::string tinc::DiskBufferAbstract::getRelativePath |
( |
| ) |
|
|
inlineinherited |
◆ getRootPath()
std::string tinc::DiskBufferAbstract::getRootPath |
( |
| ) |
|
|
inlineinherited |
◆ getWritable()
template<class DataType >
◆ loadData()
bool tinc::DiskBuffer< std::string >::loadData |
( |
std::string |
filename = "" , |
|
|
bool |
notify = true |
|
) |
| |
|
overridevirtualinherited |
updateData
- Parameters
-
- Returns
Whenever overriding this function, you must make sure you call the update callbacks in mUpdateCallbacks
Implements tinc::DiskBufferAbstract.
Definition at line 67 of file DiskBuffer.hpp.
◆ makeFileName()
std::string tinc::DiskBufferAbstract::makeFileName |
( |
uint64_t |
index | ) |
|
|
inlineprotectedinherited |
◆ makeNextFileName()
std::string tinc::DiskBufferAbstract::makeNextFileName |
( |
| ) |
|
|
inlineprotectedinherited |
◆ newDataAvailable()
template<class DataType >
Check if there are buffers that have been written but not read.
Definition at line 124 of file BufferManager.hpp.
◆ parseFile()
bool tinc::DiskBufferText::parseFile |
( |
std::string |
fileName, |
|
|
std::shared_ptr< std::string > |
newData |
|
) |
| |
|
inlineoverrideprotectedvirtual |
◆ registerNotifyCallback()
void tinc::DiskBufferAbstract::registerNotifyCallback |
( |
std::function< void(bool)> |
cb | ) |
|
|
inlineinherited |
register a function to be called when this object generates new buffer data
- Parameters
-
cb | If this object is registered with a TINC server or client, this function will only be called if the data creation is local to the node. |
When defining loadData(), these callbacks should only be called accodring to the notify argument.
Definition at line 125 of file DiskBufferAbstract.hpp.
◆ registerUpdateCallback()
void tinc::DiskBufferAbstract::registerUpdateCallback |
( |
std::function< void(bool)> |
cb | ) |
|
|
inlineinherited |
register a function to be called when this object generates new buffer data
- Parameters
-
cb | If this object is registered with a TINC server or client, this function will only be called if the data creation is local to the node. |
Definition at line 110 of file DiskBufferAbstract.hpp.
◆ setBaseFileName()
void tinc::DiskBufferAbstract::setBaseFileName |
( |
std::string |
name | ) |
|
|
inlineinherited |
◆ setData()
Write data from memory to disk buffer and then load it.
- Parameters
-
- Returns
- the name of the file where buffer was written
Definition at line 74 of file DiskBuffer.hpp.
◆ setDocumentation()
void tinc::IdObject::setDocumentation |
( |
const std::string & |
documentation | ) |
|
|
inherited |
◆ setId()
void tinc::IdObject::setId |
( |
std::string |
id | ) |
|
|
inherited |
◆ setRelativePath()
void tinc::DiskBufferAbstract::setRelativePath |
( |
std::string |
path | ) |
|
|
inlineinherited |
◆ setRootPath()
void tinc::DiskBufferAbstract::setRootPath |
( |
std::string |
path | ) |
|
|
inlineinherited |
◆ useFileLock()
void tinc::DiskBufferAbstract::useFileLock |
( |
bool |
use = true , |
|
|
bool |
clearLocks = true |
|
) |
| |
|
inlineinherited |
◆ m_distPath
◆ m_fileName
std::string tinc::DiskBufferAbstract::m_fileName |
|
protectedinherited |
◆ m_roundRobinCounter
uint64_t tinc::DiskBufferAbstract::m_roundRobinCounter {0} |
|
protectedinherited |
◆ m_roundRobinSize
uint64_t tinc::DiskBufferAbstract::m_roundRobinSize {0} |
|
protectedinherited |
◆ m_trigger
std::shared_ptr<al::ParameterString> tinc::DiskBufferAbstract::m_trigger |
|
protectedinherited |
◆ m_writeLock
std::mutex tinc::DiskBufferAbstract::m_writeLock |
|
protectedinherited |
◆ mData
template<class DataType >
◆ mDataLock
template<class DataType >
◆ mDocumentation
std::string tinc::IdObject::mDocumentation |
|
protectedinherited |
◆ mId
std::string tinc::IdObject::mId |
|
protectedinherited |
◆ mNewData
template<class DataType >
◆ mNotifyCallbacks
std::vector<std::function<void(bool)> > tinc::DiskBufferAbstract::mNotifyCallbacks |
|
protectedinherited |
◆ modified
std::function<void(al::Socket *src)> tinc::IdObject::modified = [](al::Socket * ) {} |
|
inherited |
◆ mReadBuffer
template<class DataType >
◆ mSize
template<class DataType >
◆ mUpdateCallbacks
std::vector<std::function<void(bool)> > tinc::DiskBufferAbstract::mUpdateCallbacks |
|
protectedinherited |
◆ mWriteBuffer
template<class DataType >
The documentation for this class was generated from the following file: