Various wrapper classes I use in my projects
Go to file
2024-10-09 00:04:11 +03:00
.yarn/releases Add more debug statements to broker 2024-10-09 00:03:42 +03:00
scripts Optional prom-client peer dependency 2023-11-11 17:11:47 +02:00
src Add more debug statements to broker 2024-10-09 00:03:42 +03:00
tests Add more debug statements to broker 2024-10-09 00:03:42 +03:00
.eslintignore Add more debug statements to broker 2024-10-09 00:03:42 +03:00
.eslintrc.json Add more debug statements to broker 2024-10-09 00:03:42 +03:00
.gitignore MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
.yarnrc.yml Add more debug statements to broker 2024-10-09 00:03:42 +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.9.0 2024-10-09 00:04:11 +03:00
README.md MariaDB wrapper can listen to status updates from cluster 2023-07-13 19:06:07 +03:00
tsconfig.cjs.json Fix interface types 2023-11-29 13:44:34 +02:00
tsconfig.json Fix interface types 2023-11-29 13:44:34 +02:00
yarn.lock Upgrade yarn 2024-03-29 09:22:02 +02: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.