11 : initialized_ (false), prefix_ (prefix),
12 heart_beat_ (heart_beat), last_clear_ (0)
35 "EndpointDiscovery::filter:" \
36 " Processing a new update with %d records\n",
37 (int)records.size ());
46 std::vector <std::string> keys;
51 for (
size_t i = 0; i < keys.size (); ++i)
58 "EndpointDiscovery::filter:" \
59 " Erasing endpoint %s\n",
knowledge::containers::Map endpoints_
A map of discovered peers.
knowledge::KnowledgeRecord::Integer heart_beat_
The time to keep record of a peer.
void keys(std::vector< std::string > &curkeys) const
Returns the keys within the map.
bool initialized_
Tracks if the peers_ map has been initialized.
std::vector< std::string > sync_keys(void)
Syncs the keys from the knowledge base.
std::string prefix_
The context.
#define madara_logger_log(logger, level,...)
Fast version of the madara::logger::log method.
Provides context about the transport.
void erase(const std::string &key)
Erases a variable from the map.
int set(const std::string &key, madara::knowledge::KnowledgeRecord::Integer value=madara::knowledge::KnowledgeRecord::MODIFIED)
Sets a location within the map to the specified value.
virtual ~EndpointDiscovery()
Destructor.
uint64_t get_current_time(void) const
Gets the current timestamp.
virtual void filter(knowledge::KnowledgeMap &records, const transport::TransportContext &transport_context, knowledge::Variables &vars)
Calls the main logic of the filter.
madara::knowledge::KnowledgeRecord::Integer Integer
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
EndpointDiscovery(const std::string &prefix=".endpoints", knowledge::KnowledgeRecord::Integer heart_beat=-1)
Constructor.
const std::string & get_endpoint(void) const
Returns the current message endpoint.
madara::knowledge::KnowledgeRecord::Integer Integer
Provides utility functions and classes for common tasks and needs.
knowledge::KnowledgeRecord::Integer last_clear_
The time of the last clear of the peer_list.
logger::Logger & get_logger(void) const
Gets the logger used for information printing.
Provides an interface for external functions into the MADARA KaRL variable settings.
ThreadSafeContext * get_context(void)
Returns the ThreadSafeContext associated with this Variables facade.