basho/riak_kv — pull request #771 by jtuple (2013-12-19 03:27:40+00:00)
Title: Add support for conditional postcommit hooks

This commit adds support for conditional postcommit hooks. Currently, these
are implemented solely for typed buckets, but may be expanded to untyped
buckets in the future.

This addition is motivated by the lack of support for "bucket fixups" for
typed buckets. For traditional buckets, fixups are the primary mechanism
used in Riak to ensure hooks are installed on buckets as necessary.

Unlike traditional postcommits hooks, that are registered per-bucket,
conditional hooks are registered globally (per node). Each time a PUT is
triggered, all registered conditional postcommit hooks are triggered. The
hook function is passed the relevant bucket, key, and bucket properties and
should return either false or a list of postcommit hooks that should be
triggered. If any hooks are returned, they are invoked the same as normal
postcommit hooks.