22 bool was_empty = change_list_.empty();
23 change_list_.push_back(*entry);
25 DB *db = parent()->database();
41 for (
int i = 0; ((i < kMaxIterations) && !change_list_.empty()); ++i) {
43 change_list_.pop_front();
45 parent()->RunNotify(
this, entry);
62 if (!change_list_.empty()) {
63 DB *db = parent()->database();
72 if (parent_->HasListeners()) {
78 change_list_.erase(change_list_.iterator_to(*entry));
95 std::scoped_lock lock(
mutex_);
96 std::pair<Tree::iterator, bool> ret =
tree_.insert(*entry);
104 std::scoped_lock lock(
mutex_);
109 std::scoped_lock lock(
mutex_);
113 bool success =
tree_.erase(*entry);
115 LOG(FATAL,
"ABORT: DB node erase failed for table " +
parent()->name());
116 LOG(FATAL,
"Invalid node " + db_entry->
ToString());
128 std::scoped_lock lock(
mutex_);
129 tree_.insert(*entry);
136 std::scoped_lock lock(
mutex_);
137 bool success =
tree_.erase(*entry);
139 LOG(FATAL,
"ABORT: DB node erase failed for table " +
parent()->name());
145 Tree::iterator loc =
tree_.find(*entry);
146 if (loc !=
tree_.end()) {
147 return loc.operator->();
153 Tree::const_iterator loc =
tree_.find(*entry);
154 if (loc !=
tree_.end()) {
155 return loc.operator->();
162 "Agent::FlowEvent",
"Agent::FlowUpdate");
167 std::scoped_lock lock(
mutex_);
172 std::scoped_lock lock(
mutex_);
178 "Agent::FlowEvent",
"Agent::FlowUpdate");
187 std::scoped_lock lock(
mutex_);
192 std::scoped_lock lock(
mutex_);
196 Tree::iterator loc =
tree_.upper_bound(*(entry_ptr.get()));
197 if (loc !=
tree_.end()) {
198 return loc.operator->();
206 std::scoped_lock lock(
mutex_);
208 Tree::iterator it =
tree_.lower_bound(*entry);
209 if (it !=
tree_.end()) {
210 return (it.operator->());
216 std::scoped_lock lock(
mutex_);
217 Tree::iterator it =
tree_.begin();
218 if (it ==
tree_.end()) {
221 return it.operator->();
227 std::scoped_lock lock(
mutex_);
229 Tree::const_iterator it =
tree_.iterator_to(*entry);
231 if (it !=
tree_.end()) {
232 return const_cast<DBEntry *
>(it.operator->());
virtual std::string ToString() const =0
bool is_state_empty(DBTablePartBase *tpart)
void set_table_partition(DBTablePartBase *tpart)
void OnTableChange(DBTablePartBase *tpart)
virtual void RetryDelete()
virtual void AddRemoveCallback(const DBEntryBase *entry, bool add) const
void Notify(DBEntryBase *entry)
void Delete(DBEntryBase *)
virtual void Change(DBEntry *entry)
void Process(DBClient *client, DBRequest *req)
virtual void Add(DBEntry *entry)
void RemoveWithoutDelete(DBEntry *entry)
DBEntry * FindNext(const DBRequestKey *key)
DBEntry * FindInternal(const DBEntry *entry)
DBEntry * FindNoLock(const DBEntry *entry)
DBTablePartition(DBTable *parent, int index)
virtual DBEntry * GetNext(const DBEntryBase *entry)
void AddWithoutAlloc(DBEntry *entry)
virtual DBEntry * lower_bound(const DBEntryBase *entry)
DBEntry * Find(const DBEntry *entry)
virtual void Remove(DBEntryBase *entry)
virtual DBEntry * GetFirst()
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *key) const =0
virtual void Input(DBTablePartition *tbl_partition, DBClient *client, DBRequest *req)
DBPartition * GetPartition(int index)
#define LOG(_Level, _Msg)
#define CHECK_CONCURRENCY(...)