Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/consumertable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ConsumerTable::ConsumerTable(DBConnector *db, string tableName) :
catch (...)
{
delete m_subscribe;
m_subscribe = NULL;
}
}

Expand Down
12 changes: 6 additions & 6 deletions common/scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace swss {
#define APPL_DB 0
#define ASIC_DB 1

#define APP_PORT_TABLE_NAME "PORT_TABLE"
#define APP_VLAN_TABLE_NAME "VLAN_TABLE"
#define APP_LAG_TABLE_NAME "LAG_TABLE"
#define APP_INTF_TABLE_NAME "INTF_TABLE"
#define APP_NEIGH_TABLE_NAME "NEIGH_TABLE"
#define APP_ROUTE_TABLE_NAME "ROUTE_TABLE"
#define APP_PORT_TABLE_NAME "PORT_TABLE"
#define APP_VLAN_TABLE_NAME "VLAN_TABLE"
#define APP_LAG_TABLE_NAME "LAG_TABLE"
#define APP_INTF_TABLE_NAME "INTF_TABLE"
#define APP_NEIGH_TABLE_NAME "NEIGH_TABLE"
#define APP_ROUTE_TABLE_NAME "ROUTE_TABLE"

#define IPV4_NAME "IPv4"
#define IPV6_NAME "IPv6"
Expand Down
19 changes: 16 additions & 3 deletions common/select.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <algorithm>
#include "common/selectable.h"
#include "common/logger.h"
#include "common/select.h"
#include <stdio.h>
#include <sys/time.h>
Expand All @@ -8,9 +10,20 @@ using namespace std;

namespace swss {

void Select::addSelectable(Selectable *c)
void Select::addSelectable(Selectable *selectable)
{
m_objects.push_back(c);
if(find(m_objects.begin(), m_objects.end(), selectable) != m_objects.end()) {
SWSS_LOG_WARN("Selectable:%p already been added to the list, ignoring.", selectable);
return;
}
m_objects.push_back(selectable);
}

void Select::addSelectables(vector<Selectable *> selectables)
{
for(auto it : selectables) {
addSelectable(it);
}
}

void Select::addFd(int fd)
Expand All @@ -28,7 +41,7 @@ int Select::select(Selectable **c, int *fd, unsigned int timeout)
FD_ZERO(&fs);
*c = NULL;
*fd = 0;
if (timeout != std::numeric_limits<unsigned int>::max())
if (timeout != numeric_limits<unsigned int>::max())
pTimeout = &t;

/* Checking caching from reader */
Expand Down
6 changes: 3 additions & 3 deletions common/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Select
{
public:
/* Add object for select */
void addSelectable(Selectable *c);
void addSelectables(std::vector<Selectable *> selectables);
void addSelectable(Selectable *selectable);

/* Add file-descriptor for select */
void addFd(int fd);
Expand All @@ -28,8 +29,7 @@ class Select
ERROR = 2,
TIMEOUT = 3
};
int select(Selectable **c, int *fd,
unsigned int timeout = std::numeric_limits<unsigned int>::max());
int select(Selectable **c, int *fd, unsigned int timeout = std::numeric_limits<unsigned int>::max());

private:
/* Create a new redisContext, SELECT DB and SUBSRIBE */
Expand Down
5 changes: 5 additions & 0 deletions common/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Table::Table(DBConnector *db, string tableName) :
{
}

std::string Table::getTableName()const
{
return m_tableName;
}

string Table::getKeyName(string key)
{
return m_tableName + ':' + key;
Expand Down
2 changes: 1 addition & 1 deletion common/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class Table {
void delField(std::string key, std::string field);

virtual ~Table();
std::string getTableName()const;

protected:
/* Return the actual key name as a comibation of tableName:key */
std::string getKeyName(std::string key);

std::string getKeyQueueTableName();
std::string getValueQueueTableName();
std::string getOpQueueTableName();
Expand Down