OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ifmap_graph_walker.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __ctrlplane__ifmap_graph_walker__
6 #define __ctrlplane__ifmap_graph_walker__
7 
8 #include "base/bitset.h"
9 #include "base/queue_task.h"
10 
11 class DBGraph;
12 class DBGraphEdge;
13 class DBGraphVertex;
14 class IFMapExporter;
15 class IFMapNode;
16 class IFMapLink;
17 class IFMapNodeState;
18 class IFMapState;
19 class TaskTrigger;
21 
22 // Computes the interest graph for the ifmap clients (i.e. vnc agent).
24 public:
25  typedef std::set<IFMapState *> ReachableNodesSet;
26  typedef ReachableNodesSet::const_iterator Rns_citer;
27  typedef std::vector<ReachableNodesSet *> ReachableNodesTracker;
28 
29  IFMapGraphWalker(DBGraph *graph, IFMapExporter *exporter);
31 
32  // When a link is added, for each interest bit, find the corresponding
33  // source node and walk the graph constructing the respective interest
34  // list.
35  void LinkAdd(IFMapLink *link, IFMapNode *lnode, const BitSet &lhs,
36  IFMapNode *rnode, const BitSet &rhs);
37  void LinkRemove(const BitSet &bset);
38 
39  bool FilterNeighbor(IFMapNode *lnode, IFMapLink *link);
41  void ResetLinkDeleteClients(const BitSet &bset);
42 
43 private:
44  static const int kMaxLinkDeleteWalks = 1;
45 
46  void ProcessLinkAdd(IFMapNode *lnode, IFMapNode *rnode, const BitSet &bset);
47  void JoinVertex(DBGraphVertex *vertex, const BitSet &bset);
48  void NotifyEdge(DBGraphEdge *edge, const BitSet &bset);
49  void RecomputeInterest(DBGraphVertex *vertex, int bit);
50  void CleanupInterest(int client_index, IFMapNode *node,
51  IFMapNodeState *state);
52  void AddNodesToWhitelist();
53  void AddLinksToWhitelist();
54  bool LinkDeleteWalk();
55  void LinkDeleteWalkBatchEnd(const BitSet &done_set);
56  void OrLinkDeleteClients(const BitSet &bset);
57  void AddNewReachableNodesTracker(int client_index);
58  void DeleteNewReachableNodesTracker(int client_index);
59  void UpdateNewReachableNodesTracker(int client_index, IFMapState *state);
60  void OldReachableNodesCleanupInterest(int client_index);
61  void NewReachableNodesCleanupInterest(int client_index);
62 
65  boost::scoped_ptr<TaskTrigger> link_delete_walk_trigger_;
66  std::unique_ptr<IFMapTypenameWhiteList> traversal_white_list_;
70 };
71 
72 #endif /* defined(__ctrlplane__ifmap_graph_walker__) */
void OldReachableNodesCleanupInterest(int client_index)
void NotifyEdge(DBGraphEdge *edge, const BitSet &bset)
void CleanupInterest(int client_index, IFMapNode *node, IFMapNodeState *state)
const IFMapTypenameWhiteList & get_traversal_white_list() const
void AddNewReachableNodesTracker(int client_index)
static const int kMaxLinkDeleteWalks
void RecomputeInterest(DBGraphVertex *vertex, int bit)
void JoinVertex(DBGraphVertex *vertex, const BitSet &bset)
std::unique_ptr< IFMapTypenameWhiteList > traversal_white_list_
void ResetLinkDeleteClients(const BitSet &bset)
boost::scoped_ptr< TaskTrigger > link_delete_walk_trigger_
void UpdateNewReachableNodesTracker(int client_index, IFMapState *state)
ReachableNodesTracker new_reachable_nodes_tracker_
void NewReachableNodesCleanupInterest(int client_index)
void ProcessLinkAdd(IFMapNode *lnode, IFMapNode *rnode, const BitSet &bset)
bool FilterNeighbor(IFMapNode *lnode, IFMapLink *link)
void LinkAdd(IFMapLink *link, IFMapNode *lnode, const BitSet &lhs, IFMapNode *rnode, const BitSet &rhs)
IFMapExporter * exporter_
void DeleteNewReachableNodesTracker(int client_index)
IFMapGraphWalker(DBGraph *graph, IFMapExporter *exporter)
void LinkDeleteWalkBatchEnd(const BitSet &done_set)
std::set< IFMapState * > ReachableNodesSet
Definition: bitset.h:17
void AddLinksToWhitelist()
void LinkRemove(const BitSet &bset)
std::vector< ReachableNodesSet * > ReachableNodesTracker
ReachableNodesSet::const_iterator Rns_citer
void OrLinkDeleteClients(const BitSet &bset)