10 : initialized_ (false), prefix_ (prefix)
37 "EndpointClear::filter:" \
38 " Processing a new update from %s with %d records\n",
40 (int)records.size ());
49 "EndpointClear::filter:" \
50 " Sender is trusted. Clearing endpoints.\n");
69 for (knowledge::KnowledgeMap::const_iterator i = records.begin ();
70 i != records.end () && !found; ++i)
77 "EndpointClear::filter:" \
78 " Prefix is match. Clearing endpoints.\n");
90 else if (prefix[0] < i->first[0])
94 "EndpointClear::filter:" \
95 " Prefix is not a match. Not clearing endpoints.\n");
106 const std::vector <std::string> & originators)
108 for (std::vector <std::string>::const_iterator i = originators.begin ();
109 i != originators.end (); ++i)
void clear_trusted_originators(void)
Clears all trusted originators who can prompt deleting.
EndpointClear(const std::string &prefix=".endpoints")
Constructor.
std::string get_name(void) const
Returns the name of the container.
void set_settings(const KnowledgeUpdateSettings &settings)
Sets the update settings for the container.
virtual ~EndpointClear()
Destructor.
std::vector< std::string > sync_keys(void)
Syncs the keys from the knowledge base.
virtual void filter(knowledge::KnowledgeMap &records, const transport::TransportContext &transport_context, knowledge::Variables &vars)
Calls the main logic of the filter.
void add_trusted_originator(const std::vector< std::string > &originators)
Adds trusted originators who will be able to prompt deleting.
knowledge::containers::Map endpoints_
A map of discovered peers.
#define madara_logger_log(logger, level,...)
Fast version of the madara::logger::log method.
Provides context about the transport.
void set_prefix(const std::string &prefix)
Sets the prefix to use.
int get_level(void)
Gets the maximum logging detail level.
void set_name(const std::string &var_name, KnowledgeBase &knowledge, bool sync=true)
Sets the variable name that this refers to.
::std::map< std::string, KnowledgeRecord > KnowledgeMap
std::map< std::string, bool > trusted_originators_
originators that are trusted to prompt a clear of endpoints
void clear(bool clear_knowledge=true)
Clears the map.
bool initialized_
Tracks if the peers_ map has been initialized.
Provides utility functions and classes for common tasks and needs.
madara::knowledge::KnowledgeRecord::Integer Integer
Settings for applying knowledge updates.
const std::string & get_originator(void) const
Returns the current message originator.
std::string prefix_
The context.
logger::Logger & get_logger(void) const
Gets the logger used for information printing.
MADARA_Export bool begins_with(const std::string &input, const std::string &prefix)
Check if input contains prefix at the beginning.
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.
ThreadSafeContext * get_context(void)
Returns the ThreadSafeContext associated with this Variables facade.