api3: add LCB_VALUE_SIMPLE

Change-Id: Id60cf5fa6ba69fca1aed363e3861f8ee03cccf53
Reviewed-on: http://review.couchbase.org/38845
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
V3 Response API

This commit adds the new response interface for future versions. It adds
common fields and flags, as well as an extensible versioning format (the
'version' field is still retained on top).

All responses now inherit from a common base class, and all response
callback signatures are idential, cutting out the boilerplate required
for creating wrappers.

Change-Id: Ie1e2d9919b0ae4e0ed6974f67fc3f9d8e8a65c00
Reviewed-on: http://review.couchbase.org/38573
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
SmokeTest: Disable terse URI for simple ENOENT test

CouchbaseMock has issues with 404 URLs for some reason.

Change-Id: Ia058e3d409ea0e79935f4aaf093f2c4735a80234
Reviewed-on: http://review.couchbase.org/38844
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
callback.c: windows build fix

Change-Id: I4a670d8d476c0c4503faee38235362670934b781
Reviewed-on: http://review.couchbase.org/38897
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Add lcb_MULTICMD_CTX for observe

This is a new 'v3' API which allows the stuffing of multiple commands
into a temporary structure, with a final 'done' phase which actually
assembles the packet. It fits well with how OBSERVE works and may be
fitted for endure in a subsequent commit.

Change-Id: If5a6478c49615355ac97bab106e58a19e1312f05
Reviewed-on: http://review.couchbase.org/38859
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Make durability operations use the new multicmd API

Change-Id: I2b6a5bc31268b7c850030e09772ba766b60eb802
Reviewed-on: http://review.couchbase.org/38898
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
General endure fixups and tidying

Change-Id: Id383d79517d0b0e01d7eb7d86107e4ccd5242452
Reviewed-on: http://review.couchbase.org/38899
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
cbc: Use the newer callbacks API

Change-Id: Ie0943e252b3ccba4982cb0189ce7669a53ed3dd9
Reviewed-on: http://review.couchbase.org/38900
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
netbuf: Fix curblocks/maxblocks

We previously didn't use these variables resulting in high amounts of
malloc/free.

Change-Id: Iaeae2f462d93707f3baec286c6231529d191c95b
Reviewed-on: http://review.couchbase.org/38925
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
api3: Remove lcb_CMDOPTIONS

Let all the options be at the same level, this lets us better optimize
the layout.

Change-Id: I4b81b35c0d68b01d8f2cb3731808d4836ba8e46d
Reviewed-on: http://review.couchbase.org/38926
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Better document v3 API

This reworks the entire api3 file (but not changing anything else in the
code) by reorgaizing the sections of the file. It also moves the more
low level buffer stuff to kvbuf.h.

Change-Id: I765b18a410c2591edecd61040e96c1d6fb16b4b5
Reviewed-on: http://review.couchbase.org/38927
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
api3/touch: command is const

Change-Id: Ie8f6c16d3a80d72d45046c8f3507a8a8ace9b51e
Reviewed-on: http://review.couchbase.org/38935
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Populate 'bufh' in get responses

This forms the basis of "Futures" for gets

Change-Id: Ifec6416601b489eb3151a69f098910535d217c8e
Reviewed-on: http://review.couchbase.org/38982
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
ioctx: Don't invoke flush_ready() callback when entered

This saves a lot of performance for being able to pipeline writes

Change-Id: Ie757d3aa700d801973c900be974b72668d829f60
Reviewed-on: http://review.couchbase.org/38986
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-459: Add error categories for server load and server responses

[ Ported from release23 ]

This commit adds two new error classifiers:

- LCB_ERRTYPE_SRVGEN for replies which are mapped one-to-one with a
  server reply.
- LCB_ERRTYPE_SRVLOAD for replies which unequivocally indicate the
  server is under load.

Change-Id: I51b3e8a843cf48276dbd4735526f78154f502d32
Reviewed-on: http://review.couchbase.org/39022
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
api3: Normalize command names

- lcb_counter3(), lcb_CMDCOUNTER, lcb_RESPCOUNTER,
  LCB_CALLBACKTYPE_COUNTER

- lcb_remove3(), lcb_CMDREMOVE, lcb_RESPREMOVE, LCB_CALLBACKTYPE_REMOVE

Change-Id: Ieb14ed062d20736c4f03e548184bdf976f84d2a7
Reviewed-on: http://review.couchbase.org/39037
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
api3: Pass int as callbacktype, rather than enum

int is more ABI-safe and shorter to type. We should convert most of our
APIs requesting 'enum' as a type over to 'int'.. that's another story
though

Change-Id: Id20755d14744a59b9fc8313d691b70121e738cae
Reviewed-on: http://review.couchbase.org/39038
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
select: stylistic changes

While trying to fork the select plugin, I realized the original could
do with some better naming conventions and use of proper typedefs for
handler types.

None of the logic was actually changed, just some whitespace and naming
fixes:

- We should use either unqualified or sel_-prefixed functions. There is
  no reason for each function to be prefixed with lcb_io_foo. Not only
  does this make the name longer, it also makes it sound like this
  function is actually exported somewhere rather than being static.

- Use prefixed names rather than the '_t' suffix.

Change-Id: I2b7f6a50a36ddaf7e30ef00425bcfaded175ccef
Reviewed-on: http://review.couchbase.org/39054
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
cliopts: don't assign progname if NULL

Logic should be inverted

Change-Id: Iec46673a75801adff5a565dd361255611f427e3a
Reviewed-on: http://review.couchbase.org/39094
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-472: update ht_nodes when receiving new config

This lets lcb_get_server_list work properly to receive new nodes

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