[#1013] Implement the Database Adapter#1025
Conversation
| * @tparam ConnT The underlying connection object type (e.g., pqxx::connection). | ||
| */ | ||
| template <typename ConnT> | ||
| class DatabaseWrapper { |
There was a problem hiding this comment.
@eddiebrissow @marcocapozzoli
Please make this class implement commons/processor/Processor.h. Basically it means you need to implement
virtual void setup();
virtual void start();
virtual void stop();
setup() Is supposed to make proper initialization without starting any threads, connections etc. It's OK if it's empty.
start() is supposed to start any resources like threads, connections, file openings etc
stop() is supposed to gracefully stop the use of any resource. Stopping/synching threads, closing connections, closing open files etc.
The idea is that relevant resources like threads, connections etc become Processors as well. You can connect them (by calling add_subprocessor()) so when you setup/start/stop Processors they are setup/started/stopped in the proper order to avoid crashing.
We already have DedicatedThread.h and ThreadPool.h in the Processor package. The former is for when you need to spawn a single thread. The later is for when you want a thread pool of workers.
You may need to add a PostgresDBConnection (which inherits from Processor as well) in your package and probably you'll pass this class as the template argument instead of connection type.
| /** | ||
| * @brief Closes the connection. | ||
| */ | ||
| virtual void disconnect() = 0; |
There was a problem hiding this comment.
This method will disappear when you implement Processor
This PR adds the initial implementation of the Database Adapter. It introduces the abstract interfaces that define the adapter contract and provides a concrete Postgres-backed adapter implementation.
Resolves #1013