diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-06-10 14:36:49 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-06-10 14:36:49 +0200 |
commit | fe8d317c1b40fe162891d5ddec1cb7df702bb7fe (patch) | |
tree | f001cb3ebd5cc81c14cbec090ca204df42763c7e /runtime/ruleset.c | |
parent | 74135da95971c8d03e4e45f7d3f703e1d40f76f4 (diff) | |
download | rsyslog-fe8d317c1b40fe162891d5ddec1cb7df702bb7fe.tar.gz rsyslog-fe8d317c1b40fe162891d5ddec1cb7df702bb7fe.tar.xz rsyslog-fe8d317c1b40fe162891d5ddec1cb7df702bb7fe.zip |
milestone commit(BUGGY): batch is now handed down to rule processing
Now, the full batch is passed down to the rule, which then enqueues
the elements as single messages. Note that this code has some known
defects and needs more changes until it is correct again. This is
primarily a commit to be able to return to a known-(somewhat)-good
state.
Diffstat (limited to 'runtime/ruleset.c')
-rw-r--r-- | runtime/ruleset.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/runtime/ruleset.c b/runtime/ruleset.c index 1a77be2b..caeb9357 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -46,6 +46,7 @@ #include "rule.h" #include "errmsg.h" #include "parser.h" +#include "batch.h" #include "unicode-helper.h" #include "dirty.h" /* for main ruleset queue creation */ @@ -134,34 +135,48 @@ finalize_it: -/* helper to processMsg(), used to call the configured actions. It is +/* helper to processBatch(), used to call the configured actions. It is * executed from within llExecFunc() of the action list. * rgerhards, 2007-08-02 */ -DEFFUNC_llExecFunc(processMsgDoRules) +DEFFUNC_llExecFunc(processBatchDoRules) { rsRetVal iRet; ISOBJ_TYPE_assert(pData, rule); - iRet = rule.ProcessMsg((rule_t*) pData, (msg_t*) pParam); + iRet = rule.ProcessBatch((rule_t*) pData, (batch_t*) pParam); dbgprintf("ruleset: get iRet %d from rule.ProcessMsg()\n", iRet); return iRet; } -/* Process (consume) a received message. Calls the actions configured. +/* Process (consume) a batch of messages. Calls the actions configured. + * If the whole batch uses a singel ruleset, we can process the batch as + * a whole. Otherwise, we need to process it slower, on a message-by-message + * basis (what can be optimized to a per-ruleset basis) * rgerhards, 2005-10-13 */ static rsRetVal -processMsg(msg_t *pMsg) +processBatch(batch_t *pBatch) { ruleset_t *pThis; DEFiRet; - assert(pMsg != NULL); - - pThis = (pMsg->pRuleset == NULL) ? pDfltRuleset : pMsg->pRuleset; - ISOBJ_TYPE_assert(pThis, ruleset); - - CHKiRet(llExecFunc(&pThis->llRules, processMsgDoRules, pMsg)); + assert(pBatch != NULL); + + if(pBatch->bSingleRuleset) { + pThis = batchGetRuleset(pBatch); + if(pThis == NULL) + pThis = pDfltRuleset; + ISOBJ_TYPE_assert(pThis, ruleset); + CHKiRet(llExecFunc(&pThis->llRules, processBatchDoRules, pBatch)); + } else { + #warning implementation missing! + /* we need to split of the batch according to rulesets used */ + // TODO: do this at the deque level, much more performant! + assert(0); // TODO mandatory to implement! + dbgprintf("processbatch missing implementation, terminating!\n"); + printf("processBatch missing implementation, terminating!\n"); + exit(0); + } finalize_it: dbgprintf("ruleset.ProcessMsg() returns %d\n", iRet); @@ -515,7 +530,7 @@ CODESTARTobjQueryInterface(ruleset) pIf->IterateAllActions = iterateAllActions; pIf->DestructAllActions = destructAllActions; pIf->AddRule = addRule; - pIf->ProcessMsg = processMsg; + pIf->ProcessBatch = processBatch; pIf->SetName = setName; pIf->DebugPrintAll = debugPrintAll; pIf->GetCurrent = GetCurrent; |