Support for async datastore now in master

9 views
Skip to first unread message

chris

unread,
Jun 10, 2011, 6:15:32 PM6/10/11
to highchair-user
Hello,

I've pushed support for the async datastore to master. Check the specs
for more details (or ask here), but If you've defined a Kind name
Person, you can make async calls by:

1) Mixing in highchair.datastore.Async to a Kind:
object Person extends Kind[Person] with Async[Person] { ... }

Person now has a lazy val `async`.

2) Wrapping a Kind for ad-hoc async calls. This can be done explicitly
or implicitly:
Async(Person)
-- or --
import Async._
Person.async


To support asynchronous calls while insulating applications from the
datastore APIs, async calls yield a highchair.datastore.FutureF. This
is a functor which will accumulate transformations in sequence, but
that only execute when `FutureF#get` is called. Internally, this calls
`get` on the wrapped java.util.concurrent.Future instance, and then
applies the transformations. The result of `FutureF#get` is an
`Either[Throwable, E]`, so you can deal with any errors that may have
occurred during the background task or transformations. Of course,
your transformations should be pure, so nothing should blow up :-).

I'd appreciate feedback/suggestions if you'll be using this. Thanks!

-chris
Reply all
Reply to author
Forward
0 new messages