OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ifmap_agent_table.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
6 
7 #include <boost/algorithm/string.hpp>
8 #include <boost/bind.hpp>
9 #include <boost/format.hpp>
10 #include "base/logging.h"
11 #include "db/db.h"
12 #include "db/db_graph.h"
13 #include "db/db_table_partition.h"
15 #include "ifmap/ifmap_node.h"
16 #include "ifmap/ifmap_link.h"
17 #include "ifmap/ifmap_agent_types.h"
18 
19 using namespace std;
20 
22 IFMapAgentTraceBuf(SandeshTraceBufferCreate("IFMapAgentTrace", 1000));
23 
24 IFMapAgentTable::IFMapAgentTable(DB *db, const string &name, DBGraph *graph)
25  : IFMapTable(db, name, graph), pre_filter_(NULL) {
26 }
27 
28 unique_ptr<DBEntry> IFMapAgentTable::AllocEntry(const DBRequestKey *key) const {
29  unique_ptr<DBEntry> entry(
30  new IFMapNode(const_cast<IFMapAgentTable *>(this)));
31  entry->SetKey(key);
32  return entry;
33 }
34 
36 
37  IFMapTable *table = FindTable(db, key->id_type);
38  if (!table) {
39  return NULL;
40  }
41 
42  unique_ptr<DBEntry> entry(new IFMapNode(table));
43  entry->SetKey(key);
44  IFMapNode *node = static_cast<IFMapNode *>(table->Find(entry.get()));
45  return node;
46 }
47 
48 
49 IFMapAgentTable* IFMapAgentTable::TableFind(const string &node_name) {
50  string name = node_name;
51  std::replace(name.begin(), name.end(), '-', '_');
52  name = "__ifmap__." + name + ".0";
53  IFMapAgentTable *table =
54  static_cast<IFMapAgentTable *>(database()->FindTable(name));
55  return table;
56 }
57 
59  unique_ptr<DBEntry> key(AllocEntry(request));
60  IFMapNode *node = static_cast<IFMapNode *>(Find(key.get()));
61  return node;
62 }
63 
65 
66  IFMapObject *obj;
67 
68  if (node != NULL) {
69  /* If delete marked, clear it now */
70  if (node->IsDeleted()) {
71  node->ClearDelete();
72  graph()->AddNode(node);
73  }
74 
75  obj = node->GetObject();
76  assert(obj);
77  //We dont accept lesser sequence number updates
78  assert(obj->sequence_number() <= req->id_seq_num);
79 
80  node->Remove(obj);
81 
82  } else {
83  unique_ptr<DBEntry> key(AllocEntry(req));
84  node = const_cast<IFMapNode *>(
85  static_cast<const IFMapNode *>(key.release()));
86  DBTablePartition *partition =
87  static_cast<DBTablePartition *>(GetTablePartition(0));
88  partition->Add(node);
89  graph()->AddNode(node);
90  }
91 
92  return node;
93 }
94 
95 // A node is deleted. Move all links for the node to defer-list
97 
98  IFMapNode *right;
99  DBGraphEdge *edge;
100 
101  IFMapAgentLinkTable *ltable = static_cast<IFMapAgentLinkTable *>
103  assert(ltable != NULL);
104 
106  bool origin_exists;
107  uint64_t seq;
108  for (iter = node->edge_list_begin(graph());
109  iter != node->edge_list_end(graph());) {
110  edge = iter.operator->();
111  IFMapLink *l = static_cast<IFMapLink *>(edge);
112  right = static_cast<IFMapNode *>(iter.target());
113  iter++;
114  seq = l->sequence_number(IFMapOrigin::UNKNOWN, &origin_exists);
115  assert(origin_exists);
116  // Create both the request keys
117  unique_ptr <IFMapAgentLinkTable::RequestKey> req_key (new IFMapAgentLinkTable::RequestKey);
118  req_key->left_key.id_name = node->name();
119  req_key->left_key.id_type = node->table()->Typename();
120  req_key->left_key.id_seq_num = seq;
121 
122  req_key->right_key.id_name = right->name();
123  req_key->right_key.id_type = right->table()->Typename();
124  req_key->right_key.id_seq_num = seq;
125  req_key->metadata = l->metadata();
126 
127  DBRequest req;
129  req.key = std::move(req_key);
130 
131  //Add it to defer list
132  ltable->LinkDefAdd(&req);
133 
134  ltable->DelLink(node, right, edge);
135  }
136 }
137 
139 
140 
141  if ((node->HasAdjacencies(graph()) == true)) {
142  HandlePendingLinks(node);
143  }
144 
145  //Now there should not be any more adjacencies
146  assert((node->HasAdjacencies(graph()) == false));
147 
148  DBTablePartition *partition =
149  static_cast<DBTablePartition *>(GetTablePartition(0));
150  graph()->RemoveNode(node);
151  partition->Delete(node);
152 }
153 
155  DBTablePartition *partition =
156  static_cast<DBTablePartition *>(GetTablePartition(0));
157  partition->Change(node);
158 }
159 
160 // Process link-defer list based for the request.
161 // If request is add, create left->right and right-left defer nodes
162 // If request is delete, remove left->right and right->left defer nodes
163 // The sequence number is valid only in the DeferrendNode entry
165  RequestKey *key = static_cast<RequestKey *>(request->key.get());
166 
167  std::list<DeferredNode>::iterator it;
168 
169  std::list<DeferredNode> *left = NULL;
170  LinkDefMap::iterator left_it = link_def_map_.find(key->left_key);
171  if (link_def_map_.end() != left_it)
172  left = left_it->second;
173 
174  std::list<DeferredNode> *right = NULL;
175  LinkDefMap::iterator right_it = link_def_map_.find(key->right_key);
176  if (link_def_map_.end() != right_it)
177  right = right_it->second;
178 
179  if (request->oper == DBRequest::DB_ENTRY_DELETE) {
180  //We need to delete the old sequence links as well
181  // remove left->right entry
182  if (left) {
183  for(it = left->begin(); it != left->end(); it++) {
184  if (((*it).node_key.id_type == key->right_key.id_type) &&
185  ((*it).node_key.id_name == key->right_key.id_name)) {
186  left->erase(it);
187  break;
188  }
189  }
190  RemoveDefListEntry(&link_def_map_, left_it, NULL);
191  }
192 
193  // remove right->left entry
194  if (right) {
195  for(it = right->begin(); it != right->end(); it++) {
196  if (((*it).node_key.id_type == key->left_key.id_type) &&
197  ((*it).node_key.id_name == key->left_key.id_name)) {
198  right->erase(it);
199  break;
200  }
201  }
202  RemoveDefListEntry(&link_def_map_, right_it, NULL);
203  }
204 
205  return;
206  }
207 
208  bool push_left = true;
209 
210  // Add/Update left->right entry
211  if (left) {
212  // If list already contains, just update the seq number
213  for(it = left->begin(); it != left->end(); it++) {
214  if (((*it).node_key.id_type == key->right_key.id_type) &&
215  ((*it).node_key.id_name == key->right_key.id_name)) {
216  (*it).node_key.id_seq_num = key->right_key.id_seq_num;
217  (*it).link_metadata = key->metadata;
218  push_left = false;
219  break;
220  }
221  }
222  } else {
223  left = new std::list<DeferredNode>();
224  link_def_map_[key->left_key] = left;
225  }
226 
227  bool push_right = true;
228  // Add/Update right->left entry
229  if (right) {
230  // If list already contains, just update the seq number
231  for(it = right->begin(); it != right->end(); it++) {
232  if (((*it).node_key.id_type == key->left_key.id_type) &&
233  ((*it).node_key.id_name == key->left_key.id_name)) {
234  (*it).node_key.id_seq_num = key->left_key.id_seq_num;
235  (*it).link_metadata = key->metadata;
236  push_right = false;
237  break;
238  }
239  }
240  } else {
241  right = new std::list<DeferredNode>();
242  link_def_map_[key->right_key] = right;
243  }
244 
245  // Add it to the end of the list
246  struct DeferredNode dn;
247  dn.link_metadata = key->metadata;
248  if (push_left) {
249  dn.node_key = key->right_key;
250  left->push_back(dn);
251  }
252  if (push_right) {
253  dn.node_key = key->left_key;
254  right->push_back(dn);
255  }
256  return;
257 }
258 
260  DBRequest *request) {
261  RequestKey *key = static_cast<RequestKey *>(request->key.get());
262  IFMapAgentTable *table = NULL;
263  struct IFMapAgentData *req_data;
264  IFMapObject *obj;
265 
266  table = TableFind(key->id_type);
267  if (!table) {
269  "Table " + key->id_type + " not found");
270  return;
271  }
272 
273  IFMapNode *node = EntryLookup(key);
274  if (table->pre_filter_) {
275  DBRequest::DBOperation old_oper = request->oper;
276  if (table->pre_filter_(table, node, request) == false) {
278  "Node " + key->id_name + " neglected as filter"
279  + "suppressed");
280  return;
281  }
282  if ((old_oper != DBRequest::DB_ENTRY_DELETE) &&
283  (request->oper == DBRequest::DB_ENTRY_DELETE)) {
285  "Node " + key->id_name + "ID_PERMS Null");
286  }
287  }
288 
289  if (request->oper == DBRequest::DB_ENTRY_DELETE) {
290  if (node == NULL) {
292  "Node " + key->id_name + " not found in Delete");
293  return;
294  }
295 
296  if (node->IsDeleted()) {
298  "Node " + key->id_name + " already deleted");
299  return;
300  }
301 
302  obj = node->GetObject();
303  //We dont accept lesser sequence number updates
304  assert(obj->sequence_number() <= key->id_seq_num);
305 
306  //Upate the sequence number even for deletion of node
307  obj->set_sequence_number(key->id_seq_num);
308  DeleteNode(node);
309  return;
310  }
311 
312  if (request->oper == DBRequest::DB_ENTRY_NOTIFY) {
313  if (node) {
314  partition->Notify(node);
315  }
316  return;
317  }
318 
319  node = EntryLocate(node, key);
320  assert(node);
321 
322  //Get the data from request key and notify oper tables
323  req_data = static_cast<struct IFMapAgentData *>(request->data.get());
324  obj = static_cast<IFMapObject *>(req_data->content.release());
325 
326  //Set the sequence number of the object
327  obj->set_sequence_number(key->id_seq_num);
328 
329  node->Insert(obj);
330  NotifyNode(node);
331 
332  IFMapAgentLinkTable *link_table = static_cast<IFMapAgentLinkTable *>(
334  link_table->EvalDefLink(key);
335 }
336 
338  assert(!HasListeners());
339  DBTablePartition *partition = static_cast<DBTablePartition *>(
340  GetTablePartition(0));
341  IFMapNode *next = NULL;
342  for (IFMapNode *node = static_cast<IFMapNode *>(partition->GetFirst());
343  node != NULL; node = next) {
344  next = static_cast<IFMapNode *>(partition->GetNext(node));
345  if (node->IsDeleted()) {
346  continue;
347  }
348  graph()->RemoveNode(node);
349  partition->Delete(node);
350  }
351 }
352 
353 
354 // Agent link table routines
356  const std::string &metadata) {
357 
358  IFMapLinkTable *table = static_cast<IFMapLinkTable *>(
360  assert(table != NULL);
361  IFMapLink *link = table->FindLink(metadata, left, right);
362  return (link ? (link->IsDeleted() ? NULL : link) : NULL);
363 }
364 
366  const std::string &metadata,
367  uint64_t seq) {
368 
369  IFMapLinkTable *table = static_cast<IFMapLinkTable *>(
371  assert(table != NULL);
372 
373  IFMapLink *link = table->AddLink(left, right, metadata, seq,
375  graph()->Link(left, right, (DBGraphEdge *)link);
376 }
377 
379  IFMapAgentLinkTable *table = static_cast<IFMapAgentLinkTable *>(
381  assert(table != NULL);
382  table->DeleteLink(static_cast<IFMapLink *>(edge));
383 }
384 
385 IFMapAgentLinkTable::IFMapAgentLinkTable(DB *db, const string &name, DBGraph *graph)
386  : IFMapLinkTable(db, name, graph) {
387 }
388 
389 DBTable *IFMapAgentLinkTable::CreateTable(DB *db, const string &name,
390  DBGraph *graph) {
391  IFMapAgentLinkTable *table = new IFMapAgentLinkTable(db, name, graph);
392  table->Init();
393  return table;
394 }
395 
396 
399  boost::bind(&IFMapAgentLinkTable::CreateTable, _1, _2, graph));
401 }
402 
404  DBRequest *req) {
405 
406  RequestKey *key = static_cast<RequestKey *>(req->key.get());
407 
408  IFMapNode *left;
410  if (!left) {
412  key->left_key.id_type + ":" + key->left_key.id_name +
413  " not present for link to " + key->right_key.id_type +
414  ":" + key->right_key.id_name);
415  LinkDefAdd(req);
416  return;
417  }
418 
419  IFMapNode *right;
421  if (!right) {
423  key->right_key.id_type + " : " + key->right_key.id_name +
424  " not present for link to " + key->left_key.id_type + " : " +
425  key->left_key.id_name);
426  LinkDefAdd(req);
427  return;
428  }
429 
430  if (left->IsDeleted()) {
432  "Adding Link" + key->left_key.id_type + ":" +
433  key->left_key.id_name + "->" + key->right_key.id_type +
434  ":" + key->right_key.id_name + " to defer "
435  "list as left is deleted marked");
436  LinkDefAdd(req);
437  return;
438  }
439 
440  if (right->IsDeleted()) {
442  "Adding Link" + key->left_key.id_type + ":" +
443  key->left_key.id_name + "->" + key->right_key.id_type +
444  ":" + key->right_key.id_name + " to defer "
445  "list as right is deleted marked");
446  LinkDefAdd(req);
447  return;
448  }
449 
450  IFMapObject *obj = left->GetObject();
451  if (obj->sequence_number() < key->left_key.id_seq_num) {
453  "IFMap Link " + left->name() + right->name() +
454  " with wrong seq number");
455  LinkDefAdd(req);
456  return;
457  }
458 
459  obj = right->GetObject();
460  if (obj->sequence_number() < key->left_key.id_seq_num) {
462  "IFMap Link " + left->name() + right->name() +
463  " with wrong seq number");
464  LinkDefAdd(req);
465  return;
466  }
467 
468  DBGraphEdge *link = FindLink(left, right, key->metadata);
469 
470  if (req->oper == DBRequest::DB_ENTRY_ADD_CHANGE) {
471  if (link == NULL) {
472  AddLink(left, right, key->metadata, key->left_key.id_seq_num);
473  } else {
475  IFMapLink *l = static_cast<IFMapLink *>(link);
476  l->UpdateProperties(origin, key->left_key.id_seq_num);
477  }
478  } else {
479  if (link == NULL) {
480  return;
481  }
482  DelLink(left, right, link);
483  }
484 }
485 
487  (LinkDefMap *map, LinkDefMap::iterator &map_it,
488  std::list<DeferredNode>::iterator *list_it) {
489 
490  std::list<DeferredNode> *list = map_it->second;
491  if (list_it) {
492  list->erase(*list_it);
493  }
494 
495  if (list->size()) {
496  return false;
497  }
498  map->erase(map_it);
499  delete list;
500  return true;
501 }
502 
503 // For every link there are 2 entries,
504 // left->right
505 // right->left
506 //
507 // If both left and right node are available, remove the entries and try to
508 // add the link
510  LinkDefMap::iterator link_defmap_it = link_def_map_.find(*key);
511  if (link_def_map_.end() == link_defmap_it)
512  return;
513 
514  std::list<DeferredNode> *left_list = link_defmap_it->second;
515  std::list<DeferredNode>::iterator left_it, left_list_entry;
516  for(left_it = left_list->begin(); left_it != left_list->end();) {
517  left_list_entry = left_it++;
518 
519  // If link seq is older, dont consider the link.
520  if ((*left_list_entry).node_key.id_seq_num < key->id_seq_num)
521  continue;
522 
523  // Skip if right-node is not yet present
525  &((*left_list_entry).node_key));
526  if (!node)
527  continue;
528 
529  //If the other end of the node is not from active control node,
530  //dont consider the link
531  IFMapObject *obj = node->GetObject();
532  if (obj->sequence_number() < key->id_seq_num)
533  continue;
534 
535 
536  // left->right entry found defer-list. Find the right->left entry
537  LinkDefMap::iterator right_defmap_it =
538  link_def_map_.find((*left_list_entry).node_key);
539  assert(link_def_map_.end() != right_defmap_it);
540 
541  std::list<DeferredNode> *right_list = right_defmap_it->second;
542  std::list<DeferredNode>::iterator right_it, right_list_entry;
543  bool removed_something = false;
544  for(right_it = right_list->begin(); right_it !=
545  right_list->end(); right_it++) {
546 
547  // If link seq is older, dont consider the link.
548  if ((*right_it).node_key.id_seq_num < key->id_seq_num)
549  continue;
550 
551  if ((*right_it).node_key.id_type == key->id_type &&
552  (*right_it).node_key.id_name == key->id_name) {
553  RemoveDefListEntry(&link_def_map_, right_defmap_it, &right_it);
554  removed_something = true;
555  break;
556  }
557  }
558 
559  //We should have removed something in the above iteration
560  assert(removed_something);
561 
562  //Remove from deferred list before enqueing
563  unique_ptr <RequestKey> req_key (new RequestKey);
564  req_key->left_key = *key;
565  req_key->right_key = (*left_list_entry).node_key;
566  req_key->metadata = (*left_list_entry).link_metadata;
567  // Dont delete left_list_entry. Its passed in req structure
568  left_list->erase(left_list_entry);
569 
570  DBRequest req;
571  req.key = std::move(req_key);
573  Enqueue(&req);
574  }
575 
576  // If list does not have any entries, delete the list
577  RemoveDefListEntry(&link_def_map_, link_defmap_it, NULL);
578 }
579 
581  std::list<DeferredNode> *ent;
582  std::list<DeferredNode>::iterator it, list_entry;
583  IFMapAgentLinkTable::LinkDefMap::iterator dlist_it, temp;
584 
585  for(dlist_it = link_def_map_.begin(); dlist_it != link_def_map_.end(); ) {
586  temp = dlist_it++;
587  ent = temp->second;
588  for(it = ent->begin(); it != ent->end();) {
589  list_entry = it++;
590 
591  //Delete the deferred link if it is old seq
592  if ((*list_entry).node_key.id_seq_num < seq) {
594  &list_entry) == true) {
595  //The list has been deleted. Move to the next map
596  //entry
597  break;
598  }
599  }
600  }
601  }
602 }
603 
604 //Stale Cleaner functionality
606 public:
607 
608  IFMapAgentStaleCleanerWorker(DB *db, DBGraph *graph, uint64_t seq):
609  Task(TaskScheduler::GetInstance()->GetTaskId("db::DBTable"), 0),
610  db_(db), graph_(graph), seq_(seq) {
611  }
612 
613  bool Run() {
615  "IFMap Config Audit start:");
616  //Handle the links first
619  e_iter != graph_->edge_list_end(); e_iter = e_next) {
620 
621  const DBGraph::DBEdgeInfo &tuple = *e_iter;
622 
623  e_next = ++e_iter;
624 
625  IFMapNode *lhs = static_cast<IFMapNode *>(boost::get<0>(tuple));
626  IFMapNode *rhs = static_cast<IFMapNode *>(boost::get<1>(tuple));
627  IFMapLink *link = static_cast<IFMapLink *>(boost::get<2>(tuple));
628  assert(link);
629 
630  bool exists = false;
631  IFMapLink::LinkOriginInfo origin_info =
632  link->GetOriginInfo(IFMapOrigin::UNKNOWN, &exists);
633  if (exists && (origin_info.sequence_number < seq_ )) {
634  IFMapAgentLinkTable *ltable = static_cast<IFMapAgentLinkTable *>(
637  origin_info.sequence_number, "Deleting Link between " +
638  lhs->name() + rhs->name());
639  ltable->DeleteLink(link);
640  }
641  }
642 
643  //Handle the vertices now
646  v_iter != graph_->vertex_list_end(); v_iter = v_next) {
647 
648  IFMapNode *node = static_cast<IFMapNode *>(v_iter.operator->());
649  v_next = ++v_iter;
650 
651  IFMapObject *obj = node->GetObject();
652  assert(obj);
653  if (obj->sequence_number() < seq_) {
654  IFMapAgentTable *table = static_cast<IFMapAgentTable *>(node->table());
656  "Deleting node " + node->name());
657  table->DeleteNode(node);
658  }
659  }
660 
661  //Handle deferred list
662  IFMapAgentLinkTable *table = static_cast<IFMapAgentLinkTable *>(
664  table->DestroyDefLink(seq_);
665 
666  return true;
667  }
668  std::string Description() const {
669  return "IFMapAgentStaleCleaner::IFMapAgentStaleCleanerWorker";
670  }
671 
672 private:
673  DB *db_;
675  uint64_t seq_;
676 };
677 
679 }
680 
682  db_(db), graph_(graph) {
683 }
684 
686  seq_ = seq;
689  sch->Enqueue(cleaner);
690  return false;
691 }
692 
694  IFMapLinkTable *table = static_cast<IFMapLinkTable *>(
696  table->Clear();
698 }
void EvalDefLink(IFMapTable::RequestKey *key)
edge_iterator edge_list_begin()
Definition: db_graph.cc:262
const DBGraph * graph() const
#define IFMAP_AGENT_TRACE(obj,...)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
Definition: task.h:178
virtual void Input(DBTablePartition *partition, DBClient *client, DBRequest *req)
void IFMapAgentLinkTable_Init(DB *db, DBGraph *graph)
void Remove(IFMapObject *obj)
Definition: ifmap_node.cc:58
PreFilterFn pre_filter_
DBTableBase * CreateTable(const std::string &name)
Definition: db.cc:99
IFMapNode * EntryLocate(IFMapNode *node, RequestKey *key)
bool IsDeleted() const
Definition: db_entry.h:49
virtual DBEntry * GetNext(const DBEntryBase *entry)
IFMapNode * EntryLookup(RequestKey *key)
std::map< IFMapTable::RequestKey, std::list< DeferredNode > *, comp > LinkDefMap
IFMapAgentLinkTable(DB *db, const std::string &name, DBGraph *graph)
std::unique_ptr< DBRequestData > data
Definition: db_table.h:49
virtual const char * Typename() const =0
bool Enqueue(DBRequest *req)
Definition: db_table.cc:194
static DBTable * CreateTable(DB *db, const std::string &name, DBGraph *graph)
IFMapTable * table()
Definition: ifmap_node.h:29
DB * database()
Definition: db_table.h:107
void DeleteLink(IFMapLink *link, const IFMapOrigin &origin)
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:18
void Delete(DBEntryBase *)
bool HasAdjacencies(DBGraph *graph) const
IFMapLink * FindLink(const std::string &metadata, IFMapNode *left, IFMapNode *right)
vertex_iterator vertex_list_begin()
Definition: db_graph.cc:293
bool Run()
Code to execute. Returns true if task is completed. Return false to reschedule the task...
virtual void Change(DBEntry *entry)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *key) const
vertex_iterator vertex_list_end()
Definition: db_graph.cc:297
edge_iterator edge_list_end()
Definition: db_graph.cc:266
IFMapLink * AddLink(IFMapNode *left, IFMapNode *right, const std::string &metadata, uint64_t sequence_number, const IFMapOrigin &origin)
Definition: db.h:24
IFMapTable::RequestKey right_key
void Init()
Definition: db_table.cc:387
void DestroyDefLink(uint64_t)
void AddNode(DBGraphVertex *entry)
Definition: db_graph.cc:30
uint64_t sequence_number()
Definition: ifmap_object.h:33
DBGraphVertex * target() const
void DelLink(IFMapNode *first, IFMapNode *second, DBGraphEdge *edge)
static TaskScheduler * GetInstance()
Definition: task.cc:547
void Enqueue(Task *task)
Enqueues a task for running. Starts task if all policy rules are met else puts task in waitq...
Definition: task.cc:636
IFMapLink * FindLink(IFMapNode *left, IFMapNode *right, const std::string &metadata)
std::unique_ptr< DBRequestKey > key
Definition: db_table.h:48
void Insert(IFMapObject *obj)
Definition: ifmap_node.cc:49
DBOperation oper
Definition: db_table.h:42
Definition: trace.h:220
void RemoveNode(DBGraphVertex *entry)
Definition: db_graph.cc:36
void DeleteNode(IFMapNode *node)
IFMapAgentStaleCleanerWorker(DB *db, DBGraph *graph, uint64_t seq)
void HandlePendingLinks(IFMapNode *)
const std::string & name() const
Definition: db_table.h:110
void ClearDelete()
Definition: db_entry.h:48
void set_sequence_number(uint64_t sequence_number)
Definition: ifmap_object.h:35
const std::string & name() const
Definition: ifmap_node.h:48
Edge Link(DBGraphVertex *lhs, DBGraphVertex *rhs, DBGraphEdge *link)
Definition: db_graph.cc:41
void NotifyNode(IFMapNode *node)
static void ClearTables(DB *db)
Definition: ifmap_table.cc:46
IFMapAgentTable(DB *db, const std::string &name, DBGraph *graph)
virtual DBTablePartBase * GetTablePartition(const DBRequestKey *key)
Definition: db_table.cc:436
IFMapObject * GetObject()
Definition: ifmap_node.cc:63
int GetTaskId() const
Definition: task.h:118
static IFMapTable * FindTable(DB *db, const std::string &element_type)
Definition: ifmap_table.cc:39
IFMapAgentStaleCleaner(DB *db, DBGraph *graph)
std::unique_ptr< IFMapObject > content
#define IFMAP_AGENT_LINK_DB_NAME
bool HasListeners() const
Definition: db_table.cc:234
IFMapTable::RequestKey left_key
DBEntry * Find(const DBEntry *entry)
Definition: db_table.cc:469
static IFMapNode * TableEntryLookup(DB *db, RequestKey *key)
edge_iterator edge_list_end(DBGraph *graph)
void AddLink(IFMapNode *left, IFMapNode *right, const std::string &metadata, uint64_t seq)
virtual DBEntry * GetFirst()
virtual void Add(DBEntry *entry)
IFMapAgentTable * TableFind(const std::string &node_name)
boost::tuple< DBGraphVertex *, DBGraphVertex *, DBGraphEdge * > DBEdgeInfo
Definition: db_graph.h:45
void Notify(DBEntryBase *entry)
virtual void Clear()
void LinkDefAdd(DBRequest *request)
Task is a wrapper over tbb::task to support policies.
Definition: task.h:86
bool RemoveDefListEntry(LinkDefMap *map, LinkDefMap::iterator &map_it, std::list< DeferredNode >::iterator *list_it)
SandeshTraceBufferPtr IFMapAgentTraceBuf
DBTableBase * FindTable(const std::string &name)
Definition: db.cc:68
SandeshTraceBufferPtr SandeshTraceBufferCreate(const std::string &buf_name, size_t buf_size, bool trace_enable=true)
Definition: sandesh_trace.h:46
edge_iterator edge_list_begin(DBGraph *graph)
static void RegisterFactory(const std::string &prefix, CreateFunction create_fn)
Definition: db.cc:24
virtual void Input(DBTablePartition *partition, DBClient *client, DBRequest *req)