Chapter 8. Remote Procedure Call

Table of Contents

8.1. Overview
8.2. RPC Model
8.3. Asynchronous RPC
8.3.1. Immediate Asynchronous RPC
8.3.2. Scheduling Asynchronous RPC
8.4. Synchronous RPC
8.4.1. Performing The Call
8.4.2. SRPC Exceptions
8.4.3. SRPC Security and Limitations
8.4.4. Advantages and Disadvantages of SRPC
8.5. Advanced Techniques
8.5.1. Triggering Replication by RPC
8.5.2. Synchronous RPC Optimizations
8.5.3. Asynchronous RPC to Replicas
8.5.4. Getting Reply to Asynchronous RPC
8.5.5. Dynamic RPC
8.6. Configuration and Statistics
8.7. Method Arguments and Results
8.7.1. Pointers
8.7.2. Managed Objects
8.8. RPC Reference Guide

8.1. Overview

This chapter describes various flavors of the remote procedure call (RPC) mechanisms provided by the Massiv. RPC allows you to call methods of managed objects, even if they are not owned by local node, using syntax nearly identical to that of local calls.

To be able to call a method, it must be described in the IDL of its class. If you are not acquainted with the IDL concept yet, refer to Chapter 9, Introduction to IDL. In all examples in this chapter, it's assumed that a class Foo with the following IDL description exists:

Example 8.1. RPC Example - IDL for class Foo
class Foo : Massiv::Core::Object
    {
    method< const > bar( out int32 result, in int32 param ) : bool;
    method baz( out int32 result, in int32 param ) : bool;
    };

Both methods, bar and baz, take single in argument (param) and return boolean type and single out argument (result). Method bar is constant.

Moreover, it's assumed that a valid remote pointer to object of type Foo, foo, exists. To be able to use Remote pointer to class Foo defined in the IDL description contained in foo.idl, one must include the generated header foo_rpc.h:

#include "foo_rpc.h"

Remote< Foo > foo = ...;

To see how to obtain such pointer, check Chapter 5, Pointers.