Use constants instead of magic numbers

Change-Id: I14141359aecbe30e5b8a2576407d2e5072110e8f
Reviewed-on: http://review.couchbase.org/25941
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>