#redis #observer

generic-db-observer

A generic observer that monitors a database for changes and triggers a change in some Event Subject

4 releases (2 breaking)

0.3.1 Mar 22, 2024
0.3.0 Mar 22, 2024
0.2.0 Mar 21, 2024
0.1.0 Mar 15, 2024

#951 in Database interfaces

Download history 128/week @ 2024-03-13 435/week @ 2024-03-20 34/week @ 2024-03-27 28/week @ 2024-04-03

142 downloads per month

MIT/Apache

20KB
283 lines

generic-db-observer

A generic observer that monitors a database for changes (currently only Redis is supported) and then triggers a change in some Event Subject. To create a program based on this library, you need to implement EventSubject, and then run the function ObserverConfig::run_observer.

Limitations:

  • Redis PubSub doesn't actually tell us which channels are added or left, instead we receive a notification that "something has changed", and then we have to load the entire set of tracked channels and compare it with which channels are currently joined. This probably causes quite a performance hit.
  • The Event Subject connection is expected to be blocking, whereas the Database connection is expected to be async.

lib.rs:

generic-db-observer

A generic observer that monitors a database for changes (currently only Redis is supported) and then triggers a change in some Event Subject. To create a program based on this library, you need to implement EventSubject, and then run the function ObserverConfig::run_observer.

Limitations:

  • Redis PubSub doesn't actually tell us which channels are added or left, instead we receive a notification that "something has changed", and then we have to load the entire set of tracked channels and compare it with which channels are currently joined. This probably causes quite a performance hit.
  • The Event Subject connection is expected to be blocking, whereas the Database connection is expected to be async.

Dependencies

~7–19MB
~242K SLoC