Add missing documentation about the Subscribe API

Moved from GitHub badger/1075

Posted by jarifibrahim:

The subscribe API

was added in badger via https://github.com/dgraph-io/badger/commit/26128a761d2639840a238a54d812c1a386ae4fa0 but there is no documentation about it. We should also have an example of how to use the Subscribe API.

https://github.com/dgraph-io/badger/blob/f50343ff404d8198df6dc83755ec2eab863d5ff2/db_test.go#L1939-L1948 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.