agemooij / riak-scala-client

An easy to use, non-blocking, fast Scala client library for interacting with Riak.
http://riak.scalapenos.com/
Apache License 2.0
84 stars 24 forks source link

Implement 'store' methods as fire-and-forget #2

Closed asomov closed 11 years ago

asomov commented 11 years ago

I propose to split 'store' methods into 2 blocks. One is fire-and-forget, and one is with 'returnbody=true'. RiakValue becomes required for the latter:

def storeAndFetch(key: String, value: RiakValue): Future[RiakValue] def store(key: String, value: RiakValue): Future[Unit]

agemooij commented 11 years ago

I only just saw this issue. The latest version offers an extra returnBody: Boolean parameter that determines whether the new value (and vclock) is returned. The return type is still Future[Option[RiakValue]] though.

I definitely understand your point about it being more clear if the "no return value" version were to return Future[Unit] but for now I value having less different versions of the store(...) method more than the more explicit return type.

I'm still thinking about using the Magnet pattern as described on the Spray blog, which would allow for path-dependent return types where the version without an explicit Boolean parameter could return Future[Unit]. It's on the backlog but not at the top, so please be patient ;)