Merge pull request #13 from ajbeamon/master

Proposed changes to README.md
Fixed log message when calling Cancel() on a Transaction

- "Cancel" vs "Rolled Back"
Added IFdbDatabase and IFdbReadOnlyDatabase interfaces

- contains the BeginTransaction(..) and BeginReadOnlyTransaction(..) methods
Implemented true "read only" transactions and made FdbDatabase implement IFdbDatabase + various bugfix

- BeginReadOnlyTransaction(...) creates a transaction that will throw on write operations (prevents people from casting an IFdbReadOnlyTransaction to an IFdbTransaction)
- BeginTransaction(...) creates a transaction that will accept both read and write operations.
- Made sure that all write operations fail if the transaction has been created as readonly.
- Added methods to the transaction interfaces (Cancel, SetOption, ...) that where only exposed by the concrete implementation of FdbTransaction.
- Added "Snapshot" property on IFdbReadOnlyTransaction that return a Snapshotted instance, or the transaction itself if is already snapshotted
- Removed ToSnapshotTransaction() extension method that is not needed anymore.
- Renamed EnsureCanReadOrWrite() to EnsureCanWrite()
- Changed EnsureCanWrite(..) to allow being called from the network thread (even though it is not always a good idea).
- Fixed an invalid cast in FdbOperationContext.Execute when passed a Func<IFdbReadOnlyTransaction, Task> delegate
Added transactional overrides that take an "onDone" callback [Work in Progress]

- Called only once, with the transaction that committed with success
- Can be used to call GetCommittedVersion(..)
- Can also be used to publish changes to the global state of the application.
Updated the Message Queue layer following the recent changes

- only change the global state when the ReadWriteAsync succeeds
- FindRandomItem performs the two reads in parallel, and return the resulting key/value pair
- Clear the previous completed task, and read the task body inside the same transaction, to reduce latency
- Work in Progress! (probably broken)
Added Timeout and RetryLimit properties on the transaction interface and moved the WithXXX() transaction setters to extension methods.
Renamed most "ct" argument names in the Core API into "cancellationToken" to align with BCL naming conventions.
Updated code to use either IFdbDatabase or IFdbTransactional + renamed "Db" properties to "Database"
Use ThreadPool.UnsafeQueueWorkItem in unit test to trigger async signal
More refactored on FdbDatabase and added the PartitionTable layer

- Removed the db.Root/FdbRootDirectory combo, replaced with a FdbDatabasePartition class that wraps a db and a root layer.
- FdbDatabasePartition implements IFdbDatabase, so can be used with any layer.
- Moved a lot of instace methods out of the FdbDatabase class, and into extensions methods hanging off the IFdbDatabase interface
- Fdb.PartitionTable static helper can be used to open database with a specific DirectoryLayer, and also lookup their prefix into a master "Partition Table".
- Moved bulk operations from Fdb.Bulk.xxx to static extension methods in FdbBulkOperations.
- Update the unit tests to use the new PartitionTable (it will work under the "Tests" named partition)
- Added missing "GetAddressesForKeyAsync" method on IFdbReadOnlyTransaction
Cleaned up UnmanagedLibrary helper
IFdbReadOnlyDatabase should also be IDisposable
Added database and transaction filters, merged IFdbDatabase and IFdbReadOnlyDatabase into a single interface

- Removed the notion of IFdbReadOnlyDatabase to simplify writing filters.
- Added IsReadOnly property on IFdbDatabase, and added a way to open a db in readonly mode, transactions created from a read-only database will always be read only.
- Simplified BeginTransaction and added FdbTransactionMode flags to specify read-only and other future settings
- Refactored FdbDatabasePartition to be a database filter (that adds the DirectoryLayer property)
- The FdbTransaction class should not be visible anymore, and only used as an IFdbTransaction or IFdbReadOnlyTransaction
- Temp hack to fix unit tests that test the innards of an FdbTransaction instance.
Removed CreateOrOpenAsync(..., params string[]) extension methods

- they conflict with the methods on FdbDirectoryPartition
- there is no way to pass in a CancellationToken due to the 'params' keyword
Added two simple prototype filters

- ReadOnlyTransactionFilter force a writeable transaction to be read-only, couple with the "tr.AsReadOnly()" extension method
- PrefixRewriterTransaction: prototype filter that will add/remove a prefix to all keys to/from the db. (probably broken!)
First prototype of a Logging fransaction filter (Work in Progress)

- records all operations performed on a transaction (set, get, getrange, commit)
- currently not all commands are implemented
Forgot to store the transaction mode in the context
Added FdbFuture<T>.Clear() that calls into fdb_future_release_memory(...)

- We don't use it ourselves, but someone may need it...
Removed unused method Fdb.Errors.EndKeyOfRangeCannotBeLessThanBeginKey()