Riak Function Contrib
Riak Function Contrib is a community-powered library of MapReduce, Pre-/Post-Commit Hook, and other functions. It exists for several reasons:
- So Riak users can contribute functions they've written back to the community in one centralized, easy-to-manage location
- To provide users who are new to Riak with a list of previously-created and tested functions that may suit their usage needs
- To lower the barrier to entry to using and mastering MapReduce and Pre-/Post-Commit Hook Functions in Riak
To use the code in this repo you can either browse the source files of the functions in the directory of your choice or head over to the Riak Function Contrib site to search for useful code and read in depth descriptions provided by function authors.
Issues or Questions
Have a function to share with the rest of the Riak Community? Great. Here is how you do it:
- Fork this repo to your own GitHub account (You can read up on forking here if you need a refresher)
- Add your function source file to the appropriate repo (explained in depth below)
- Add your overview file to the appropriate repo (again, explained below)
- Send a pull request
- Kick back, smile, and relish in the fact that your functions are helping Riak users everywhere
Your Function Source File
Step 2 above is "Add your function source file to the appropriate repo." The MapReduce Functions live in the
What should the source file contain?
Apache 2.0 License Boilerplate. All files submitted to the Riak Function Contrib Repo must include the Apache 2.0 boilerplate. If you're unfamiliar with the Apache license and how to include it in your code, please take a moment and read up on it here.
Your code. This is fairly self-explanatory. In addition to the code, make sure to include adequate comments and notation. Here's a great example.
Your Overview File
In addition to your source, you're encourage to take a few minutes and put together an overview file. Why? Because your contribution to Riak Function Contrib will visible in two locations: 1) as part of the actual code repo in the form of your source file and 2) as an overview page on the Riak Function Contrib site For example, the overview page for this function lives here
This is actually pretty simple. We use Gollum to generate this site. What that means is that your overview file can be written in either Markdown or [Textile](http://en.wikipedia.org/wiki/Textile_(markup_language). Gollum will take care of converting them to html and, once you've sent the pull request, we'll regenerate the site and make sure your contribution goes live.
And, since we are using Gollum, you can build the site locally to make sure everything looks right before you send your pull request. Specifically, here's what you need to do:
- Install Gollum
- Install Gollum Site (This is a simple static site generator for Gollum written by Basho's very own Dan Reverri)
- cd into your local copy of the Riak Function Contrib repo
$ gollum-site generate && gollum-site serve
- Head to http://localhost:8000/
This should get the site running locally and you should be able to view your additions. You must commit your changes locally in order for Gollum to generate them
A General Note on File Naming
Also, be sure to name your overview file with the same name as your source file (save for the extension, of course). So, to continue with the example given above, if your source file is named "large-object-filter-reduce.js" you would name your overview file "large-object-filter-reduce.textile"