 |
ewmscp
..
|
#include <followJsonRequestProvider.h>
|
void | cleanupRenameEvents (copyRequest::clock_type::duration minAge) |
|
void | followStream (std::istream &stream) override |
|
virtual void | processJson (const Json::Value &json) |
|
template<typename ... Types> |
void | enqueueOrAppend (const std::string &srcPath, copyRequest::fileInWork::slotTypes type, copyRequest::clock_type::time_point timestamp, Types ... args) |
|
virtual void | handleMove (const std::string &srcPath, const std::string &dstPath, const std::string &fromPath, const std::string &origPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp) |
|
virtual void | handleOther (const std::string &srcPath, const std::string &dstPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp, bool requestForRemoval) |
|
| followRequestProvider (decltype(requests) aRequests, decltype(delayedRequests) aDelayedRequests, decltype(parents) aParents, decltype(InputHandler) aInputHandler, decltype(OutputHandler) aOutputHandler) |
|
virtual const singleMap & | getDstPath (const std::string &source, std::string &destination, bool baseNameOnly=false) |
| get detstination papth for a given source path More...
|
|
Definition at line 9 of file followJsonRequestProvider.h.
◆ followJsonRequestProvider()
◆ ~followJsonRequestProvider()
followJsonRequestProvider::~followJsonRequestProvider |
( |
| ) |
|
|
overridedefault |
◆ cleanupRenameEvents()
void followJsonRequestProvider::cleanupRenameEvents |
( |
copyRequest::clock_type::duration |
minAge | ) |
|
|
protected |
Definition at line 155 of file followJsonRequestProvider.cpp.
159 event->dstPath,
"found stale moveFrom, cookie", event->cookie,
160 "from", std::fixed, event->timestamp);
162 handleOther(event->srcPath, event->dstPath, event->mapEntry, event->timestamp,
true);
166 event->dstPath,
"found stale moveTo, cookie", event->cookie,
167 "from", std::fixed, event->timestamp);
168 handleOther(event->srcPath, event->dstPath, event->mapEntry, event->timestamp,
false);
References errMsg::debug, errMsg::emit(), renameEventHandler::forgetRenameEvent(), renameEventHandler::getNextStaleSingle(), followRequestProvider::handleOther(), followRequestProvider::mayDelete, renameHalfEvent::moveFrom, and renameHandler.
Referenced by followStream(), and followKafkaRequestProvider::processSources().
◆ followStream()
void followJsonRequestProvider::followStream |
( |
std::istream & |
stream | ) |
|
|
overrideprotectedvirtual |
◆ getRequiredJsonValue()
std::string followJsonRequestProvider::getRequiredJsonValue |
( |
const Json::Value & |
json, |
|
|
const std::string & |
key |
|
) |
| |
|
staticprotected |
Definition at line 68 of file followJsonRequestProvider.cpp.
70 auto jsonValue = json.find(key.c_str(), key.c_str() + key.size());
71 if (jsonValue ==
nullptr) {
74 return jsonValue->asString();
Referenced by processJson().
◆ processJson()
void followJsonRequestProvider::processJson |
( |
const Json::Value & |
json | ) |
|
|
protectedvirtual |
Definition at line 77 of file followJsonRequestProvider.cpp.
79 if (srcPath.empty()) {
86 if (operation.empty()) {
90 copyRequest::clock_type::time_point timestamp;
94 timestamp = copyRequest::clock_type::time_point(std::chrono::duration_cast<copyRequest::clock_type::duration>(std::chrono::duration<double>(jsonTimestamp->asDouble())));
97 strptime(jsonTimestamp->asCString(),
timestampFormat.c_str(), &tmStruct);
98 timestamp = copyRequest::clock_type::time_point(std::chrono::duration_cast<copyRequest::clock_type::duration>(std::chrono::duration<double>(mktime(&tmStruct)))) +
timestampOffset;
100 auto tzStart=jsonTimestamp->asString().find_last_of(
"+-");
101 if (tzStart != std::string::npos) {
102 auto offset = std::stoi(jsonTimestamp->asString().substr(tzStart));
103 timestamp -= std::chrono::hours(offset/100);
104 timestamp -= std::chrono::minutes(offset%100);
109 timestamp = copyRequest::clock_type::now();
115 handleOther(srcPath, dstPath, mapEntry, timestamp,
false);
117 handleOther(srcPath, dstPath, mapEntry, timestamp,
true);
120 if (jsonCookie.empty()) {
131 if (partner !=
nullptr) {
References cookieKey, copyOpValue, deleteOpValue, options::base::fIsSet(), renameEventHandler::forgetRenameEvent(), requestProvider::getDstPath(), renameEventHandler::getRenamePartner(), getRequiredJsonValue(), followRequestProvider::handleMove(), followRequestProvider::handleOther(), renameHalfEvent::moveFrom, moveFromOpValue, renameHalfEvent::moveTo, moveToOpValue, operationKey, pathKey, renameHandler, sourceMatchRegex, timestampFormat, timestampKey, and timestampOffset.
Referenced by followStream(), and followKafkaRequestProvider::processSources().
◆ cookieKey
◆ copyOpValue
◆ deleteOpValue
◆ factory
◆ jsonDelimiter
◆ moveFromOpValue
◆ moveToOpValue
◆ operationKey
◆ pathKey
◆ renameHandler
◆ sourceMatchRegex
◆ timestampFormat
◆ timestampKey
◆ timestampOffset
options::single<copyRequest::clock_type::duration> followJsonRequestProvider::timestampOffset |
|
staticprivate |
The documentation for this class was generated from the following files:
virtual void processJson(const Json::Value &json)
static options::single< std::string > cookieKey
class for defining the location of a error message in the source code.
void forgetRenameEvent(const renameHalfEvent *what)
virtual void handleMove(const std::string &srcPath, const std::string &dstPath, const std::string &fromPath, const std::string &origPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp)
virtual bool fIsSet() const
check if this option was set, regardless of from command line or config file
static options::single< bool > mayDelete
const renameHalfEvent * getNextStaleSingle(renameHalfEvent::timeType::duration timeout)
static options::single< std::string > moveFromOpValue
static options::single< std::string > operationKey
static options::single< std::string > copyOpValue
static options::single< bool > nullDelimiter
static options::single< std::regex > sourceMatchRegex
static options::single< std::string > pathKey
static options::single< std::string > timestampFormat
followRequestProvider(decltype(requests) aRequests, decltype(delayedRequests) aDelayedRequests, decltype(parents) aParents, decltype(InputHandler) aInputHandler, decltype(OutputHandler) aOutputHandler)
static options::single< std::string > timestampKey
static options::single< std::string > moveToOpValue
static options::single< copyRequest::clock_type::duration > timestampOffset
static options::single< int > jsonDelimiter
void emit(level aLogLevel, const location &loc, const std::string &aObject, const std::string &aAction, const Args &... args)
function to create and enqueue a message, this is the only way that messages should be created!
const renameHalfEvent * getRenamePartner(renameHalfEvent::cookieType cookie, const renameHalfEvent::pathType &aSrcPath, const renameHalfEvent::pathType &aDstPath, renameHalfEvent::moveTypeEnum aIsMoveFrom, const singleMap &aMapEntry, renameHalfEvent::timeType::time_point aTimestamp)
renameEventHandler renameHandler
virtual const singleMap & getDstPath(const std::string &source, std::string &destination, bool baseNameOnly=false)
get detstination papth for a given source path
virtual void handleOther(const std::string &srcPath, const std::string &dstPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp, bool requestForRemoval)
static std::string getRequiredJsonValue(const Json::Value &json, const std::string &key)
static options::single< std::string > deleteOpValue
void cleanupRenameEvents(copyRequest::clock_type::duration minAge)