Rename AsyncQuery to ResultsNotifier

This commit is contained in:
Thomas Goyne 2016-03-09 11:53:08 -08:00
parent 424f4e829f
commit 4ec1090c05
7 changed files with 31 additions and 31 deletions

View File

@ -7,10 +7,10 @@ set(SOURCES
results.cpp
schema.cpp
shared_realm.cpp
impl/async_query.cpp
impl/background_collection.cpp
impl/list_notifier.cpp
impl/realm_coordinator.cpp
impl/results_notifier.cpp
impl/transact_log_handler.cpp
parser/parser.cpp
parser/query_builder.cpp)
@ -24,11 +24,11 @@ set(HEADERS
results.hpp
schema.hpp
shared_realm.hpp
impl/async_query.hpp
impl/background_collection.hpp
impl/external_commit_helper.hpp
impl/list_notifier.hpp
impl/realm_coordinator.hpp
impl/results_notifier.hpp
impl/transact_log_handler.hpp
impl/weak_realm_notifier.hpp
impl/weak_realm_notifier_base.hpp

View File

@ -18,11 +18,11 @@
#include "impl/realm_coordinator.hpp"
#include "impl/async_query.hpp"
#include "impl/weak_realm_notifier.hpp"
#include "impl/external_commit_helper.hpp"
#include "impl/list_notifier.hpp"
#include "impl/results_notifier.hpp"
#include "impl/transact_log_handler.hpp"
#include "impl/weak_realm_notifier.hpp"
#include "object_store.hpp"
#include "schema.hpp"

View File

@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////
#include "impl/async_query.hpp"
#include "impl/results_notifier.hpp"
#include "impl/realm_coordinator.hpp"
#include "results.hpp"
@ -24,7 +24,7 @@
using namespace realm;
using namespace realm::_impl;
AsyncQuery::AsyncQuery(Results& target)
ResultsNotifier::ResultsNotifier(Results& target)
: BackgroundCollection(target.get_realm())
, m_target_results(&target)
, m_sort(target.get_sort())
@ -34,7 +34,7 @@ AsyncQuery::AsyncQuery(Results& target)
m_query_handover = Realm::Internal::get_shared_group(get_realm()).export_for_handover(q, MutableSourcePayload::Move);
}
void AsyncQuery::release_data() noexcept
void ResultsNotifier::release_data() noexcept
{
m_query = nullptr;
}
@ -74,13 +74,13 @@ static bool map_moves(size_t& idx, CollectionChangeIndices const& changes)
return false;
}
void AsyncQuery::do_add_required_change_info(TransactionChangeInfo& info)
void ResultsNotifier::do_add_required_change_info(TransactionChangeInfo& info)
{
REALM_ASSERT(m_query);
m_info = &info;
}
void AsyncQuery::run()
void ResultsNotifier::run()
{
REALM_ASSERT(m_info);
@ -147,7 +147,7 @@ void AsyncQuery::run()
}
}
void AsyncQuery::do_prepare_handover(SharedGroup& sg)
void ResultsNotifier::do_prepare_handover(SharedGroup& sg)
{
if (!m_tv.is_attached()) {
return;
@ -167,7 +167,7 @@ void AsyncQuery::do_prepare_handover(SharedGroup& sg)
m_tv = {};
}
bool AsyncQuery::do_deliver(SharedGroup& sg)
bool ResultsNotifier::do_deliver(SharedGroup& sg)
{
std::lock_guard<std::mutex> target_lock(m_target_mutex);
@ -196,13 +196,13 @@ bool AsyncQuery::do_deliver(SharedGroup& sg)
return true;
}
void AsyncQuery::do_attach_to(SharedGroup& sg)
void ResultsNotifier::do_attach_to(SharedGroup& sg)
{
REALM_ASSERT(m_query_handover);
m_query = sg.import_from_handover(std::move(m_query_handover));
}
void AsyncQuery::do_detach_from(SharedGroup& sg)
void ResultsNotifier::do_detach_from(SharedGroup& sg)
{
REALM_ASSERT(m_query);
REALM_ASSERT(!m_tv.is_attached());

View File

@ -16,8 +16,8 @@
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_ASYNC_QUERY_HPP
#define REALM_ASYNC_QUERY_HPP
#ifndef REALM_RESULTS_NOTIFIER_HPP
#define REALM_RESULTS_NOTIFIER_HPP
#include "background_collection.hpp"
#include "results.hpp"
@ -35,9 +35,9 @@ namespace realm {
namespace _impl {
struct TransactionChangeInfo;
class AsyncQuery : public BackgroundCollection {
class ResultsNotifier : public BackgroundCollection {
public:
AsyncQuery(Results& target);
ResultsNotifier(Results& target);
private:
// Run/rerun the query if needed
@ -84,4 +84,4 @@ private:
} // namespace _impl
} // namespace realm
#endif /* REALM_ASYNC_QUERY_HPP */
#endif /* REALM_RESULTS_NOTIFIER_HPP */

View File

@ -18,8 +18,8 @@
#include "results.hpp"
#include "impl/async_query.hpp"
#include "impl/realm_coordinator.hpp"
#include "impl/results_notifier.hpp"
#include "object_store.hpp"
#include <stdexcept>
@ -182,7 +182,7 @@ void Results::update_tableview()
return;
}
if (!m_background_query && !m_realm->is_in_transaction() && m_realm->can_deliver_notifications()) {
m_background_query = std::make_shared<_impl::AsyncQuery>(*this);
m_background_query = std::make_shared<_impl::ResultsNotifier>(*this);
_impl::RealmCoordinator::register_query(m_background_query);
}
m_has_used_table_view = true;
@ -370,7 +370,7 @@ void Results::prepare_async()
}
if (!m_background_query) {
m_background_query = std::make_shared<_impl::AsyncQuery>(*this);
m_background_query = std::make_shared<_impl::ResultsNotifier>(*this);
_impl::RealmCoordinator::register_query(m_background_query);
}
}

View File

@ -35,7 +35,7 @@ class Results;
class ObjectSchema;
namespace _impl {
class AsyncQuery;
class ResultsNotifier;
}
struct SortOrder {
@ -181,10 +181,10 @@ public:
bool wants_background_updates() const { return m_wants_background_updates; }
// Helper type to let AsyncQuery update the tableview without giving access
// Helper type to let ResultsNotifier update the tableview without giving access
// to any other privates or letting anyone else do so
class Internal {
friend class _impl::AsyncQuery;
friend class _impl::ResultsNotifier;
static void set_table_view(Results& results, TableView&& tv);
};
@ -197,7 +197,7 @@ private:
SortOrder m_sort;
bool m_live = true;
std::shared_ptr<_impl::AsyncQuery> m_background_query;
std::shared_ptr<_impl::ResultsNotifier> m_background_query;
Mode m_mode = Mode::Empty;
bool m_has_used_table_view = false;

View File

@ -32,19 +32,19 @@
namespace realm {
class BindingContext;
class Replication;
class Group;
class Realm;
class RealmDelegate;
class Replication;
class SharedGroup;
typedef std::shared_ptr<Realm> SharedRealm;
typedef std::weak_ptr<Realm> WeakRealm;
namespace _impl {
class AsyncQuery;
class BackgroundCollection;
class ListNotifier;
class RealmCoordinator;
class ResultsNotifier;
}
class Realm : public std::enable_shared_from_this<Realm> {
@ -145,13 +145,13 @@ namespace realm {
// Expose some internal functionality to other parts of the ObjectStore
// without making it public to everyone
class Internal {
friend class _impl::AsyncQuery;
friend class _impl::ListNotifier;
friend class _impl::BackgroundCollection;
friend class _impl::ListNotifier;
friend class _impl::RealmCoordinator;
friend class _impl::ResultsNotifier;
// AsyncQuery needs access to the SharedGroup to be able to call the
// handover functions, which are not very wrappable
// ResultsNotifier and ListNotifier need access to the SharedGroup
// to be able to call the handover functions, which are not very wrappable
static SharedGroup& get_shared_group(Realm& realm) { return *realm.m_shared_group; }
// BackgroundCollection needs to be able to access the owning