8 "RECEIVING_OPERATION",
"REBROADCASTING_OPERATION"};
29 if (!args[0].is_file_type())
54 if (args[0].is_file_type())
77 std::stringstream buffer;
78 buffer <<
"Filter args:\n";
81 buffer <<
" [0:Record]: ";
86 buffer <<
" [1:Record Name]: ";
87 buffer << args[1].to_string();
91 buffer <<
" [2:Operation Type]: ";
96 buffer <<
" [3:Send Bandwidth]: ";
97 buffer << args[3].to_integer();
101 buffer <<
" [4:Receive Bandwidth]: ";
102 buffer << args[4].to_integer();
106 buffer <<
" [5:Update Time]: ";
107 buffer << args[5].to_integer();
111 buffer <<
" [6:Current Time]: ";
112 buffer << args[6].to_integer();
116 buffer <<
" [7:Knowledge Domain]: ";
117 buffer << args[7].to_string();
121 buffer <<
" [8:Originator]: ";
122 buffer << args[8].to_string();
125 vars.
print(buffer.str(), 0);
135 std::stringstream buffer;
136 buffer <<
"Aggregate Filter Arguments:\n";
139 buffer <<
" Operation Type: ";
144 buffer <<
" Send Bandwidth: ";
149 buffer <<
" Receive Bandwidth: ";
154 buffer <<
" Update Time: ";
159 buffer <<
" Current Time: ";
164 buffer <<
" Knowledge Domain: ";
169 buffer <<
" Originator: ";
173 buffer <<
" Updates:\n";
174 if (records.size() > 0)
176 for (knowledge::KnowledgeMap::const_iterator i = records.begin();
177 i != records.end(); ++i)
179 buffer <<
" " << i->first <<
" = ";
180 buffer << i->second.to_string() <<
"\n";
184 vars.
print(buffer.str(), 0);
const char * operation_types[]
madara::knowledge::KnowledgeRecord KnowledgeRecord
This class encapsulates an entry in a KnowledgeBase.
std::string to_string(const std::string &delimiter=", ") const
converts the value to a string.
Provides an interface for external functions into the MADARA KaRL variable settings.
void print(unsigned int level=0) const
Prints all variables and values in the context.
Provides context about the transport.
uint64_t get_send_bandwidth(void) const
Gets the send/rebroadcast bandwidth in bytes per second.
const std::string & get_domain(void) const
Returns the network domain.
int64_t get_operation(void) const
Get operation that the context is performing.
uint64_t get_current_time(void) const
Gets the current timestamp.
const std::string & get_originator(void) const
Returns the current message originator.
uint64_t get_receive_bandwidth(void) const
Gets the receive bandwidth in bytes per second.
uint64_t get_message_time(void) const
Gets the message timestamp.
MADARA_EXPORT knowledge::KnowledgeRecord discard_nonprimitives(knowledge::FunctionArguments &args, knowledge::Variables &vars)
Filter for discarding a non-primitive record.
MADARA_EXPORT void log_aggregate(knowledge::KnowledgeMap &records, const transport::TransportContext &transport_context, knowledge::Variables &vars)
Filter for logging aggregate update and context.
MADARA_EXPORT knowledge::KnowledgeRecord log_args(knowledge::FunctionArguments &args, knowledge::Variables &vars)
Filter for logging args.
MADARA_EXPORT knowledge::KnowledgeRecord discard(knowledge::FunctionArguments &args, knowledge::Variables &vars)
Filter for discarding a record.
MADARA_EXPORT knowledge::KnowledgeRecord discard_nonfiles(knowledge::FunctionArguments &args, knowledge::Variables &vars)
Filter for discarding a non-file record.
std::vector< KnowledgeRecord > FunctionArguments
::std::map< std::string, KnowledgeRecord > KnowledgeMap