Clean up compat.c

- Remove 'memcached' support. This has been broken for a while now
- Move create_compat() function to instance.c

This has been broken for a while now. This commit just removes those
stale bits of dead code.

Change-Id: I995d264910993784da1be594781aa7029c6ae84b
Reviewed-on: http://review.couchbase.org/36546
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Add asynchronous pending item count

This replaces the older individual hashset_t's allocated for the
instance. Items which should block the loop are now inserted via an
opaque API.

Change-Id: Ic9bf079a138c104b874bf2fc0062986940a2c810
Reviewed-on: http://review.couchbase.org/36571
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-276: Provide lcb_destroy_async

This commit provides asynchronous destruction functionality. This allows
an application to signal to the library that a given lcb_t should be
destroyed during the next event loop iteration.

This allows asynchronous frameworks (like node.js and Twisted) to
properly handle resource/IO destruction in an orderly fashion, so that
they may detach and free user contexts only when all I/O resources are
no longer needed rather than preemptively when the library begins to be
destroyed. (Specifically, for IOCP and UV, those plugins actually loop
internally during destruction to properly release resources, but this is
not possible in 'async' mode).

- Also remove a leftover merge conflict marker
  We didn't catch this because this was #ifdef'd out for compilation

Change-Id: Iff40ebfea70e54aebf5a27748b1334b35783997d
Reviewed-on: http://review.couchbase.org/36545
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
t_slist: include <stdexcept>

Change-Id: Ia639c2a36ed86c4e442d0d22952fadc68cf72679
std::out_of_range is not defined
Reviewed-on: http://review.couchbase.org/36606
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-386: Remove mcserver_is_clean()

Since we're now more careful about allocating and releasing server
structures during toplogy changes, these APIs are no longer needed.

Change-Id: I3aae8784ae39fb5bdaec106930179006c32bff2d
Reviewed-on: http://review.couchbase.org/36607
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
add some inline comments for E_put_ex

Change-Id: I86aac8247f6f8d6209815ded5caebb81696319cf
Reviewed-on: http://review.couchbase.org/37328
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
iotable: add destructor

Change-Id: I419f9d4a959b5d6a1ae7c0e070662904ac048305
Reviewed-on: http://review.couchbase.org/37329
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CMakeList: Add convenience macro to declare utility libraries

Change-Id: Iac689cae1d3e5f0e7a95054da34b283c282de212
Reviewed-on: http://review.couchbase.org/37330
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
lcbio_CTX doc: mention rdb_consumed

Change-Id: I463e86de315efd13acaa13b2754353d594f40a67
Reviewed-on: http://review.couchbase.org/37331
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
cbsasl: Rename global openssl symbols to be prefixed with cbsasl

This caused symbol collision with openssl

Change-Id: I605b18afa5091568ef930638e154806239213370
Reviewed-on: http://review.couchbase.org/37332
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
lcbio_CTX: Don't write empty ringbuffer IOV

Change-Id: I4446f8f6577d98d9b04e26e8184f0ece4c3bf518
Reviewed-on: http://review.couchbase.org/37333
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
UV: proper EOF handling/delivering

Applications should be delivered an EOF via passing '0' as a parameter
to the read callback, rather than -1 (which indicates an error). A
graceful close is necessary in some protocols to help promptly deliver
ifnormation.

Change-Id: Ic981505d6d06d8caf5ba07c06e9ef972f51cdf2e
Reviewed-on: http://review.couchbase.org/37334
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
UV: return from read callback if nr is 0

While we usually shouldn't be getting this, it may be possible - in any
event this is UV's way of telling us that it got an EAGAIN and the
buffer we allocated is no longer needed.

Change-Id: Ie99f16b593af203e4eb0a01b4129d64a56429412
Reviewed-on: http://review.couchbase.org/37335
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-344/CCBC-425: Add SSL support via OpenSSL

This implements the SSL layer as an implementation of lcbio_TABLE. The
table is injected into the socket when the connection is successfuly
established.

Integration with libcouchbase' core itself (i.e. making operations and
configuration operations go through SSL (if requested)) will be done in
a subsequent commit.

Change-Id: I599bb6a883263e1889c2a87ae423684cd209d1e7
Reviewed-on: http://review.couchbase.org/37336
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Refactor and fork vbucket

- Rewrite vbucket.c to be cleaner
- Add simple unit test
- Move header files into <libcouchbase/*>
- Mode source files into src/
- Add support for SSL ports (as of 3.0.0-367)

Change-Id: I277ef1e540556fd6c88fe00c09d1fc0709439f9b
Reviewed-on: http://review.couchbase.org/37337
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Add additional set_nodes/get_nodes functions

These functions will allow to configure a provider with a specific list
of nodes, and retrieve the current node list.

Change-Id: Iba94fe73a8b4328039f1fcdf8fcd31ad20019fd8
Reviewed-on: http://review.couchbase.org/37338
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-344/CCBC-426: Core settings integration for SSL

- Support for adding SSL options via lcb_cntl()
- Add SSL-related fields to lcb_settings
- Add (currently undocumented) LCB_FORCE_SSL environment variable to
  test behavior
- Add SSL 'protocol context' to lcbio
- bc_cccp, mcserver, and http are SSL aware in that they will select the
  SSL URIs/hosts if enabled

Change-Id: I0ea47e3ab824156e9456391aa60f5f5867086f61
Reviewed-on: http://review.couchbase.org/37339
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Confmon: Use lcbvb_save_json() and lcbvb_replace_host()

This new function will serialize a configuration file to JSON. Thus it
is no longer needed to carry the original configuration string around.
The lcb_clconfig_create() function has been modified to accept only two
arguments, eliminating the weirdness surrounding the middle 'raw'
parameter. Additionally bc_file will now use this method to generate the
string.

Change-Id: I7dc2069f779c27b3934120586e36ff831e5c4d2e
Reviewed-on: http://review.couchbase.org/37563
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Add LCB_ESOCKSHUTDOWN error code for EOF/graceful close

Change-Id: If7183974f1685395d4a35b9f935ed0717b305970
Reviewed-on: http://review.couchbase.org/37340
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
http: don't refresh config on graceful shutdown

Change-Id: Ib18a9ca0b5f353fae183cf1b53be398dcb758b12
Reviewed-on: http://review.couchbase.org/37341
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>