Make synchronization more granular

A previous change-set added some synchronization that used a 
private static variable as the lock; hence all instances of 
the client were blocked when a configuration update happened 
accept for the first client to acquire the lock. This patch 
makes the lock instance level and reduces the amount of code 
that is blocked to the minimum needed. 

Change-Id: I52109dfd5f24fc758d8f3f24a7244c0b5cbbca56
Reviewed-on: http://review.couchbase.org/42819
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Rename transcoder to Transcoder to reflect proper c# naming conventions

Change-Id: I7c96ce79eab204f22ed28a7f9616308cfcc845ab
Reviewed-on: http://review.couchbase.org/42820
Reviewed-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-716: IBucket.Replace overload has wrong type for CAS

Change-Id: I59a4daf9f71c3d277e886699c513101928a9ee5a
Reviewed-on: http://review.couchbase.org/42856
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-713: Ensure that multiple buckets can be added to a configuration

Change-Id: I9cdad08dbb078f13fcf948c1992d78ee80230514
Reviewed-on: http://review.couchbase.org/42858
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-693: ODE in ConnectionPool.Dispose when run against cluster_run

Change-Id: I078b7038b147b352379d0f708e1cb213b63c7858
Reviewed-on: http://review.couchbase.org/42863
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-700: Add overload for Prepend/Append that accepts byte arrays

Change-Id: I4aa4d425c9dddb347667d2d045e8d3cd1bf72fb9
Reviewed-on: http://review.couchbase.org/42882
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-714: JSON and URI encode view input parameters

This patch ensures that view parameters are JSON encoded and URI escaped
within the ViewQuery class. Note that additional overloads were added to
disable this functionality in situtations where it is not needed.

Change-Id: I68c3ddebb1a4c12baf41577bee68cb6d141b1193
Reviewed-on: http://review.couchbase.org/42911
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
NCBC-711: Add support for GetL, Unlock and provide GetWithLock impl on IBucket

Change-Id: Ibd33d0ece5bf7408f0d4291408c9c1b1821b5f19
Reviewed-on: http://review.couchbase.org/42912
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-493: Implement Replica Read Capability

Change-Id: Ie1261b149864a8f87545814d10b390141cba5f6d

Conflicts:
	Src/Couchbase.Tests/Core/Buckets/CouchbaseBucketTests.cs
	Src/Couchbase/Couchbase.csproj
	Src/Couchbase/IO/Operations/OperationCode.cs
Change-Id: I9ab0dcf1a3dfde832fd55687d1e06958246b2a2e
Reviewed-on: http://review.couchbase.org/43437
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-721: Ensure Increment Wraps when it Overflows

This patch fixes a bug where the Increment interface incorrectly was
declared with a signed long instead of an unsigned long, which resulted in
an overflow exception before the value wrapped back around to zero.

Change-Id: Iee17c7dc0df197036e701c9bdb6de98da5b1918a
Reviewed-on: http://review.couchbase.org/43281
Reviewed-by: Simon Baslé <simon@couchbase.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Ensure error message is only created if ODE is thrown

Change-Id: I923340a8fb6061688d240c1b4429e500d15fb933
Reviewed-on: http://review.couchbase.org/43323
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
IO Namespace refactoring and support for async/await

Change-Id: I38b1dae90f0c7d4400f88b4dc460c8fd41e8c20c

Conflicts:
	Src/Couchbase/Couchbase.csproj
	Src/Couchbase/IO/Operations/IOperation.cs
Change-Id: I0d66352d1e975d427504b7fc525e4539cae435b5
Reviewed-on: http://review.couchbase.org/43452
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-723: Timings - public interface level, server level, IO level

This commit adds an optional timing feature for all memcached operations.
The timings are taken at three levels: public interface (level three),
before IO begins (level two) and for IO only (level one). The timing
information is logged to the log appender in  the format:

'Timing: [{level}|{operation}|{opaque}|{time}|{key}]'

For example:

Timing: [Two|Set`1|29389|2.401|key30690]

This format makes it easy to grep for the timings info and then parse the
results for analysis. It also makes it easy to trace a key and opaque as
it goes through the operation pipeline.

NOTE: when enabled will cause significant performance degradation!
NOTE: requires a LogLevel of DEBUG and EnableOperationTiming to be TRUE
for the timings to be enabled.

Change-Id: Icd48fffac311d4a57bf2eef150d1f225fb610572
Reviewed-on: http://review.couchbase.org/43419
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Reviewed-by: Simon Baslé <simon@couchbase.com>
NCBC-724: Version numbers and configuration logging

This feature appends the version number of the assembly plus the current
client configuration (not the cluster map info) to the log file when the
Cluster object is initialized. This information can be used for diagnosing
issues and providing additional information to help with support issues.

Change-Id: I0af864828715c368f57400924fccc94a861460a3

Conflicts:
	Src/Couchbase/Configuration/Client/ClientConfiguration.cs
Change-Id: I3b4ba6fac02b03239d69310c0c5ffd52b09ed813
Reviewed-on: http://review.couchbase.org/43610
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Move transcoding and serialization outside of scope of acquire/release

Improves overall performance by moving the code that takes the most time
outside of of the scope of connection pooling, so that time spent with a
connection is minimized.

Change-Id: I81aa99822cbf542ae150fb75ba10a8677dca8d4e
Reviewed-on: http://review.couchbase.org/43574
Reviewed-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-722: Add support for mapping view results to POCOs

This commit changes the way view results are mapped to POCOs via the
ViewRow object. It also allows a consumer to call a Values property to get
the values of the Rows without having to deal with the RowView object.
The result of the Values property is a mapping of the Value of each row
and a POCO into an IEnumerable object.

Change-Id: I07a1c0b053673079fca83bf36f1f839e0f1496aa
Reviewed-on: http://review.couchbase.org/43583
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-726: Ensure ViewDataMapper uses configured serializer settings

This patch changes the behavior of the JsonDataMapper, which is used by
the ViewClient, so that it uses the JsonSerializationSettings defined by
the ClientConfiguration object.

Change-Id: I508839a32a5eb528d8ee8fa661b7cdaa7d75c3c7
Reviewed-on: http://review.couchbase.org/43585
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-725: Make the ICluster interface public so that it can be mocked

This changes the name of ICOuchbaseCluster to ICluster and makes it a
public interface, making it capable of being mocked using a mocking
framework such as Moq.

Change-Id: I55f84f23441520a076e37d23bb2c1af9b4588049
Reviewed-on: http://review.couchbase.org/43587
Reviewed-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
NCBC-719: Ensure operations use FMap if available

This commit checks to see if a VBucket forward map is available. If it is
the index of the VBucket Forward Map will be used, otherwise the VBucket's
index is used.

Change-Id: I817f818058e49884bc87dc85d0935654a18d3e62
Reviewed-on: http://review.couchbase.org/43589
Reviewed-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Fix unit tests that were failing because of previous commits

Change-Id: I911295e0e84fe30631caffd52266d1bbd2beeb86
Reviewed-on: http://review.couchbase.org/43607
Reviewed-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>