Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DBInterface/SonicV2Connector in C++ #387

Merged
merged 37 commits into from
Oct 12, 2020

Conversation

qiluo-msft
Copy link
Contributor

@qiluo-msft qiluo-msft commented Sep 28, 2020

This is the first step for merging sonic-py-swsssdk into sonic-swss-common. The whole plan is roughly listed as below

What I did in this PR:

  1. Extract RedisContext class from DBConnector class
  2. Extract DBConnector methods: subscribe/psubscribe/publish/config_set
  3. Implement DBInterface/SonicV2Connector in C++ which deriving from python implementation in https://github.com/Azure/sonic-py-swsssdk/
    • maintain the interfaces through the SWIG wrapper functions
    • Add set_redis_kwargs for easy handling python kwargs.

@lgtm-com
Copy link

lgtm-com bot commented Sep 29, 2020

This pull request introduces 2 alerts when merging c193a6a into 3751c81 - view on LGTM.com

new alerts:

  • 2 for Inconsistent definition of copy constructor and assignment ('Rule of Two') #Closed

@qiluo-msft qiluo-msft changed the title Implement DBInterface in C++ Implement DBInterface/SonicV2Connector in C++ Oct 5, 2020
shi-su
shi-su previously approved these changes Oct 12, 2020
tests/test_redis_ut.py Outdated Show resolved Hide resolved
@qiluo-msft qiluo-msft merged commit 92a35d9 into sonic-net:master Oct 12, 2020
@qiluo-msft qiluo-msft deleted the qiluo/redisconn branch October 12, 2020 19:46
qiluo-msft added a commit to qiluo-msft/sonic-swss-common that referenced this pull request Nov 3, 2020
qiluo-msft added a commit that referenced this pull request Nov 4, 2020
qiluo-msft added a commit to sonic-net/sonic-snmpagent that referenced this pull request Nov 6, 2020
…IG wrapper of C++ implementation) in production code (#162)

This is the following step for merging sonic-py-swsssdk into sonic-swss-common sonic-net/sonic-swss-common#387

Note: Test code could still using old python implementation
qiluo-msft added a commit to sonic-net/sonic-utilities that referenced this pull request Nov 6, 2020
…IG wrapper of C++ implementation) in production code (#1217)

**- What I did**
This is the following step for merging sonic-py-swsssdk into sonic-swss-common sonic-net/sonic-swss-common#387

**- How I did it**

**- How to verify it**
Unit test and tested in DUT

* Replace swsssdk.SonicV2Connector with swsscommon.SonicV2Connector (SWIG wrapper of C++ implementation) in production code
* Remove extra statement
* Move back the import to original place
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Dec 21, 2020
* [pyext] Add more OUTPUT type
* Refactor: add new class RedisConnector
* dbconnector: remove emtpy line
* Refine script functions parameter
* Add copy constructor to RedisConnector
* Optimize DBConnector ctor
* Revert back m_namespace
* Refactor: change name
* Fix build
* Extract psubscribe and subscribe function into DBConnector class
* Implement _subscribe_keyspace_notification, _unsubscribe_keyspace_notification and _connection_error_handler
* Implement blockable
* Implement connect with retry
* Implement DBConnector::publish(),
* Use c++11 syntax instead of c++14
* Implement blocking for get and del
* Add to pyext
* Add set_redis_kwargs(), fix _onetime_connect()
* Fix LGTM: delete implicitly-declared copy assignment operator
* update DBInterface redis_client index from db_id to db_name
* Add DBInterface::delete_all_by_pattern()
* Add SonicV2Connector class
* Add unit test for SonicV2Connector
* Make const strings public because they are used as public method default parameters
* SWIG supports keyword arguments in generated python module
* Add python namespace property to DBConnector class, solve the paramter conflicting with C++ keyword by customizing python code generation
* Move SonicV2Connector to standalone .h/.cpp files
* Add missing include statements into SWIG inteface file
* Add pytest unit test for DBInterface and SonicV2Connector
* Fix swig customization on SonicV2Connector ctor
* Add attrib SonicV2Connector.namespace
* Remove debug code
* Use EXPECT_NE to simplify test
* Remove unused code
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Dec 21, 2020
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Jan 21, 2021
* [pyext] Add more OUTPUT type
* Refactor: add new class RedisConnector
* dbconnector: remove emtpy line
* Refine script functions parameter
* Add copy constructor to RedisConnector
* Optimize DBConnector ctor
* Revert back m_namespace
* Refactor: change name
* Fix build
* Extract psubscribe and subscribe function into DBConnector class
* Implement _subscribe_keyspace_notification, _unsubscribe_keyspace_notification and _connection_error_handler
* Implement blockable
* Implement connect with retry
* Implement DBConnector::publish(),
* Use c++11 syntax instead of c++14
* Implement blocking for get and del
* Add to pyext
* Add set_redis_kwargs(), fix _onetime_connect()
* Fix LGTM: delete implicitly-declared copy assignment operator
* update DBInterface redis_client index from db_id to db_name
* Add DBInterface::delete_all_by_pattern()
* Add SonicV2Connector class
* Add unit test for SonicV2Connector
* Make const strings public because they are used as public method default parameters
* SWIG supports keyword arguments in generated python module
* Add python namespace property to DBConnector class, solve the paramter conflicting with C++ keyword by customizing python code generation
* Move SonicV2Connector to standalone .h/.cpp files
* Add missing include statements into SWIG inteface file
* Add pytest unit test for DBInterface and SonicV2Connector
* Fix swig customization on SonicV2Connector ctor
* Add attrib SonicV2Connector.namespace
* Remove debug code
* Use EXPECT_NE to simplify test
* Remove unused code
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Jan 21, 2021
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Feb 25, 2021
* [pyext] Add more OUTPUT type
* Refactor: add new class RedisConnector
* dbconnector: remove emtpy line
* Refine script functions parameter
* Add copy constructor to RedisConnector
* Optimize DBConnector ctor
* Revert back m_namespace
* Refactor: change name
* Fix build
* Extract psubscribe and subscribe function into DBConnector class
* Implement _subscribe_keyspace_notification, _unsubscribe_keyspace_notification and _connection_error_handler
* Implement blockable
* Implement connect with retry
* Implement DBConnector::publish(),
* Use c++11 syntax instead of c++14
* Implement blocking for get and del
* Add to pyext
* Add set_redis_kwargs(), fix _onetime_connect()
* Fix LGTM: delete implicitly-declared copy assignment operator
* update DBInterface redis_client index from db_id to db_name
* Add DBInterface::delete_all_by_pattern()
* Add SonicV2Connector class
* Add unit test for SonicV2Connector
* Make const strings public because they are used as public method default parameters
* SWIG supports keyword arguments in generated python module
* Add python namespace property to DBConnector class, solve the paramter conflicting with C++ keyword by customizing python code generation
* Move SonicV2Connector to standalone .h/.cpp files
* Add missing include statements into SWIG inteface file
* Add pytest unit test for DBInterface and SonicV2Connector
* Fix swig customization on SonicV2Connector ctor
* Add attrib SonicV2Connector.namespace
* Remove debug code
* Use EXPECT_NE to simplify test
* Remove unused code
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Feb 25, 2021
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Jul 20, 2021
* [pyext] Add more OUTPUT type
* Refactor: add new class RedisConnector
* dbconnector: remove emtpy line
* Refine script functions parameter
* Add copy constructor to RedisConnector
* Optimize DBConnector ctor
* Revert back m_namespace
* Refactor: change name
* Fix build
* Extract psubscribe and subscribe function into DBConnector class
* Implement _subscribe_keyspace_notification, _unsubscribe_keyspace_notification and _connection_error_handler
* Implement blockable
* Implement connect with retry
* Implement DBConnector::publish(),
* Use c++11 syntax instead of c++14
* Implement blocking for get and del
* Add to pyext
* Add set_redis_kwargs(), fix _onetime_connect()
* Fix LGTM: delete implicitly-declared copy assignment operator
* update DBInterface redis_client index from db_id to db_name
* Add DBInterface::delete_all_by_pattern()
* Add SonicV2Connector class
* Add unit test for SonicV2Connector
* Make const strings public because they are used as public method default parameters
* SWIG supports keyword arguments in generated python module
* Add python namespace property to DBConnector class, solve the paramter conflicting with C++ keyword by customizing python code generation
* Move SonicV2Connector to standalone .h/.cpp files
* Add missing include statements into SWIG inteface file
* Add pytest unit test for DBInterface and SonicV2Connector
* Fix swig customization on SonicV2Connector ctor
* Add attrib SonicV2Connector.namespace
* Remove debug code
* Use EXPECT_NE to simplify test
* Remove unused code
kktheballer pushed a commit to kktheballer/sonic-swss-common that referenced this pull request Jul 20, 2021
malletvapid23 added a commit to malletvapid23/Sonic-Utility that referenced this pull request Aug 3, 2023
…IG wrapper of C++ implementation) in production code (#1217)

**- What I did**
This is the following step for merging sonic-py-swsssdk into sonic-swss-common sonic-net/sonic-swss-common#387

**- How I did it**

**- How to verify it**
Unit test and tested in DUT

* Replace swsssdk.SonicV2Connector with swsscommon.SonicV2Connector (SWIG wrapper of C++ implementation) in production code
* Remove extra statement
* Move back the import to original place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants