Various wrapper classes I use in my projects
Go to file
2023-10-20 12:58:23 +03:00
scripts MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
src try-catch createIndex 2023-10-20 12:58:09 +03:00
tests MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
.eslintrc.json update eslint rules 2023-07-03 16:33:39 +03:00
.gitignore MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
index.ts fixes 2023-08-22 21:35:04 +03:00
LICENSE MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
package.json v1.6.10 2023-10-20 12:58:23 +03:00
README.md MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
tsconfig.cjs.json support both cjs and esm 2023-04-12 22:12:03 +03:00
tsconfig.json support both cjs and esm 2023-04-12 22:12:03 +03:00
yarn.lock export mariadb types and upgrade dependency 2023-08-10 10:52:28 +03:00

wrappers

Various wrapper classes I use in my projects.
These are specifically written for my use cases, though feel free to use.

MessageBroker: Wraps amqp-connection-manager and amqplib by extension. Ensures smooth failover when connected to a cluster.
MariaDB: Wraps mysql. Takes care of connection pooling whether connecting to a cluster or single instance.
MongoDB: Wraps mongodb. Primarily just adds helper functions.

The MariaDB wrapper takes care of automatic cluster status updates if supplied with an event source, it provides a listener through the statusUpdateListener property. It ensures that the wrapper does not query a node that is not currently synced in the cluster. Somewhat similar to how the MessageBroker handles automatic failover.
The MongoDB native driver seems to take care of this stuff by itself, so it remains a fairly trivial wrapper with just helper functions.

A notification script that can be used to listen for cluster updates is located in /scripts/wsrep_notify.sh. It takes the arguments provided by galera and posts them to a given URL, the JSON payload is then to be fed into the status update listener of the MariaDB wrapper.

Expected to be used together with a parent class that has a createLogger method, as defined in /src/interfaces/Server.ts and /src/interfaces/Logger.ts, utilising the logger from https://git.corgi.wtf/Navy.gif/logger.