CCBC-543: Use settings->durability_interval if not specified

Don't use the hardcoded default

Change-Id: I223f51d8c1a0a6099c172ef84997e8642097cadc
Reviewed-on: http://review.couchbase.org/42906
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
CCBC-540: Document durability interval as microseconds

Change-Id: Ib01d8efe273b2f8753598c7b5e7a9a7cfc86764a
Reviewed-on: http://review.couchbase.org/42907
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fix up some compiler warnings in cbc

Change-Id: I266a3692140c9b85bcdeaf8d98e458a72b9931c1
Reviewed-on: http://review.couchbase.org/42771
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-542: Set appropriate min/max size for pillowfight

We were previously reading from uninitialized memory. This fixes it

Change-Id: I7101ad293764612c7ffe51978d9eb1386c2af108
Reviewed-on: http://review.couchbase.org/42908
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Allow building of RPMs with CMake

- Don't install .la files
- Fixed packaging/rpm/package.mk for adaptation

Change-Id: I5a1d046d83d9548e66c7aea1571af38af1fa0371
Reviewed-on: http://review.couchbase.org/42769
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Allow building Debian package with CMake

- Don't include .la files with Debian packages

- Allow option to build with cmake for Debian (LCB_DEB_CMAKE, in the
  environment)

- Add generated defs.mk for CMake
  This helps include "makefiles" get the same variables from CMake

- Use GNUInstallDirs for installation prefixes. This also icludes an
  option for customization to disable the /usr/lib/x86-64- install
  directory

- Add dummy test target if no tests are enabled. Debian wants tests, but
  we don't really have a chance to run them, since we rely on the Mock

- Output VERSION file appropriately. Also parse the version in a form
  suitable for a source distribution.

- cmake/configure fixes:
    - Allow configurable build directory
    - Include additional 'vestigial' Makefiles, such as docs, deb/rpm packages
    - Allow to run as `./configure`

- Clean up deb/package.mk. Allow to run under cmake using more dynamic
  directory configurations.

Change-Id: I910ab713b3b8106331aa6db83f268d5297a74b7a
Reviewed-on: http://review.couchbase.org/42768
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Allow forwarding packets to specific servers

As a prelude to DCP support (and other extended commands), let the
specific server be determined beforehand, so the library doesn't need to
do an explicit vbucket mapping.

Change-Id: I78dbba27a75bd4e4dcb3a0f9bd04c49f47287a45
Reviewed-on: http://review.couchbase.org/42543
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Add lcbcore as an 'object' library

This way we don't need to compile the object files twice for
libcouchbase.so and libcouchbaseS.a

Change-Id: Ice6856964510c24bc675aad05fa6f1284c88d120
Reviewed-on: http://review.couchbase.org/42770
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CMake: Ensure strict compiler flags for core projects

Previously we would accidentally miss out some of the compile flags.
This fixes these mentions :)

Change-Id: Ia593a1b2ed3aaf57750fa1bc601a0da1c92f3280
Reviewed-on: http://review.couchbase.org/42772
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CMake: Set LCB_LIBDIR in config.h

This makes the compilation line less noisy

Change-Id: I1c491b55077edb974ade362f15a664391f4fa8a5
Reviewed-on: http://review.couchbase.org/42773
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Don't add $ROOT/cmake to include paths

This doesn't contain any actual header files!

Change-Id: I7f1e2b813a24bc950553f32607907c9cea2327ce
Reviewed-on: http://review.couchbase.org/42774
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CMake: install cbc symlinks on non-windows platforms

Change-Id: I4ce1331d8cfcc60f86933be147f9a8fc30ec7fac
Reviewed-on: http://review.couchbase.org/42789
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CMake: build examples

Change-Id: Ib4c29dd928f39ea4c85d918b4198fc96c5be3767
Reviewed-on: http://review.couchbase.org/42905
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
CCBC-548 Check if snappy enabled when generating dummy source target

Change-Id: I2341f9fae8918629182cfba0ec1a0d7e7a22dd69
Reviewed-on: http://review.couchbase.org/43042
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Undocument internal legacy structures from headers

- make some older definitions fit in a single line, because
  they are no longer used internally and are intended for back compat with
  older code.
- Undocument older `lcb_create_st` member structures
- Mode `lcb_configuration_callback` stuff to the `deprecated.h` file and
  deprecate the callback accessors. These functions should not be used
  in newer code - rather the alternative `lcb_set_bootstrap_callback`
  should be used.
- Undocument internal `IOCREATEOPTS` members. Code should either
  explicitly create one from external code, or use the builtin struct
  variant.

We should really move a lot of these definitions outside of the header
files, but we need to be compatible with code as early as 2.0.0 (two
years ago).

Change-Id: I75619795e7d4a16248465dd580c3d43d6228f8e6
Reviewed-on: http://review.couchbase.org/43025
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fix leak in DurabilityUnitTest::testDuplicateCommands

We should use the two-arg createConnection() which provides a scoped
'HandleWrap' object.

Change-Id: I83417944db0dd3d506214ef924618643119ad6f1
Reviewed-on: http://review.couchbase.org/43026
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Migrate builtin I/O plugins to use 'v2'

This changes the plugins to use the 'v2' plugin interface, which employs
the `lcb_io_procs_fn` interface to call into the plugin to get the
further definitions for various socket APIs.

This is needed to support dead socket detection

Change-Id: I61470ea1521024c4d50f822674e614a4ebf78cc3
Reviewed-on: http://review.couchbase.org/43028
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
CCBC-546: Implement dead socket detection for connection pool

This adds dead socket detection for determining whether a socket handle
is still active, or if it has been closed. The implementation is done in
several layers:

* Add new lcb_io{E,C}_chkclosed_fn definition for E and C style I/O
  plugins.
* Bump up LCB_IOPROCS_VERSION to 3
* Add wrapper function in lcbio/ioutils.{c,h} to check socket status
* Make lcbio_MGR check socket status before it returns a cached socket

Change-Id: I688690cd19e63ffef86c3837c48bd5cc9a68a86b
Reviewed-on: http://review.couchbase.org/43029
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Add some documentation for our socket tests

These tests are really useful. Unfortunately, I didn't write enough docs
the first time around. This should help :)

This commit also removes unused members, and organizes some classes into
better public/protected/private sections (using friend classes when
access is needed by some other internal components).

Change-Id: I072e413b5b52287c098ee9ce5f3ca76b7a3466e9
Reviewed-on: http://review.couchbase.org/43027
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Dummy DCP commit

Change-Id: I632fa3d1a4d58dae7fcf5f9e6e38cd1af97f634d