Implement circular list

Change-Id: I7edf4525508c125c3b3e7af9d76cc3cffe3cba46
Reviewed-on: http://review.couchbase.org/27515
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>