Commit c4dee33c authored by Kenton Varda's avatar Kenton Varda

More clarifications.

parent af2e7f57
......@@ -24,10 +24,18 @@ _UPDATE: There has been some confusion about what I'm claiming. I am NOT sayin
promises alone (i.e. being asynchronous) constitutes "time travel". Cap'n Proto implements a
technique called Promise Pipelining which allows a new request to be formed based on the content
of a previous result (in part or in whole) before that previous result is returned. Notice in the
diagram that the result of foo() is being passed to bar()._
diagram that the result of foo() is being passed to bar(). Please
[see the docs]({{ site.baseurl }}rpc.html) or
[check out the calculator example](https://github.com/kentonv/capnproto/blob/master/c++/samples)
for more._
### Promises in C++
_UPDATE: More confusion. This section is **not** about pipelining ("time travel"). This section
is just talking about implementing a promise API in C++. Pipelining is another feature on top of
that. Please [see the RPC page]({{ site.baseurl }}rpc.html) if you want to know more about
pipelining._
If you do a lot of serious Javascript programming, you've probably heard of
[Promises/A+](http://promisesaplus.com/) and similar proposals. Cap'n Proto RPC introduces a
similar construct in C++. In fact, the API is nearly identical, and its semantics are nearly
......
......@@ -87,6 +87,8 @@ foo = root.open("foo"); # 1
bar = foo.open("bar"); # 2
size = bar.size(); # 3
data = bar.read(0, size); # 4
# The above is four calls but takes only one network
# round trip with Cap'n Proto!
{% endhighlight %}
In such a high-latency scenario, making your interface elegant is simply not worth 4x the latency.
......@@ -137,6 +139,11 @@ need to change our interface at all. We keep our simple, elegant, singleton-fre
don't have to implement path strings, caching, authentication, or authorization, and yet everything
performs as well as we can possibly hope for.
#### Example code
[The calculator example](https://github.com/kentonv/capnproto/blob/master/c++/samples/calculator-client.c++)
uses promise pipelining. Take a look at the client side in particular.
### Distributed Objects
As you've noticed by now, Cap'n Proto RPC is a distributed object protocol. Interface references --
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment