"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "auxil/broker/include/broker/mixin/data_store_manager.hh" between
zeek-4.0.2.tar.gz and zeek-4.0.3.tar.gz

About: Zeek (formerly Bro) is a flexible network analysis framework focusing on network security monitoring. LTS (Long Term Support) release.

data_store_manager.hh  (zeek-4.0.2):data_store_manager.hh  (zeek-4.0.3)
skipping to change at line 51 skipping to change at line 51
// nop // nop
} }
// -- properties ------------------------------------------------------------- // -- properties -------------------------------------------------------------
/// Returns whether a master for `name` probably exists already on one of our /// Returns whether a master for `name` probably exists already on one of our
/// peers. /// peers.
bool has_remote_master(const std::string& name) { bool has_remote_master(const std::string& name) {
// If we don't have a master recorded locally, we could still have a // If we don't have a master recorded locally, we could still have a
// propagated filter to a remote core hosting a master. // propagated filter to a remote core hosting a master.
return dref().has_remote_subscriber(name / topics::master_suffix); return dref().has_remote_subscriber(name / topic::master_suffix());
} }
const auto& masters() const noexcept { const auto& masters() const noexcept {
return masters_; return masters_;
} }
const auto& clones() const noexcept { const auto& clones() const noexcept {
return clones_; return clones_;
} }
skipping to change at line 82 skipping to change at line 82
if (has_remote_master(name)) { if (has_remote_master(name)) {
BROKER_WARNING("remote master with same name exists already"); BROKER_WARNING("remote master with same name exists already");
return ec::master_exists; return ec::master_exists;
} }
auto ptr = detail::make_backend(backend_type, std::move(opts)); auto ptr = detail::make_backend(backend_type, std::move(opts));
BROKER_ASSERT(ptr != nullptr); BROKER_ASSERT(ptr != nullptr);
BROKER_INFO("spawning new master:" << name); BROKER_INFO("spawning new master:" << name);
auto self = super::self(); auto self = super::self();
auto ms = self->template spawn<spawn_flags>(detail::master_actor, self, auto ms = self->template spawn<spawn_flags>(detail::master_actor, self,
name, std::move(ptr), clock_); name, std::move(ptr), clock_);
filter_type filter{name / topics::master_suffix}; filter_type filter{name / topic::master_suffix()};
if (auto err = dref().add_store(ms, filter)) if (auto err = dref().add_store(ms, filter))
return err; return err;
masters_.emplace(name, ms); masters_.emplace(name, ms);
return ms; return ms;
} }
/// Attaches a clone for given store to this peer. /// Attaches a clone for given store to this peer.
caf::result<caf::actor> caf::result<caf::actor>
attach_clone(const std::string& name, double resync_interval, attach_clone(const std::string& name, double resync_interval,
double stale_interval, double mutation_buffer_interval) { double stale_interval, double mutation_buffer_interval) {
skipping to change at line 108 skipping to change at line 108
return ec::no_such_master; return ec::no_such_master;
} }
if (auto i = clones_.find(name); i != clones_.end()) if (auto i = clones_.find(name); i != clones_.end())
return i->second; return i->second;
BROKER_INFO("spawning new clone:" << name); BROKER_INFO("spawning new clone:" << name);
auto self = super::self(); auto self = super::self();
auto cl = self->template spawn<spawn_flags>(detail::clone_actor, self, name, auto cl = self->template spawn<spawn_flags>(detail::clone_actor, self, name,
resync_interval, stale_interval, resync_interval, stale_interval,
mutation_buffer_interval, mutation_buffer_interval,
clock_); clock_);
filter_type filter{name / topics::clone_suffix}; filter_type filter{name / topic::clone_suffix()};
if (auto err = dref().add_store(cl, filter)) if (auto err = dref().add_store(cl, filter))
return err; return err;
clones_.emplace(name, cl); clones_.emplace(name, cl);
return cl; return cl;
} }
/// Returns whether the master for the given store runs at this peer. /// Returns whether the master for the given store runs at this peer.
caf::result<caf::actor> get_master(const std::string& name) { caf::result<caf::actor> get_master(const std::string& name) {
auto i = masters_.find(name); auto i = masters_.find(name);
if (i != masters_.end()) if (i != masters_.end())
return i->second; return i->second;
return ec::no_such_master; return ec::no_such_master;
} }
/// Instructs the master of the given store to generate a snapshot. /// Instructs the master of the given store to generate a snapshot.
void snapshot(const std::string& name, caf::actor& clone) { void snapshot(const std::string& name, caf::actor& clone) {
auto msg = make_internal_command<snapshot_command>(super::self(), auto msg = make_internal_command<snapshot_command>(super::self(),
std::move(clone)); std::move(clone));
dref().publish(make_command_message(name / topics::master_suffix, msg)); dref().publish(make_command_message(name / topic::master_suffix(), msg));
} }
/// Detaches all masters and clones by sending exit messages to the /// Detaches all masters and clones by sending exit messages to the
/// corresponding actors. /// corresponding actors.
void detach_stores() { void detach_stores() {
auto self = super::self(); auto self = super::self();
auto f = [&](auto& container) { auto f = [&](auto& container) {
for (auto& kvp : container) for (auto& kvp : container)
self->send_exit(kvp.second, caf::exit_reason::user_shutdown); self->send_exit(kvp.second, caf::exit_reason::user_shutdown);
container.clear(); container.clear();
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)