Chapter 6. Apache Thrift IDL

 

This chapter covers

  • Understanding Interface Definition Languages (IDLs) in software development
  • Using Apache Thrift IDL syntax and semantics
  • Generating code for multiple languages with the Apache Thrift IDL compiler

In this chapter, we’ll examine the features of the Apache Thrift Interface Definition Language (IDL) and learn how to use the Apache Thrift compiler to generate cross-language type serialization and RPC support code (see figure 6.1). We’ll begin by exploring the syntax of the IDL itself and then cover compiler operation, trying out various bits of IDL along the way.

Figure 6.1. Apache Thrift IDL0

6.1. Interfaces

Interfaces exist in hardware and software, defining interactions between components running on a single system as well as components interoperating across networks. The power of abstraction delivered by interfaces is one of the most basic and critical tools in computer science for managing complexity.

Most developers design and use interfaces daily. In object-oriented programming, each class created has its own interface, allowing state and other implementation details to be encapsulated. When clients are isolated from implementation details, as long as the interface is preserved, object internals can change as needed. The implementation can even be moved to another computer if the client has a local proxy for the remote object that supports the same interface.

6.2. Apache Thrift IDL

6.3. The IDL compiler

6.4. Comments and documentation

6.5. Namespaces

6.6. Built-in types

6.7. Constants

6.8. Typedefs

6.9. Enum

6.10. Structures, unions, exceptions, and argument-lists

6.11. Services

6.12. Including external files

6.13. Annotations

Summary

sitemap