Add support for notifications 49/149/5 v0.1.0
authorMarco Tallskog <marco.tallskog@nokia.com>
Tue, 14 May 2019 12:09:19 +0000 (15:09 +0300)
committerMarco Tallskog <marco.tallskog@nokia.com>
Thu, 16 May 2019 11:53:53 +0000 (14:53 +0300)
commit738be7ac9cf248eae4783353df252b0f90dc6c77
treead0f658df72666ad0fa70ed5e86bc1d97da1500d
parent9617339c09dfd2a0dca05afadb07ae3f7f06a9c6
Add support for notifications

Add new API function to subscribe/unsubscribe  notifications
from a channel. With SubscribeChannel function it is possible to
subscribe one or many channels and attach a callback function taht will
be called when the notification (event) is received from a channel. It
is possible to have separate callback functions to different channels
but then subscription must be done separately. With UnsubscribeChannel
one can unsubscribe one or many subsribed channels.

Each function, that modifies database (sets or removes) will have
another API function that will cause an event to be sent to given
channel. E.g. the following two functions:

Set(pairs ...interface{})
SetAndPublish(channelsAndEvents []string, pairs ...interface{})

The first function just sets a value to key, whereas the second function
does the same thing and also sends an event to channel. The channels and
events are given as pairs in channelsAndEvents slice e.g.
[]string{"channel", "event"}
Although it is possible to give several channel event pairs, only
sending an event to one channel is supported at the moment due to
missing support in Redis DB.

Change-Id: I4fc96cd4c8a59410700f670ad5588fe71509fd03
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
bench_test.go
cmd/sdltester/sdltester.go
example_test.go
go.mod
internal/sdlgoredis/sdlgoredis.go
sdl.go
sdl_test.go