24 bool was_empty = change_list_.empty();
25 change_list_.push_back(*entry);
27 DB *db = parent()->database();
43 for (
int i = 0; ((i < kMaxIterations) && !change_list_.empty()); ++i) {
45 change_list_.pop_front();
47 parent()->RunNotify(
this, entry);
64 if (!change_list_.empty()) {
65 DB *db = parent()->database();
74 if (parent_->HasListeners()) {
80 change_list_.erase(change_list_.iterator_to(*entry));
93 table->
Input(
this, client, req);
97 tbb::mutex::scoped_lock lock(
mutex_);
98 std::pair<Tree::iterator, bool> ret =
tree_.insert(*entry);
106 tbb::mutex::scoped_lock lock(
mutex_);
111 tbb::mutex::scoped_lock lock(
mutex_);
115 bool success =
tree_.erase(*entry);
117 LOG(FATAL,
"ABORT: DB node erase failed for table " +
parent()->name());
118 LOG(FATAL,
"Invalid node " + db_entry->
ToString());
130 tbb::mutex::scoped_lock lock(
mutex_);
131 tree_.insert(*entry);
138 tbb::mutex::scoped_lock lock(
mutex_);
139 bool success =
tree_.erase(*entry);
141 LOG(FATAL,
"ABORT: DB node erase failed for table " +
parent()->name());
147 Tree::iterator loc =
tree_.find(*entry);
148 if (loc !=
tree_.end()) {
149 return loc.operator->();
155 Tree::const_iterator loc =
tree_.find(*entry);
156 if (loc !=
tree_.end()) {
157 return loc.operator->();
164 "Agent::FlowEvent",
"Agent::FlowUpdate");
169 tbb::mutex::scoped_lock lock(
mutex_);
174 tbb::mutex::scoped_lock lock(
mutex_);
180 "Agent::FlowEvent",
"Agent::FlowUpdate");
182 std::unique_ptr<DBEntry> entry_ptr = table->
AllocEntry(key);
188 std::unique_ptr<DBEntry> entry_ptr = table->
AllocEntry(key);
189 tbb::mutex::scoped_lock lock(
mutex_);
194 tbb::mutex::scoped_lock lock(
mutex_);
196 std::unique_ptr<DBEntry> entry_ptr = table->
AllocEntry(key);
198 Tree::iterator loc =
tree_.upper_bound(*(entry_ptr.get()));
199 if (loc !=
tree_.end()) {
200 return loc.operator->();
208 tbb::mutex::scoped_lock lock(
mutex_);
210 Tree::iterator it =
tree_.lower_bound(*entry);
211 if (it !=
tree_.end()) {
212 return (it.operator->());
218 tbb::mutex::scoped_lock lock(
mutex_);
219 Tree::iterator it =
tree_.begin();
220 if (it ==
tree_.end()) {
223 return it.operator->();
229 tbb::mutex::scoped_lock lock(
mutex_);
231 Tree::const_iterator it =
tree_.iterator_to(*entry);
233 if (it !=
tree_.end()) {
234 return const_cast<DBEntry *
>(it.operator->());
DBEntry * FindInternal(const DBEntry *entry)
DBTablePartition(DBTable *parent, int index)
void Process(DBClient *client, DBRequest *req)
DBEntry * FindNoLock(const DBEntry *entry)
DBEntry * Find(const DBEntry *entry)
virtual void RetryDelete()
virtual DBEntry * GetNext(const DBEntryBase *entry)
void Delete(DBEntryBase *)
virtual void Change(DBEntry *entry)
DBEntry * FindNext(const DBRequestKey *key)
virtual void AddRemoveCallback(const DBEntryBase *entry, bool add) const
#define CHECK_CONCURRENCY(...)
void set_table_partition(DBTablePartBase *tpart)
void RemoveWithoutDelete(DBEntry *entry)
bool is_state_empty(DBTablePartBase *tpart)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *key) const =0
virtual std::string ToString() const =0
virtual DBEntry * lower_bound(const DBEntryBase *entry)
#define LOG(_Level, _Msg)
void AddWithoutAlloc(DBEntry *entry)
virtual DBEntry * GetFirst()
virtual void Add(DBEntry *entry)
void Notify(DBEntryBase *entry)
virtual void Remove(DBEntryBase *entry)
DBPartition * GetPartition(int index)
virtual void Input(DBTablePartition *tbl_partition, DBClient *client, DBRequest *req)
void OnTableChange(DBTablePartBase *tpart)