Skip to content

Commit

Permalink
Merge "Scaling changes for introspect."
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 16, 2015
2 parents 4c517db + 2e4276c commit 2185ac1
Show file tree
Hide file tree
Showing 12 changed files with 490 additions and 161 deletions.
4 changes: 4 additions & 0 deletions src/db/db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ DBTableBase *DB::FindTable(const string &name) {
return NULL;
}

DB::iterator DB::FindTableIter(const string &name) {
return tables_.find(name);
}

void DB::AddTable(DBTableBase *tbl_base) {
pair<TableMap::iterator, bool> result =
tables_.insert(make_pair(tbl_base->name(), tbl_base));
Expand Down
1 change: 1 addition & 0 deletions src/db/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class DB {
// Table creation.
DBTableBase *CreateTable(const std::string &name);
DBTableBase *FindTable(const std::string &name);
iterator FindTableIter(const std::string &name);
void RemoveTable(DBTableBase *tbl_base);

// Table walker
Expand Down
12 changes: 12 additions & 0 deletions src/db/db_table_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ DBEntry *DBTablePartition::Find(const DBRequestKey *key) {
return NULL;
}

DBEntry *DBTablePartition::FindNext(const DBRequestKey *key) {
tbb::mutex::scoped_lock lock(mutex_);
DBTable *table = static_cast<DBTable *>(parent());
std::auto_ptr<DBEntry> entry_ptr = table->AllocEntry(key);

Tree::iterator loc = tree_.upper_bound(*(entry_ptr.get()));
if (loc != tree_.end()) {
return loc.operator->();
}
return NULL;
}

// Returns the matching entry or next in lex order
DBEntry *DBTablePartition::lower_bound(const DBEntryBase *key) {
const DBEntry *entry = static_cast<const DBEntry *>(key);
Expand Down
4 changes: 4 additions & 0 deletions src/db/db_table_partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class DBTablePartition : public DBTablePartBase {
void Process(DBClient *client, DBRequest *req);
// Returns the matching route or next in lex order
virtual DBEntry *lower_bound(const DBEntryBase *entry);

// Returns the next route (Doesn't search). Threaded walk
virtual DBEntry *GetNext(const DBEntryBase *entry);

Expand All @@ -102,6 +103,9 @@ class DBTablePartition : public DBTablePartBase {
// Find DB Entry. Get key from from argument
DBEntry *Find(const DBRequestKey *key);

// Find the next in lex order
DBEntry *FindNext(const DBRequestKey *key);

DBTable *table();
size_t size() const { return tree_.size(); }

Expand Down
1 change: 1 addition & 0 deletions src/ifmap/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ except_env.CppEnableExceptions()
except_env.Append(CPPPATH = env['TOP'])

SandeshGenFiles = env.SandeshGenCpp('ifmap_server_show.sandesh')
SandeshGenFiles += env.SandeshGenOnlyCpp('ifmap_server_show_internal.sandesh')
SandeshGenFiles += env.SandeshGenCpp('ifmap_log.sandesh')
SandeshGenSrcs = env.ExtractCpp(SandeshGenFiles)

Expand Down
9 changes: 9 additions & 0 deletions src/ifmap/ifmap_link_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ IFMapLink *IFMapLinkTable::FindLink(const string &name) {
return static_cast<IFMapLink *>(partition->Find(&key));
}

IFMapLink *IFMapLinkTable::FindNextLink(const string &name) {

DBTablePartition *partition =
static_cast<DBTablePartition *>(GetTablePartition(0));
RequestKey key;
key.name = name;
return static_cast<IFMapLink *>(partition->FindNext(&key));
}

void IFMapLinkTable::DeleteLink(DBGraphEdge *edge) {
IFMapLink *link = static_cast<IFMapLink *>(edge);
link->set_last_change_at_to_now();
Expand Down
1 change: 1 addition & 0 deletions src/ifmap/ifmap_link_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class IFMapLinkTable : public DBTable {
static DBTable *CreateTable(DB *db, const std::string &name,
DBGraph *graph);
IFMapLink *FindLink(const std::string &name);
IFMapLink *FindNextLink(const std::string &name);

protected:
void DeleteLink(DBGraphEdge *edge);
Expand Down

0 comments on commit 2185ac1

Please sign in to comment.