wiki:Grass7/RPCInterface

Version 3 (modified by huhabla, 10 years ago) ( diff )

--

RPC interface for persistent GUI

Proposal of a RPC interface for persistent GUI applications.

Introduction

Like any other GIS needs GRASS a reliable graphical user interface (GUI) to manage, display and interact with maps. The GRASS GIS core libraries should be used to implement a GUI to achieve good performance, especially in case of vector editing. The design of the GRASS core libraries targets the implementation of GRASS modules and is not designed for persistent applications like a GUI. The main problem for persistent application is, that several library functions will terminate the application in case of a fatal error. This approach makes the implementation of GRASS modules more easy, but is not applicable in persistent applications, since the handling of fatal errors is mostly done by library functions.

One reasonable approach to use the GRASS GIS core libraries in persistent applications is the implementation of a Remote Procedure Call wrapper, that provides an interface to GRASS library functions that exists in a different process space than the persistent application. This will avoid the termination of the persistent application in case of a fatal error. The drawback is the complex implementation of a RPC interface, or in case a third party solution is used to implement the RPC interface additional dependencies. The RPC interface will also add more overhead to each function call, since data that is passed between persistent application and the GRASS library interface process must be serialized and transferred via Interprocess Communication (IPC). It will also add more code and complexity to GRASS that must be maintained.

The benefits of a RPC interface are:

  • the ability to implement fast and well function persistent client applications like GUI's
  • Support for different programming languages on client side (Python, C++, Java, JavaScript) that will have access to GRASS library functions
  • Implementation of GUI specific functionality, hence bundling of GRASS library functions on the server side
  • Support for parallel reading of raster and vector maps using several server processes in parallel
  • Providing a well designed object oriented interface to GRASS that will not change in case the underlying GRASS core libraries change

Implementation

I would strongly suggest to use apache thrift[1] to implement the RPC interface for GRASS core libraries. This framework support plenty of programming languages, adds minimal dependencies and provides platform independent RPC functionality (data serialization, IPC).

[1] https://thrift.apache.org/

Note: See TracWiki for help on using the wiki.