Add missing documentation about the Subscribe API

Moved from GitHub badger/1075

Posted by jarifibrahim:

The subscribe API

was added in badger via Add new API Subscribe to listen on update for the specified prefix (#… · dgraph-io/badger@26128a7 · GitHub but there is no documentation about it. We should also have an example of how to use the Subscribe API.

badger/db_test.go at f50343ff404d8198df6dc83755ec2eab863d5ff2 · dgraph-io/badger · GitHub can be used for inspiration.

jarifibrahim commented :

cc @balajijinnah

kaustubhmallik commented :

@jarifibrahim is this still available to grab?

kaustubhmallik commented :

@jarifibrahim By documentation, you mean adding explanations and usage (code example) in the README directly, correct? As far as I have understood, this feature enables you to add a post-update behaviour (callback function) for certain set of keys, configured using the key’s prefix.

Also, as you said, the example can be directly quoted from the test you have written.