concept function in category apache thrift

appears as: The function, functions, function, function, functions
Programmer's Guide to Apache Thrift

This is an excerpt from Manning's book Programmer's Guide to Apache Thrift.

Our hello.thrift IDL file declares a single service interface called HelloSvc 1 with a single function, hello_func() 2. The function accepts no parameters and returns a string. To use this interface we can compile it with the Apache Thrift IDL compiler. The IDL compiler binary is named “thrift” on UNIX-like systems and “thrift.exe” on Windows. The compiler expects two command line arguments, an IDL file to compile and one (or more) target languages to generate code for. Here’s an example session that generates Python stubs for HelloSvc:

The Apache Thrift IDL keyword “service” is used to declare a new service in an IDL file. Services have a name and a set of functions enclosed in braces. Each function within a service declaration is separated by white space, or, optionally, a comma or a semicolon. Functions have a return type, a name, and a set of parameters.

  • <default>—The parameter is always supplied by the caller if it’s known to the caller; however, the service providing the function cannot count on the parameter being supplied, thus providing support for clients which predate the addition of the parameter:
    void myFunc( 1: i32 fieldName )
  • Apache Thrift services are collections of functions that can be called remotely using Apache Thrift RPC. The range of features provided by the Apache Thrift framework makes Apache Thrift RPC a good fit for modern, evolving, multi-language enterprises:

  • Apache Thrift services are composed of sets of functions.
  • Functions have a set of parameters and use parameter IDs, requiredness, and default values to enable interface evolution.